Bug 1183400 - Fold various simple unary cases by kind. r=efaust
authorJeff Walden <jwalden@mit.edu>
Fri, 22 May 2015 19:02:41 -0700
changeset 287215 5b94aec178f136387abf2da1952b17daff112478
parent 287214 7dbbc282b2e75110b67d7e33903a6855c7440075
child 287216 9eb62a986338baa03557126320e8debc95a7e74b
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersefaust
bugs1183400
milestone42.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 1183400 - Fold various simple unary cases by kind. r=efaust
js/src/frontend/FoldConstants.cpp
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -1136,37 +1136,45 @@ Fold(ExclusiveContext* cx, ParseNode** p
 
       case PNK_PREINCREMENT:
       case PNK_POSTINCREMENT:
       case PNK_PREDECREMENT:
       case PNK_POSTDECREMENT:
         return FoldIncrementDecrement(cx, pn, parser, inGenexpLambda);
 
       case PNK_THROW:
+      case PNK_ARRAYPUSH:
+      case PNK_MUTATEPROTO:
       case PNK_COMPUTED_NAME:
-      case PNK_ARRAYPUSH:
       case PNK_SPREAD:
-      case PNK_MUTATEPROTO:
+      case PNK_SUPERELEM:
+        MOZ_ASSERT(pn->isArity(PN_UNARY));
+        return Fold(cx, &pn->pn_kid, parser, inGenexpLambda, SyntacticContext::Other);
+
+      case PNK_SEMI:
+        MOZ_ASSERT(pn->isArity(PN_UNARY));
+        if (ParseNode*& expr = pn->pn_kid)
+            return Fold(cx, &expr, parser, inGenexpLambda, SyntacticContext::Other);
+        return true;
+
       case PNK_EXPORT:
-      case PNK_SEMI:
       case PNK_ASSIGN:
       case PNK_ADDASSIGN:
       case PNK_SUBASSIGN:
       case PNK_BITORASSIGN:
       case PNK_BITXORASSIGN:
       case PNK_BITANDASSIGN:
       case PNK_LSHASSIGN:
       case PNK_RSHASSIGN:
       case PNK_URSHASSIGN:
       case PNK_MULASSIGN:
       case PNK_DIVASSIGN:
       case PNK_MODASSIGN:
       case PNK_POWASSIGN:
       case PNK_ELEM:
-      case PNK_SUPERELEM:
       case PNK_COLON:
       case PNK_CASE:
       case PNK_SHORTHAND:
       case PNK_DOWHILE:
       case PNK_WHILE:
       case PNK_SWITCH:
       case PNK_LETBLOCK:
       case PNK_FOR: