Bug 1274588 part 2 - Rely on aliased jump target to remove extra popStatement function. r=jorendorff
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Thu, 02 Jun 2016 13:41:04 +0000
changeset 341188 e838c11fd532d3bf3d7562fe56337a7a1bcd3c6b
parent 341187 32eb8332d6185ecaaddd2a016d782d1c12227766
child 341189 3723ba4d368b091036edcfcd3cf7634f7028c98d
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1274588
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274588 part 2 - Rely on aliased jump target to remove extra popStatement function. r=jorendorff
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1022,27 +1022,19 @@ BytecodeEmitter::enterNestedScope(StmtIn
     return true;
 }
 
 // Patches |breaks| and |continues| unless the top statement info record
 // represents a try-catch-finally suite.
 bool
 BytecodeEmitter::popStatement()
 {
-    JumpTarget brk{ -1 };
-    return popStatement(brk);
-}
-
-bool
-BytecodeEmitter::popStatement(JumpTarget brk)
-{
     if (!innermostStmt()->isTrying()) {
-        if (brk.offset == -1 && !emitJumpTarget(&brk))
-            return false;
-        patchJumpsToTarget(innermostStmt()->breaks, brk);
+        if (!emitJumpTargetAndPatch(innermostStmt()->breaks))
+            return false;
         patchJumpsToTarget(innermostStmt()->continues, innermostStmt()->update);
     }
 
     stmtStack.pop();
     return true;
 }
 
 bool
@@ -5752,17 +5744,17 @@ BytecodeEmitter::emitSpread(bool allowSe
 
         MOZ_ASSERT(this->stackDepth == loopDepth);
     }
 
     // Let Ion know where the closing jump of this loop is.
     if (!setSrcNoteOffset(noteIndex, 0, beq.offset - initialJump.offset))
         return false;
 
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
 
     if (!tryNoteList.append(JSTRY_FOR_OF, stackDepth, top.offset, brk.offset))
         return false;
 
     if (!emit2(JSOP_PICK, 3))                             // ARR FINAL_INDEX RESULT ITER
         return false;
 
@@ -5863,17 +5855,17 @@ BytecodeEmitter::emitForOf(ParseNode* pn
     }
 
     // Let Ion know where the closing jump of this loop is.
     if (!setSrcNoteOffset(noteIndex, 0, beq.offset - jmp.offset))
         return false;
 
     // Fixup breaks and continues.
     // For StmtType::SPREAD, just pop innermostStmt().
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
 
     if (!tryNoteList.append(JSTRY_FOR_OF, stackDepth, top.offset, brk.offset))
         return false;
 
     return emitUint16Operand(JSOP_POPN, 2);               //
 }
 
@@ -5959,17 +5951,17 @@ BytecodeEmitter::emitForIn(ParseNode* pn
     if (!emitBackwardJump(JSOP_IFEQ, top, &beq, &brk))
         return false;
 
     /* Set the srcnote offset so we can find the closing jump. */
     if (!setSrcNoteOffset(noteIndex, 0, beq.offset - jmp.offset))
         return false;
 
     // Fix up breaks and continues.
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
 
     // Pop the enumeration value.
     if (!emit1(JSOP_POP))
         return false;
 
     if (!tryNoteList.append(JSTRY_FOR_IN, this->stackDepth, top.offset, offset()))
         return false;
@@ -6143,17 +6135,17 @@ BytecodeEmitter::emitCStyleFor(ParseNode
     /* The third note offset helps us find the loop-closing jump. */
     if (!setSrcNoteOffset(noteIndex, 2, beq.offset - tmp))
         return false;
 
     if (!tryNoteList.append(JSTRY_LOOP, stackDepth, top.offset, brk.offset))
         return false;
 
     /* Now fixup all breaks and continues. */
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
     return true;
 }
 
 bool
 BytecodeEmitter::emitFor(ParseNode* pn)
 {
     MOZ_ASSERT(pn->isKind(PNK_FOR));
@@ -6306,17 +6298,17 @@ BytecodeEmitter::emitComprehensionForOf(
 
     MOZ_ASSERT(this->stackDepth == loopDepth);
 
     // Let Ion know where the closing jump of this loop is.
     if (!setSrcNoteOffset(noteIndex, 0, beq.offset - jmp.offset))
         return false;
 
     // Fixup breaks and continues.
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
 
     if (!tryNoteList.append(JSTRY_FOR_OF, stackDepth, top.offset, brk.offset))
         return false;
 
     if (letBlockScope) {
         if (!leaveNestedScope(&letStmt))
             return false;
@@ -6422,17 +6414,17 @@ BytecodeEmitter::emitComprehensionForIn(
     if (!emitBackwardJump(JSOP_IFEQ, top, &beq, &brk))
         return false;
 
     /* Set the srcnote offset so we can find the closing jump. */
     if (!setSrcNoteOffset(noteIndex, 0, beq.offset - jmp.offset))
         return false;
 
     // Fix up breaks and continues.
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
 
     // Pop the enumeration value.
     if (!emit1(JSOP_POP))
         return false;
 
     JumpTarget endIter{ offset() };
     if (!tryNoteList.append(JSTRY_FOR_IN, this->stackDepth, top.offset, endIter.offset))
@@ -6720,17 +6712,17 @@ BytecodeEmitter::emitDo(ParseNode* pn)
      * Be careful: We must set noteIndex2 before noteIndex in case the noteIndex
      * note gets bigger.
      */
     if (!setSrcNoteOffset(noteIndex2, 0, beq.offset - top.offset))
         return false;
     if (!setSrcNoteOffset(noteIndex, 0, 1 + (continues.offset - top.offset)))
         return false;
 
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
     return true;
 }
 
 bool
 BytecodeEmitter::emitWhile(ParseNode* pn)
 {
     /*
@@ -6791,17 +6783,17 @@ BytecodeEmitter::emitWhile(ParseNode* pn
         return false;
 
     if (!tryNoteList.append(JSTRY_LOOP, stackDepth, top.offset, brk.offset))
         return false;
 
     if (!setSrcNoteOffset(noteIndex, 0, beq.offset - jmp.offset))
         return false;
 
-    if (!popStatement(brk))
+    if (!popStatement())
         return false;
     return true;
 }
 
 bool
 BytecodeEmitter::emitBreak(PropertyName* label)
 {
     StmtInfoBCE* stmt = innermostStmt();
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -459,17 +459,16 @@ struct BytecodeEmitter
     MOZ_MUST_USE bool bindNameToSlotHelper(ParseNode* pn);
 
     void strictifySetNameNode(ParseNode* pn);
     JSOp strictifySetNameOp(JSOp op);
 
     MOZ_MUST_USE bool tryConvertFreeName(ParseNode* pn);
 
     MOZ_MUST_USE bool popStatement();
-    MOZ_MUST_USE bool popStatement(JumpTarget breakTarget);
     void pushStatement(StmtInfoBCE* stmt, StmtType type, JumpTarget top);
     void pushStatementInner(StmtInfoBCE* stmt, StmtType type, JumpTarget top);
     void pushLoopStatement(LoopStmtInfo* stmt, StmtType type, JumpTarget top);
 
     MOZ_MUST_USE bool enterNestedScope(StmtInfoBCE* stmt, ObjectBox* objbox, StmtType stmtType);
     MOZ_MUST_USE bool leaveNestedScope(StmtInfoBCE* stmt);
 
     MOZ_MUST_USE bool enterBlockScope(StmtInfoBCE* stmtInfo, ObjectBox* objbox, JSOp initialValueOp,