Bug 1167823 - Handle more nodes by kind when checking for side effects. r=shu
authorJeff Walden <jwalden@mit.edu>
Tue, 19 May 2015 08:29:08 -0700
changeset 247700 1e35358eb8401d115757c6337ece962cec426ab3
parent 247699 4de3e7d764dce5d6986dedad93bdb5039cf1ce79
child 247701 5baf4bf01aa2b4e66f7af715b5b891c6e9e62662
push idunknown
push userunknown
push dateunknown
reviewersshu
bugs1167823
milestone41.0a1
Bug 1167823 - Handle more nodes by kind when checking for side effects. r=shu
js/src/frontend/BytecodeEmitter.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -1991,16 +1991,22 @@ BytecodeEmitter::checkSideEffects(ParseN
         return true;
 
       // This invokes the (user-controllable) iterator protocol.
       case PNK_SPREAD:
         MOZ_ASSERT(pn->isArity(PN_UNARY));
         *answer = true;
         return true;
 
+      case PNK_YIELD_STAR:
+      case PNK_YIELD:
+        MOZ_ASSERT(pn->isArity(PN_BINARY));
+        *answer = true;
+        return true;
+
       // Deletion generally has side effects, even if isolated cases have none.
       case PNK_DELETENAME:
       case PNK_DELETEPROP:
       case PNK_DELETESUPERPROP:
       case PNK_DELETEELEM:
       case PNK_DELETESUPERELEM:
         MOZ_ASSERT(pn->isArity(PN_UNARY));
         *answer = true;
@@ -2083,16 +2089,17 @@ BytecodeEmitter::checkSideEffects(ParseN
       case PNK_SUB:
       case PNK_STAR:
       case PNK_DIV:
       case PNK_MOD:
         MOZ_ASSERT(pn->isArity(PN_LIST));
         *answer = true;
         return true;
 
+      case PNK_DEFAULT:
       case PNK_COLON:
       case PNK_CASE:
         MOZ_ASSERT(pn->isArity(PN_BINARY));
         if (!checkSideEffects(pn->pn_left, answer))
             return false;
         if (*answer)
             return true;
         return checkSideEffects(pn->pn_right, answer);
@@ -2183,19 +2190,16 @@ BytecodeEmitter::checkSideEffects(ParseN
       case PNK_EXPORT_BATCH_SPEC:
       case PNK_FRESHENBLOCK:
       case PNK_SHORTHAND:
       case PNK_SWITCH:
       case PNK_LETBLOCK:
       case PNK_CLASSMETHOD:
       case PNK_WITH:
       case PNK_CLASSNAMES:
-      case PNK_DEFAULT:
-      case PNK_YIELD_STAR:
-      case PNK_YIELD:
       case PNK_RETURN:
       case PNK_CLASS:
       case PNK_TRY:
       case PNK_GENEXP:
       case PNK_STATEMENTLIST:
       case PNK_ARGSBODY:
       case PNK_ARRAYCOMP:
       case PNK_CLASSMETHODLIST: