Bug 1130811 - Handle more miscellaneous nodes by kind when recycling. r=shu
authorJeff Walden <jwalden@mit.edu>
Tue, 10 Feb 2015 01:00:02 -0800
changeset 228940 7fd630ae8bbf0cb8c66e844730815beefbcdc258
parent 228939 d6c56cf464f524ca43301e099152d32dfca93faa
child 228941 6d93b1ffb2ce1d4f8c2e93c91b1b86d1d62cdf58
push id55559
push userjwalden@mit.edu
push dateFri, 13 Feb 2015 08:44:38 +0000
treeherdermozilla-inbound@8a411bde0705 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1130811
milestone38.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 1130811 - Handle more miscellaneous nodes by kind when recycling. r=shu
js/src/frontend/ParseNode.cpp
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -312,28 +312,63 @@ PushNodeChildren(ParseNode *pn, NodeStac
       case PNK_URSHASSIGN:
       case PNK_MULASSIGN:
       case PNK_DIVASSIGN:
       case PNK_MODASSIGN:
       // ...and a few others.
       case PNK_COLON:
       case PNK_CASE:
       case PNK_SHORTHAND:
+      case PNK_DOWHILE:
+      case PNK_WHILE:
         return PushBinaryNodeChildren(pn, stack);
 
       // Default nodes, for dumb reasons that we're not changing now (mostly
       // structural semi-consistency with PNK_CASE nodes), have a null left
       // node and a non-null right node.
       case PNK_DEFAULT: {
         MOZ_ASSERT(pn->isArity(PN_BINARY));
         MOZ_ASSERT(pn->pn_left == nullptr);
         stack->push(pn->pn_right);
         return PushResult::Recyclable;
       }
 
+      // Ternary nodes with all children non-null.
+      case PNK_CONDITIONAL: {
+        MOZ_ASSERT(pn->isArity(PN_TERNARY));
+        stack->push(pn->pn_kid1);
+        stack->push(pn->pn_kid2);
+        stack->push(pn->pn_kid3);
+        return PushResult::Recyclable;
+      }
+
+      // if-statement nodes have condition and consequent children and a
+      // possibly-null alternative.
+      case PNK_IF: {
+        MOZ_ASSERT(pn->isArity(PN_TERNARY));
+        stack->push(pn->pn_kid1);
+        stack->push(pn->pn_kid2);
+        if (pn->pn_kid3)
+            stack->push(pn->pn_kid3);
+        return PushResult::Recyclable;
+      }
+
+      // try-statements have statements to execute, and one or both of a
+      // catch-list and a finally-block.
+      case PNK_TRY: {
+        MOZ_ASSERT(pn->isArity(PN_TERNARY));
+        MOZ_ASSERT(pn->pn_kid2 || pn->pn_kid3);
+        stack->push(pn->pn_kid1);
+        if (pn->pn_kid2)
+            stack->push(pn->pn_kid2);
+        if (pn->pn_kid3)
+            stack->push(pn->pn_kid3);
+        return PushResult::Recyclable;
+      }
+
       // List nodes with all non-null children.
       case PNK_OR:
       case PNK_AND:
       case PNK_BITOR:
       case PNK_BITXOR:
       case PNK_BITAND:
       case PNK_STRICTEQ:
       case PNK_EQ:
@@ -354,40 +389,35 @@ PushNodeChildren(ParseNode *pn, NodeStac
       case PNK_DIV:
       case PNK_MOD:
       case PNK_COMMA:
       case PNK_ARRAY:
       case PNK_OBJECT:
       case PNK_VAR:
       case PNK_CONST:
       case PNK_GLOBALCONST:
+      case PNK_CATCHLIST:
         return PushListNodeChildren(pn, stack);
 
-      case PNK_CONDITIONAL:
       case PNK_DOT:
       case PNK_ELEM:
       case PNK_STATEMENTLIST:
       case PNK_LABEL:
       case PNK_CALL:
       case PNK_NAME:
       case PNK_TEMPLATE_STRING_LIST:
       case PNK_TAGGED_TEMPLATE:
       case PNK_CALLSITEOBJ:
       case PNK_FUNCTION:
-      case PNK_IF:
       case PNK_SWITCH:
-      case PNK_WHILE:
-      case PNK_DOWHILE:
       case PNK_FOR:
       case PNK_WITH:
       case PNK_RETURN:
       case PNK_NEW:
-      case PNK_TRY:
       case PNK_CATCH:
-      case PNK_CATCHLIST:
       case PNK_YIELD:
       case PNK_YIELD_STAR:
       case PNK_GENEXP:
       case PNK_ARRAYCOMP:
       case PNK_LEXICALSCOPE:
       case PNK_LET:
       case PNK_LETBLOCK:
       case PNK_LETEXPR: