Title: [97928] trunk/Source/_javascript_Core
Revision
97928
Author
[email protected]
Date
2011-10-19 20:32:20 -0700 (Wed, 19 Oct 2011)

Log Message

DFG JIT 32_64 - remove unnecessary double unboxings in fillDouble/fillSpeculateDouble
https://bugs.webkit.org/show_bug.cgi?id=70460

Patch by Yuqiang Xian <[email protected]> on 2011-10-19
Reviewed by Filip Pizlo.

As pointed out by Gavin in bug #70418, when a value is already in memory
we can avoid loading it to two GPRs at first and then unboxing them to a FPR.
This gives 9% improvement on Kraken if without the change in bug #70418,
and 1% if based on the code with bug #70418 change.
Performance is neutral in V8 and SunSpider.

* dfg/DFGJITCodeGenerator32_64.cpp:
(JSC::DFG::JITCodeGenerator::fillDouble):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (97927 => 97928)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-20 03:16:29 UTC (rev 97927)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-20 03:32:20 UTC (rev 97928)
@@ -1,3 +1,21 @@
+2011-10-19  Yuqiang Xian  <[email protected]>
+
+        DFG JIT 32_64 - remove unnecessary double unboxings in fillDouble/fillSpeculateDouble
+        https://bugs.webkit.org/show_bug.cgi?id=70460
+
+        Reviewed by Filip Pizlo.
+
+        As pointed out by Gavin in bug #70418, when a value is already in memory
+        we can avoid loading it to two GPRs at first and then unboxing them to a FPR.
+        This gives 9% improvement on Kraken if without the change in bug #70418,
+        and 1% if based on the code with bug #70418 change.
+        Performance is neutral in V8 and SunSpider.
+
+        * dfg/DFGJITCodeGenerator32_64.cpp:
+        (JSC::DFG::JITCodeGenerator::fillDouble):
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
+
 2011-10-19  Gavin Barraclough  <[email protected]>
 
         Poisoning of strict caller,arguments inappropriately poisoning "in"

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator32_64.cpp (97927 => 97928)


--- trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator32_64.cpp	2011-10-20 03:16:29 UTC (rev 97927)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCodeGenerator32_64.cpp	2011-10-20 03:32:20 UTC (rev 97928)
@@ -132,14 +132,19 @@
                 info.fillDouble(fpr);
                 return fpr;
             }
-            GPRReg tag = allocate();
-            GPRReg payload = allocate();
-            m_jit.emitLoad(nodeIndex, tag, payload);
-            m_gprs.retain(tag, virtualRegister, SpillOrderSpilled);
-            m_gprs.retain(payload, virtualRegister, SpillOrderSpilled);
-            info.fillJSValue(tag, payload, spillFormat);
-            unlock(tag);
-            unlock(payload);
+
+            FPRReg fpr = fprAllocate();
+            JITCompiler::Jump isInteger = m_jit.branch32(MacroAssembler::Equal, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag));
+            m_jit.loadDouble(JITCompiler::addressFor(virtualRegister), fpr);
+            JITCompiler::Jump hasUnboxedDouble = m_jit.jump();
+
+            isInteger.link(&m_jit);
+            m_jit.convertInt32ToDouble(JITCompiler::payloadFor(virtualRegister), fpr);
+
+            hasUnboxedDouble.link(&m_jit);
+            m_fprs.retain(fpr, virtualRegister, SpillOrderSpilled);
+            info.fillDouble(fpr);
+            return fpr;
         }
     }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (97927 => 97928)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2011-10-20 03:16:29 UTC (rev 97927)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2011-10-20 03:32:20 UTC (rev 97928)
@@ -181,15 +181,21 @@
                 m_fprs.retain(fpr, virtualRegister, SpillOrderSpilled);
                 info.fillDouble(fpr);
                 return fpr;
-            } 
-            GPRReg tag = allocate();
-            GPRReg payload = allocate();
-            m_jit.emitLoad(nodeIndex, tag, payload);
-            m_gprs.retain(tag, virtualRegister, SpillOrderSpilled);
-            m_gprs.retain(payload, virtualRegister, SpillOrderSpilled);
-            info.fillJSValue(tag, payload, spillFormat);
-            unlock(tag);
-            unlock(payload);
+            }
+
+            FPRReg fpr = fprAllocate();
+            JITCompiler::Jump isInteger = m_jit.branch32(MacroAssembler::Equal, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag));
+            speculationCheck(m_jit.branch32(MacroAssembler::AboveOrEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::LowestTag)));
+            m_jit.loadDouble(JITCompiler::addressFor(virtualRegister), fpr);
+            JITCompiler::Jump hasUnboxedDouble = m_jit.jump();
+
+            isInteger.link(&m_jit);
+            m_jit.convertInt32ToDouble(JITCompiler::payloadFor(virtualRegister), fpr);
+
+            hasUnboxedDouble.link(&m_jit);
+            m_fprs.retain(fpr, virtualRegister, SpillOrderSpilled);
+            info.fillDouble(fpr);
+            return fpr;
         }
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to