[JSC] DFG should not generate two jumps when the target of DoubleBranch is the next...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2016 23:28:29 +0000 (23:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Apr 2016 23:28:29 +0000 (23:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156815

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-04-20
Reviewed by Mark Lam.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

index 86943cb..3e930b5 100644 (file)
@@ -1,5 +1,15 @@
 2016-04-20  Benjamin Poulain  <bpoulain@apple.com>
 
+        [JSC] DFG should not generate two jumps when the target of DoubleBranch is the next block  
+        https://bugs.webkit.org/show_bug.cgi?id=156815
+
+        Reviewed by Mark Lam.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compilePeepHoleDoubleBranch):
+
+2016-04-20  Benjamin Poulain  <bpoulain@apple.com>
+
         [JSC] Add register reuse for ArithAdd of an Int32 and constant in DFG
         https://bugs.webkit.org/show_bug.cgi?id=155164
 
index 54903e1..17bdf8b 100644 (file)
@@ -1334,7 +1334,12 @@ void SpeculativeJIT::compilePeepHoleDoubleBranch(Node* node, Node* branchNode, J
 {
     BasicBlock* taken = branchNode->branchData()->taken.block;
     BasicBlock* notTaken = branchNode->branchData()->notTaken.block;
-    
+
+    if (taken == nextBlock()) {
+        condition = MacroAssembler::invert(condition);
+        std::swap(taken, notTaken);
+    }
+
     SpeculateDoubleOperand op1(this, node->child1());
     SpeculateDoubleOperand op2(this, node->child2());