DFG JIT, Branch on integer can always be a 32-bit compare.
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2011 23:05:59 +0000 (23:05 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2011 23:05:59 +0000 (23:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69174

Reviewed by Sam Weinig.

if (shouldSpeculateInteger(node.child1()) && !isStrictInt32(node.child1())),
the JSVALUE64 JIT will currently compare all 64bits in the register, but in
these cases the DataFormat is always a JS boxed integer. In these cases we
can just compare the low 32bits anyway - no need to check the tag.
This allows the code to be unified with the JSVALUE32_64 JIT.

* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

index 1c4ea63..40f4834 100644 (file)
@@ -1,3 +1,21 @@
+2011-09-30  Gavin Barraclough  <barraclough@apple.com>
+
+        DFG JIT, Branch on integer can always be a 32-bit compare.
+        https://bugs.webkit.org/show_bug.cgi?id=69174
+
+        Reviewed by Sam Weinig.
+
+        if (shouldSpeculateInteger(node.child1()) && !isStrictInt32(node.child1())),
+        the JSVALUE64 JIT will currently compare all 64bits in the register, but in
+        these cases the DataFormat is always a JS boxed integer. In these cases we
+        can just compare the low 32bits anyway - no need to check the tag.
+        This allows the code to be unified with the JSVALUE32_64 JIT.
+
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::compile):
+
 2011-09-30  Oliver Hunt  <oliver@apple.com>
 
         Need a sensible GGC policy
index f4e7f2f..aa5d2f0 100644 (file)
@@ -1270,7 +1270,7 @@ void SpeculativeJIT::compile(Node& node)
 
     case Branch:
         if (isStrictInt32(node.child1()) || shouldSpeculateInteger(node.child1())) {
-            SpeculateStrictInt32Operand op(this, node.child1());
+            SpeculateIntegerOperand op(this, node.child1());
             
             BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
             BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset());
index 7d7a9aa..ceec934 100644 (file)
@@ -1363,8 +1363,8 @@ void SpeculativeJIT::compile(Node& node)
     }
 
     case Branch:
-        if (isStrictInt32(node.child1())) {
-            SpeculateStrictInt32Operand op(this, node.child1());
+        if (isStrictInt32(node.child1()) || shouldSpeculateInteger(node.child1())) {
+            SpeculateIntegerOperand op(this, node.child1());
             
             BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
             BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset());
@@ -1385,29 +1385,6 @@ void SpeculativeJIT::compile(Node& node)
             noResult(m_compileIndex);
             break;
         }
-        if (shouldSpeculateInteger(node.child1())) {
-            SpeculateIntegerOperand op(this, node.child1());
-
-            BlockIndex taken = m_jit.graph().blockIndexForBytecodeOffset(node.takenBytecodeOffset());
-            BlockIndex notTaken = m_jit.graph().blockIndexForBytecodeOffset(node.notTakenBytecodeOffset());
-            
-            MacroAssembler::RelationalCondition condition = MacroAssembler::NotEqual;
-
-            if (taken == (m_block + 1)) {
-                condition = MacroAssembler::Equal;
-                BlockIndex tmp = taken;
-                taken = notTaken;
-                notTaken = tmp;
-            }
-            
-            addBranch(m_jit.branchPtr(condition, op.gpr(), GPRInfo::tagTypeNumberRegister), taken);
-
-            if (notTaken != (m_block + 1))
-                addBranch(m_jit.jump(), notTaken);
-            
-            noResult(m_compileIndex);
-            break;
-        }
         emitBranch(node);
         break;