Bug 1130811 - Remove pushUnlessNull in favor of making callers null-check. r=shu
authorJeff Walden <jwalden@mit.edu>
Thu, 12 Feb 2015 16:39:24 -0800
changeset 256883 52debad69c67cffd2dddf1a5b0d27663eeb521c3
parent 256882 8333a0bfa579b4523d2b9d12322f3d0ccb5b70e8
child 256884 d01c44107a30385c0ebbf649a0ee341d780ee421
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [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 - Remove pushUnlessNull in favor of making callers null-check. r=shu
js/src/frontend/ParseNode.cpp
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -74,17 +74,16 @@ namespace {
 class NodeStack {
   public:
     NodeStack() : top(nullptr) { }
     bool empty() { return top == nullptr; }
     void push(ParseNode *pn) {
         pn->pn_next = top;
         top = pn;
     }
-    void pushUnlessNull(ParseNode *pn) { if (pn) push(pn); }
     /* Push the children of the PN_LIST node |pn| on the stack. */
     void pushList(ParseNode *pn) {
         /* This clobbers pn->pn_head if the list is empty; should be okay. */
         *pn->pn_tail = top;
         top = pn->pn_head;
     }
     ParseNode *pop() {
         MOZ_ASSERT(!empty());
@@ -118,17 +117,18 @@ PushCodeNodeChildren(ParseNode *node, No
      * we clear its pn_funbox pointer to mark it as deleted;
      * CleanFunctionList recycles it as well.
      *
      * We do recycle the nodes around it, though, so we must clear pointers
      * to them to avoid leaving dangling references where someone can find
      * them.
      */
     node->pn_funbox = nullptr;
-    stack->pushUnlessNull(node->pn_body);
+    if (node->pn_body)
+        stack->push(node->pn_body);
     node->pn_body = nullptr;
 
     return PushResult::CleanUpLater;
 }
 
 static PushResult
 PushNameNodeChildren(ParseNode *node, NodeStack *stack)
 {
@@ -141,17 +141,18 @@ PushNameNodeChildren(ParseNode *node, No
      * clean up the pointers to avoid dangling references. The top-level
      * decls table carries references to them that later iterations through
      * the compileScript loop may find, so they need to be neat.
      *
      * pn_expr and pn_lexdef share storage; the latter isn't an owning
      * reference.
      */
     if (!node->isUsed()) {
-        stack->pushUnlessNull(node->pn_expr);
+        if (node->pn_expr)
+            stack->push(node->pn_expr);
         node->pn_expr = nullptr;
     }
 
     if (!node->isUsed() && !node->isDefn())
         return PushResult::Recyclable;
 
     return PushResult::CleanUpLater;
 }