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

--HG--
extra : rebase_source : c88cc07d9a3868ec756daa1da0a0cbe875d3c144
This commit is contained in:
Nicholas Nethercote 2012-05-14 21:38:37 -07:00
Родитель 1c5be94e4d
Коммит 8c4f98a44a
5 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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; }

Просмотреть файл

@ -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();
}
}

Просмотреть файл

@ -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);