Title: [197654] trunk/Source/_javascript_Core
Revision
197654
Author
benja...@webkit.org
Date
2016-03-06 18:43:09 -0800 (Sun, 06 Mar 2016)

Log Message

[JSC] Remove a superfluous Move in front of every double unboxing
https://bugs.webkit.org/show_bug.cgi?id=155064

Reviewed by Saam Barati.

Double unboxing was always doing:
    Move source, scratch
    Add64 tag, scratch
    IntToDouble scratch, fp

We do not need to "Move" to copy the source.
Both x86 and ARM64 have an efficient 3 operands Add instruction.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileValueToInt32):
(JSC::DFG::SpeculativeJIT::compileDoubleRep):
(JSC::DFG::SpeculativeJIT::speculateRealNumber):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::unboxDouble):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::unboxDoubleWithoutAssertions):
(JSC::AssemblyHelpers::unboxDouble):
(JSC::AssemblyHelpers::unboxDoubleNonDestructive):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (197653 => 197654)


--- trunk/Source/_javascript_Core/ChangeLog	2016-03-07 02:42:43 UTC (rev 197653)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-03-07 02:43:09 UTC (rev 197654)
@@ -1,5 +1,31 @@
 2016-03-06  Benjamin Poulain  <benja...@webkit.org>
 
+        [JSC] Remove a superfluous Move in front of every double unboxing
+        https://bugs.webkit.org/show_bug.cgi?id=155064
+
+        Reviewed by Saam Barati.
+
+        Double unboxing was always doing:
+            Move source, scratch
+            Add64 tag, scratch
+            IntToDouble scratch, fp
+
+        We do not need to "Move" to copy the source.
+        Both x86 and ARM64 have an efficient 3 operands Add instruction.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileValueToInt32):
+        (JSC::DFG::SpeculativeJIT::compileDoubleRep):
+        (JSC::DFG::SpeculativeJIT::speculateRealNumber):
+        * dfg/DFGSpeculativeJIT.h:
+        (JSC::DFG::SpeculativeJIT::unboxDouble):
+        * jit/AssemblyHelpers.h:
+        (JSC::AssemblyHelpers::unboxDoubleWithoutAssertions):
+        (JSC::AssemblyHelpers::unboxDouble):
+        (JSC::AssemblyHelpers::unboxDoubleNonDestructive):
+
+2016-03-06  Benjamin Poulain  <benja...@webkit.org>
+
         [JSC] Use 3 operands Add in more places
         https://bugs.webkit.org/show_bug.cgi?id=155082
 

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (197653 => 197654)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2016-03-07 02:42:43 UTC (rev 197653)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2016-03-07 02:43:09 UTC (rev 197654)
@@ -2013,8 +2013,7 @@
             }
 
             // First, if we get here we have a double encoded as a JSValue
-            m_jit.move(gpr, resultGpr);
-            unboxDouble(resultGpr, fpr);
+            unboxDouble(gpr, resultGpr, fpr);
 
             silentSpillAllRegisters(resultGpr);
             callOperation(toInt32, resultGpr, fpr);
@@ -2171,8 +2170,7 @@
 #if USE(JSVALUE64)
         GPRTemporary temp(this);
         GPRReg tempGPR = temp.gpr();
-        m_jit.move(op1Regs.gpr(), tempGPR);
-        m_jit.unboxDoubleWithoutAssertions(tempGPR, resultFPR);
+        m_jit.unboxDoubleWithoutAssertions(op1Regs.gpr(), tempGPR, resultFPR);
 #else
         FPRTemporary temp(this);
         FPRReg tempFPR = temp.fpr();
@@ -2249,9 +2247,8 @@
                 JSValueRegs(op1GPR), node->child1(), SpecBytecodeNumber,
                 m_jit.branchTest64(MacroAssembler::Zero, op1GPR, GPRInfo::tagTypeNumberRegister));
         }
-    
-        m_jit.move(op1GPR, tempGPR);
-        unboxDouble(tempGPR, resultFPR);
+
+        unboxDouble(op1GPR, tempGPR, resultFPR);
         done.append(m_jit.jump());
     
         isInteger.link(&m_jit);
@@ -6583,8 +6580,7 @@
 #if USE(JSVALUE64)
     GPRTemporary temp(this);
     GPRReg tempGPR = temp.gpr();
-    m_jit.move(op1Regs.gpr(), tempGPR);
-    m_jit.unboxDoubleWithoutAssertions(tempGPR, resultFPR);
+    m_jit.unboxDoubleWithoutAssertions(op1Regs.gpr(), tempGPR, resultFPR);
 #else
     FPRTemporary temp(this);
     FPRReg tempFPR = temp.fpr();

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (197653 => 197654)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2016-03-07 02:42:43 UTC (rev 197653)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2016-03-07 02:43:09 UTC (rev 197654)
@@ -452,9 +452,9 @@
     {
         return m_jit.boxDouble(fpr, gpr);
     }
-    FPRReg unboxDouble(GPRReg gpr, FPRReg fpr)
+    FPRReg unboxDouble(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
     {
-        return m_jit.unboxDouble(gpr, fpr);
+        return m_jit.unboxDouble(gpr, resultGPR, fpr);
     }
     GPRReg boxDouble(FPRReg fpr)
     {

Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.h (197653 => 197654)


--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.h	2016-03-07 02:42:43 UTC (rev 197653)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.h	2016-03-07 02:43:09 UTC (rev 197654)
@@ -1037,16 +1037,16 @@
         jitAssertIsJSDouble(gpr);
         return gpr;
     }
-    FPRReg unboxDoubleWithoutAssertions(GPRReg gpr, FPRReg fpr)
+    FPRReg unboxDoubleWithoutAssertions(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
     {
-        add64(GPRInfo::tagTypeNumberRegister, gpr);
-        move64ToDouble(gpr, fpr);
+        add64(GPRInfo::tagTypeNumberRegister, gpr, resultGPR);
+        move64ToDouble(resultGPR, fpr);
         return fpr;
     }
-    FPRReg unboxDouble(GPRReg gpr, FPRReg fpr)
+    FPRReg unboxDouble(GPRReg gpr, GPRReg resultGPR, FPRReg fpr)
     {
         jitAssertIsJSDouble(gpr);
-        return unboxDoubleWithoutAssertions(gpr, fpr);
+        return unboxDoubleWithoutAssertions(gpr, resultGPR, fpr);
     }
     
     void boxDouble(FPRReg fpr, JSValueRegs regs)
@@ -1054,10 +1054,9 @@
         boxDouble(fpr, regs.gpr());
     }
 
-    void unboxDoubleNonDestructive(JSValueRegs regs, FPRReg destFPR, GPRReg scratchGPR, FPRReg)
+    void unboxDoubleNonDestructive(JSValueRegs regs, FPRReg destFPR, GPRReg resultGPR, FPRReg)
     {
-        move(regs.payloadGPR(), scratchGPR);
-        unboxDouble(scratchGPR, destFPR);
+        unboxDouble(regs.payloadGPR(), resultGPR, destFPR);
     }
 
     // Here are possible arrangements of source, target, scratch:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to