Bug 881056 - Remove unused hasFunctionStmt parameter from some Parser methods. r=bhackett.
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 14 Jun 2013 16:30:40 -0500
changeset 146631 cbf52dea3df14b8231c2000c79784a3d12dc6427
parent 146630 ad385f54ee0156255e7bcafd1e034df8776761f9
child 146632 86155a5809da5b0ed7ce8ee4d8724a6dba7aed5b
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs881056
milestone24.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 881056 - Remove unused hasFunctionStmt parameter from some Parser methods. r=bhackett.
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -2481,65 +2481,54 @@ Parser<ParseHandler>::maybeParseDirectiv
             }
         }
     }
     return true;
 }
 
 template <>
 void
-Parser<FullParseHandler>::addStatementToList(ParseNode *pn, ParseNode *kid, bool *hasFunctionStmt)
+Parser<FullParseHandler>::addStatementToList(ParseNode *pn, ParseNode *kid)
 {
     JS_ASSERT(pn->isKind(PNK_STATEMENTLIST));
 
     if (kid->isKind(PNK_FUNCTION)) {
         /*
          * PNX_FUNCDEFS notifies the emitter that the block contains body-
          * level function definitions that should be processed before the
          * rest of nodes.
-         *
-         * |hasFunctionStmt| is for the TOK_LC case in Statement. It
-         * is relevant only for function definitions not at body-level,
-         * which we call function statements.
          */
         if (pc->atBodyLevel()) {
             pn->pn_xflags |= PNX_FUNCDEFS;
         } else {
-            /*
-             * General deoptimization was done in functionDef, here we just
-             * need to tell TOK_LC in Parser::statement to add braces.
-             */
+            /* General deoptimization was done in functionDef. */
             JS_ASSERT_IF(pc->sc->isFunctionBox(), pc->sc->asFunctionBox()->hasExtensibleScope());
-            if (hasFunctionStmt)
-                *hasFunctionStmt = true;
         }
     }
 
     pn->append(kid);
     pn->pn_pos.end = kid->pn_pos.end;
 }
 
 template <>
 void
-Parser<SyntaxParseHandler>::addStatementToList(Node pn, Node kid, bool *hasFunctionStmt)
+Parser<SyntaxParseHandler>::addStatementToList(Node pn, Node kid)
 {
 }
 
 /*
  * Parse the statements in a block, creating a TOK_LC node that lists the
  * statements' trees.  If called from block-parsing code, the caller must
  * match { before and } after.
  */
 template <typename ParseHandler>
 typename ParseHandler::Node
-Parser<ParseHandler>::statements(bool *hasFunctionStmt)
+Parser<ParseHandler>::statements()
 {
     JS_CHECK_RECURSION(context, return null());
-    if (hasFunctionStmt)
-        *hasFunctionStmt = false;
 
     Node pn = handler.newList(PNK_STATEMENTLIST);
     if (!pn)
         return null();
     handler.setBlockId(pn, pc->blockid());
 
     Node saveBlock = pc->blockNode;
     pc->blockNode = pn;
@@ -2562,17 +2551,17 @@ Parser<ParseHandler>::statements(bool *h
             return null();
         }
 
         if (canHaveDirectives) {
             if (!maybeParseDirective(next, &canHaveDirectives))
                 return null();
         }
 
-        addStatementToList(pn, next, hasFunctionStmt);
+        addStatementToList(pn, next);
     }
 
     /*
      * Handle the case where there was a let declaration under this block.  If
      * it replaced pc->blockNode with a new block node then we must refresh pn
      * and then restore pc->blockNode.
      */
     if (pc->blockNode != pn)
@@ -4789,18 +4778,18 @@ Parser<ParseHandler>::statement()
             return null();
         break;
 
       case TOK_LC:
       {
         StmtInfoPC stmtInfo(context);
         if (!PushBlocklikeStatement(&stmtInfo, STMT_BLOCK, pc))
             return null();
-        bool hasFunctionStmt;
-        pn = statements(&hasFunctionStmt);
+
+        pn = statements();
         if (!pn)
             return null();
 
         MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_IN_COMPOUND);
         PopStatementPC(context, pc);
         return pn;
       }
 
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -416,17 +416,17 @@ struct Parser : private AutoGCRooter, pu
      * unnecessary ungetting and regetting of tokens.
      *
      * Some parsers have two versions:  an always-inlined version (with an 'i'
      * suffix) and a never-inlined version (with an 'n' suffix).
      */
     Node moduleDecl();
     Node functionStmt();
     Node functionExpr();
-    Node statements(bool *hasFunctionStmt = NULL);
+    Node statements();
 
     Node switchStatement();
     Node forStatement();
     Node labeledStatement();
     Node tryStatement();
     Node withStatement();
 #if JS_HAS_BLOCK_SCOPE
     Node letStatement();
@@ -478,17 +478,17 @@ struct Parser : private AutoGCRooter, pu
 #else
         return versionNumber() >= JSVERSION_1_6;
 #endif
     }
 
     bool setAssignmentLhsOps(Node pn, JSOp op);
     bool matchInOrOf(bool *isForOfp);
 
-    void addStatementToList(Node pn, Node kid, bool *hasFunctionStmt);
+    void addStatementToList(Node pn, Node kid);
     bool checkFunctionArguments();
     bool makeDefIntoUse(Definition *dn, Node pn, JSAtom *atom);
     bool checkFunctionDefinition(HandlePropertyName funName, Node *pn, FunctionSyntaxKind kind,
                                  bool *pbodyProcessed);
     bool finishFunctionDefinition(Node pn, FunctionBox *funbox, Node prelude, Node body);
     bool addFreeVariablesFromLazyFunction(JSFunction *fun, ParseContext<ParseHandler> *pc);
 
     bool isValidForStatementLHS(Node pn1, JSVersion version,