Bug 784608 (part 2) - Remove FunctionBox::level. r=jimb.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 22 Aug 2012 17:25:53 -0700
changeset 105538 fdc5717ca867d86c5bcd32a897a33f5a342ee867
parent 105537 49c35b696124cf5fed13aebd79492dd02127d61b
child 105539 52cf0f9db2f9fcbcafe5789aff9947f9b9b864f0
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersjimb
bugs784608
milestone17.0a1
Bug 784608 (part 2) - Remove FunctionBox::level. r=jimb.
js/src/frontend/Parser.cpp
js/src/frontend/SharedContext.h
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -392,17 +392,16 @@ FunctionBox::FunctionBox(ObjectBox* trac
   : ObjectBox(traceListHead, obj),
     node(fn),
     siblings(pc->functionList),
     kids(NULL),
     parent(pc->sc->inFunction() ? pc->sc->funbox() : NULL),
     bindings(),
     bufStart(0),
     bufEnd(0),
-    level(pc->staticLevel),
     ndefaults(0),
     strictModeState(sms),
     inWith(!!pc->innermostWith),
     inGenexpLambda(false),
     cxFlags(pc->sc->context)     // the cxFlags are set in LeaveFunction
 {
     isFunctionBox = true;
     if (!pc->sc->inFunction()) {
@@ -4897,38 +4896,31 @@ CompExprTransplanter::transplant(ParseNo
             return false;
         break;
 
       case PN_FUNC:
       {
         /*
          * Only the first level of transplant recursion through functions needs
          * to reparent the funbox, since all descendant functions are correctly
-         * linked under the top-most funbox. But every visit to this case needs
-         * to update funbox->level.
-         *
-         * Recall that funbox->level is the static level of the code containing
-         * the definition or expression of the function and not the static level
-         * of the function's body.
+         * linked under the top-most funbox.
          */
         FunctionBox *funbox = pn->pn_funbox;
 
-        funbox->level = pc->staticLevel + funcLevel;
         if (++funcLevel == 1 && genexp) {
             FunctionBox *parent = pc->sc->funbox();
 
             FunctionBox **funboxp = &pc->parent->functionList;
             while (*funboxp != funbox)
                 funboxp = &(*funboxp)->siblings;
             *funboxp = funbox->siblings;
 
             funbox->parent = parent;
             funbox->siblings = parent->kids;
             parent->kids = funbox;
-            funbox->level = pc->staticLevel;
         }
         /* FALL THROUGH */
       }
 
       case PN_NAME:
         if (!transplant(pn->maybeExpr()))
             return false;
         if (pn->isArity(PN_FUNC))
--- a/js/src/frontend/SharedContext.h
+++ b/js/src/frontend/SharedContext.h
@@ -293,17 +293,16 @@ struct FunctionBox : public ObjectBox
 {
     ParseNode       *node;
     FunctionBox     *siblings;
     FunctionBox     *kids;
     FunctionBox     *parent;
     Bindings        bindings;               /* bindings for this function */
     size_t          bufStart;
     size_t          bufEnd;
-    uint16_t        level;
     uint16_t        ndefaults;
     StrictMode::StrictModeState strictModeState;
     bool            inWith:1;               /* some enclosing scope is a with-statement
                                                or E4X filter-expression */
     bool            inGenexpLambda:1;       /* lambda from generator expression */
 
     ContextFlags    cxFlags;