Bug 753657 (part 1): remove TCF_FUN_FLAGS from TreeContextFlags. r=luke.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 14 May 2012 23:16:24 -0700
changeset 94151 d5a02a324330fe44c39c32e2b32221685c32eb5a
parent 94150 ccb2effe31c05a921296c6c8729dbb54a1bef1e3
child 94152 e1acc0dd12a8ff094fb06af7304f087242c73aca
push id9497
push usernnethercote@mozilla.com
push dateWed, 16 May 2012 23:38:07 +0000
treeherdermozilla-inbound@2cde430809e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs753657
milestone15.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 753657 (part 1): remove TCF_FUN_FLAGS from TreeContextFlags. r=luke.
js/src/frontend/Parser.cpp
js/src/frontend/TreeContext.h
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -600,17 +600,16 @@ ParseNode *
 Parser::functionBody(FunctionBodyType type)
 {
     JS_ASSERT(tc->sc->inFunction);
 
     StmtInfo stmtInfo(context);
     PushStatement(tc->sc, &stmtInfo, STMT_BLOCK, -1);
     stmtInfo.flags = SIF_BODY_BLOCK;
 
-    unsigned oldflags = tc->sc->flags;
     JS_ASSERT(!tc->hasReturnExpr && !tc->hasReturnVoid);
 
     ParseNode *pn;
     if (type == StatementListBody) {
         pn = statements();
     } else {
         JS_ASSERT(type == ExpressionBody);
         JS_ASSERT(JS_HAS_EXPR_CLOSURES);
@@ -732,17 +731,16 @@ Parser::functionBody(FunctionBodyType ty
                 if (dn->kind() == Definition::ARG && dn->isAssigned()) {
                     tc->sc->noteDefinitelyNeedsArgsObj();
                     break;
                 }
              }
         }
     }
 
-    tc->sc->flags = oldflags | (tc->sc->flags & TCF_FUN_FLAGS);
     return pn;
 }
 
 // Create a placeholder Definition node for |atom|.
 // Nb: unlike most functions that are passed a Parser, this one gets a
 // SharedContext passed in separately, because in this case |sc| may not equal
 // |parser->tc->sc|.
 static Definition *
@@ -1135,17 +1133,17 @@ static bool
 LeaveFunction(ParseNode *fn, Parser *parser, PropertyName *funName = NULL,
               FunctionSyntaxKind kind = Expression)
 {
     TreeContext *funtc = parser->tc;
     TreeContext *tc = funtc->parent;
     tc->sc->blockidGen = funtc->sc->blockidGen;
 
     FunctionBox *funbox = fn->pn_funbox;
-    funbox->tcflags |= funtc->sc->flags & TCF_FUN_FLAGS;
+    funbox->tcflags |= funtc->sc->flags;
 
     fn->pn_dflags |= PND_INITIALIZED;
     if (!tc->sc->topStmt || tc->sc->topStmt->type == STMT_BLOCK)
         fn->pn_dflags |= PND_BLOCKCHILD;
 
     /*
      * Propagate unresolved lexical names up to tc->lexdeps, and save a copy
      * of funtc->lexdeps in a TOK_UPVARS node wrapping the function's formal
@@ -4530,21 +4528,19 @@ Parser::condExpr1()
     if (!condition || !tokenStream.isCurrentTokenType(TOK_HOOK))
         return condition;
 
     /*
      * Always accept the 'in' operator in the middle clause of a ternary,
      * where it's unambiguous, even if we might be parsing the init of a
      * for statement.
      */
-    uint32_t oldflags = tc->sc->flags;
     bool oldInForInit = tc->sc->inForInit;
     tc->sc->inForInit = false;
     ParseNode *thenExpr = assignExpr();
-    tc->sc->flags = oldflags | (tc->sc->flags & TCF_FUN_FLAGS);
     tc->sc->inForInit = oldInForInit;
     if (!thenExpr)
         return NULL;
 
     MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_IN_COND);
 
     ParseNode *elseExpr = assignExpr();
     if (!elseExpr)
@@ -5464,17 +5460,17 @@ Parser::generatorExpr(ParseNode *kid)
             return NULL;
 
         /*
          * We assume conservatively that any deoptimization flag in tc->sc->flags
          * come from the kid. So we propagate these flags into genfn. For code
          * simplicity we also do not detect if the flags were only set in the
          * kid and could be removed from tc->sc->flags.
          */
-        gensc.flags |= TCF_FUN_IS_GENERATOR | (outertc->sc->flags & TCF_FUN_FLAGS);
+        gensc.flags |= TCF_FUN_IS_GENERATOR | outertc->sc->flags;
         funbox->tcflags |= gensc.flags;
         funbox->inGenexpLambda = true;
         genfn->pn_funbox = funbox;
         genfn->pn_blockid = gensc.bodyid;
 
         ParseNode *body = comprehensionTail(pn, outertc->sc->blockid(), true);
         if (!body)
             return NULL;
@@ -5804,21 +5800,19 @@ Parser::memberExpr(JSBool allowCallSynta
 ParseNode *
 Parser::bracketedExpr()
 {
     /*
      * Always accept the 'in' operator in a parenthesized expression,
      * where it's unambiguous, even if we might be parsing the init of a
      * for statement.
      */
-    uint32_t oldflags = tc->sc->flags;
     bool oldInForInit = tc->sc->inForInit;
     tc->sc->inForInit = false;
     ParseNode *pn = expr();
-    tc->sc->flags = oldflags | (tc->sc->flags & TCF_FUN_FLAGS);
     tc->sc->inForInit = oldInForInit;
     return pn;
 }
 
 #if JS_HAS_XML_SUPPORT
 
 ParseNode *
 Parser::endBracketedExpr()
--- a/js/src/frontend/TreeContext.h
+++ b/js/src/frontend/TreeContext.h
@@ -137,27 +137,16 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_
     // dataflow analysis only looks at how JSOP_ARGUMENTS is used, so it will
     // be unsound in several cases. The frontend filters out such cases by
     // setting this flag which eagerly sets script->needsArgsObj to true.
     //
     TCF_DEFINITELY_NEEDS_ARGS_OBJ =           0x80
 
 } JS_ENUM_FOOTER(TreeContextFlags);
 
-// Sticky deoptimization flags to propagate from FunctionBody.
-static const uint32_t TCF_FUN_FLAGS = TCF_FUN_HEAVYWEIGHT |
-                                      TCF_FUN_IS_GENERATOR |
-                                      TCF_BINDINGS_ACCESSED_DYNAMICALLY |
-                                      TCF_FUN_MIGHT_ALIAS_LOCALS |
-                                      TCF_STRICT_MODE_CODE |
-                                      TCF_FUN_EXTENSIBLE_SCOPE |
-                                      TCF_ARGUMENTS_HAS_LOCAL_BINDING |
-                                      TCF_DEFINITELY_NEEDS_ARGS_OBJ;
-
-
 struct StmtInfo;
 
 struct SharedContext {
     JSContext       *context;
 
     uint32_t        flags;          /* statement state flags, see above */
     uint32_t        bodyid;         /* block number of program/function body */
     uint32_t        blockidGen;     /* preincremented block number generator */