Bug 1373323 - IonMonkey: Do not move blocks used as anchors for backtracking. r=jandem
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Mon, 19 Jun 2017 16:29:51 +0000
changeset 596759 dac1bc10b8399d47d25bab407c67973849d2e476
parent 596758 5d4bb1715f7cee221abc2e88124458370e78d38a
child 596760 603e5ded7f5db5b05bb32d18c5adf2a40a20a8c6
push id64751
push userbmo:rbarker@mozilla.com
push dateMon, 19 Jun 2017 19:08:32 +0000
reviewersjandem
bugs1373323
milestone56.0a1
Bug 1373323 - IonMonkey: Do not move blocks used as anchors for backtracking. r=jandem
js/src/jit/IonBuilder.cpp
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -1491,18 +1491,22 @@ IonBuilder::visitBlock(const CFGBlock* c
 
     cfgCurrent = cfgblock;
     pc = cfgblock->startPc();
 
     if (mblock->pc() && script()->hasScriptCounts())
         mblock->setHitCount(script()->getHitCount(mblock->pc()));
 
     // Optimization to move a predecessor that only has this block as successor
-    // just before this block.
-    if (mblock->numPredecessors() == 1 && mblock->getPredecessor(0)->numSuccessors() == 1) {
+    // just before this block.  Skip this optimization if the previous block is
+    // not part of the same function, as we might have to backtrack on inlining
+    // failures.
+    if (mblock->numPredecessors() == 1 && mblock->getPredecessor(0)->numSuccessors() == 1 &&
+        !mblock->getPredecessor(0)->outerResumePoint())
+    {
         graph().removeBlockFromList(mblock->getPredecessor(0));
         graph().addBlock(mblock->getPredecessor(0));
     }
 
     MOZ_TRY(setCurrentAndSpecializePhis(mblock));
     graph().addBlock(mblock);
 
     while (pc < cfgblock->stopPc()) {