Commit 8c4f98a4 authored by Nicholas Nethercote's avatar Nicholas Nethercote
Browse files

Bug 753249 (part 3) - Remove TCF_IN_WITH from TreeContextFlags. r=luke.

--HG--
extra : rebase_source : c88cc07d9a3868ec756daa1da0a0cbe875d3c144
parent 1c5be94e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1605,7 +1605,7 @@ BytecodeEmitter::needsImplicitThis()
        }
    }
    for (const FunctionBox *funbox = this->sc->funbox; funbox; funbox = funbox->parent) {
        if (funbox->tcflags & TCF_IN_WITH)
        if (funbox->inWith)
            return true;
    }
    for (StmtInfo *stmt = sc->topStmt; stmt; stmt = stmt->down) {
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ bool
FunctionBox::inAnyDynamicScope() const
{
    for (const FunctionBox *funbox = this; funbox; funbox = funbox->parent) {
        if (funbox->tcflags & (TCF_IN_WITH | TCF_FUN_EXTENSIBLE_SCOPE))
        if (funbox->inWith || (funbox->tcflags & TCF_FUN_EXTENSIBLE_SCOPE))
            return true;
    }
    return false;
+2 −0
Original line number Diff line number Diff line
@@ -1543,6 +1543,8 @@ struct FunctionBox : public ObjectBox
                        inLoop:1,               /* in a loop in parent function */
                        level:JSFB_LEVEL_BITS;
    uint32_t            tcflags;
    bool                inWith:1;               /* some enclosing scope is a with-statement
                                                   or E4X filter-expression */

    JSFunction *function() const { return (JSFunction *) object; }

+2 −3
Original line number Diff line number Diff line
@@ -237,13 +237,12 @@ Parser::newFunctionBox(JSObject *obj, ParseNode *fn, TreeContext *tc)
    }
    funbox->level = tc->sc->staticLevel;
    funbox->tcflags = tc->sc->flags & TCF_STRICT_MODE_CODE;
    if (tc->innermostWith)
        funbox->tcflags |= TCF_IN_WITH;
    funbox->inWith = !!tc->innermostWith;
    if (!tc->sc->inFunction) {
        JSObject *scope = tc->sc->scopeChain();
        while (scope) {
            if (scope->isWith())
                funbox->tcflags |= TCF_IN_WITH;
                funbox->inWith = true;
            scope = scope->enclosingScope();
        }
    }
+3 −6
Original line number Diff line number Diff line
@@ -103,9 +103,6 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
    // The script contains singleton initialiser JSOP_OBJECT.
    TCF_HAS_SINGLETONS =                      0x40,

    // Some enclosing scope is a with-statement or E4X filter-expression.
    TCF_IN_WITH =                             0x80,

    // This function does something that can extend the set of bindings in its
    // call objects --- it does a direct eval in non-strict code, or includes a
    // function statement (as opposed to a function definition).
@@ -113,7 +110,7 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
    // This flag is *not* inherited by enclosed or enclosing functions; it
    // applies only to the function in whose flags it appears.
    //
    TCF_FUN_EXTENSIBLE_SCOPE =               0x100,
    TCF_FUN_EXTENSIBLE_SCOPE =                0x80,

    // Technically, every function has a binding named 'arguments'. Internally,
    // this binding is only added when 'arguments' is mentioned by the function
@@ -136,7 +133,7 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
    // have no special semantics: the initial value is unconditionally the
    // actual argument (or undefined if nactual < nformal).
    //
    TCF_ARGUMENTS_HAS_LOCAL_BINDING =        0x200,
    TCF_ARGUMENTS_HAS_LOCAL_BINDING =        0x100,

    // In many cases where 'arguments' has a local binding (as described above)
    // we do not need to actually create an arguments object in the function
@@ -147,7 +144,7 @@ JS_ENUM_HEADER(TreeContextFlags, uint32_t)
    // 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 =          0x400
    TCF_DEFINITELY_NEEDS_ARGS_OBJ =          0x200

} JS_ENUM_FOOTER(TreeContextFlags);