Bug 1308383 - Part 6: Add IfThenElseEmitter::popped. r=shu
authorTooru Fujisawa <arai_a@mac.com>
Tue, 01 Nov 2016 16:53:50 +0900
changeset 432246 4561836d44dcadefc813936a194fb42567a0ab2b
parent 432245 83472f5679d4c349c01b546c50cf1ca8ea004ee8
child 432247 d2526689ef032790ef20dd129e054b5bbc60b458
push id34240
push userbmo:ttromey@mozilla.com
push dateTue, 01 Nov 2016 14:41:32 +0000
reviewersshu
bugs1308383
milestone52.0a1
Bug 1308383 - Part 6: Add IfThenElseEmitter::popped. r=shu
js/src/frontend/BytecodeEmitter.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -4652,16 +4652,20 @@ class MOZ_STACK_CLASS IfThenElseEmitter
         }
 #endif
     }
 
 #ifdef DEBUG
     int32_t pushed() const {
         return pushed_;
     }
+
+    int32_t popped() const {
+        return -pushed_;
+    }
 #endif
 };
 
 bool
 BytecodeEmitter::emitDestructuringOpsArray(ParseNode* pattern, DestructuringFlavor flav)
 {
     MOZ_ASSERT(pattern->isKind(PNK_ARRAY));
     MOZ_ASSERT(pattern->isArity(PN_LIST));
@@ -4779,17 +4783,17 @@ BytecodeEmitter::emitDestructuringOpsArr
             if (!emit1(JSOP_POP))                                 // ... OBJ? ARRAY
                 return false;
             if (!emitConditionallyExecutedDestructuringLHS(member, flav)) // ... OBJ?
                 return false;
 
             if (!isHead) {
                 if (!ifThenElse.emitEnd())
                     return false;
-                MOZ_ASSERT(ifThenElse.pushed() == -1);
+                MOZ_ASSERT(ifThenElse.popped() == 1);
             }
             needToPopIterator = false;
             MOZ_ASSERT(!member->pn_next);
             break;
         }
 
         ParseNode* pndefault = nullptr;
         ParseNode* subpattern = member;
@@ -4891,17 +4895,17 @@ BytecodeEmitter::emitDestructuringOpsArr
 
         if (!ifThenElse.emitEnd())
             return false;
         if (hasNextNonSpread)
             MOZ_ASSERT(ifThenElse.pushed() == 1);
         else if (hasNextSpread)
             MOZ_ASSERT(ifThenElse.pushed() == 0);
         else
-            MOZ_ASSERT(ifThenElse.pushed() == -1);
+            MOZ_ASSERT(ifThenElse.popped() == 1);
     }
 
     if (needToPopIterator) {
         if (!emit1(JSOP_POP))                                     // ... OBJ?
             return false;
     }
 
     return true;