mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784608 (part 7) - Change the form and meaning of ParseContext::innermostWith, and do follow-up simplifications. r=luke.
--HG-- extra : rebase_source : 035c8976f4767235c5f88f0440401c668c7676a8
This commit is contained in:
parent
230074bf69
commit
440f66cd8a
@ -1686,10 +1686,8 @@ BytecodeEmitter::needsImplicitThis()
|
||||
return true;
|
||||
|
||||
if (sc->inFunction()) {
|
||||
for (const FunctionBox *funbox = this->sc->funbox(); funbox; funbox = funbox->parent) {
|
||||
if (funbox->inWith)
|
||||
return true;
|
||||
}
|
||||
if (sc->funbox()->inWith)
|
||||
return true;
|
||||
} else {
|
||||
JSObject *scope = sc->scopeChain();
|
||||
while (scope) {
|
||||
|
@ -46,11 +46,11 @@ ParseContext::ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel,
|
||||
parserPC(&prs->pc),
|
||||
lexdeps(prs->context),
|
||||
parent(prs->pc),
|
||||
innermostWith(NULL),
|
||||
funcStmts(NULL),
|
||||
funHasReturnExpr(false),
|
||||
funHasReturnVoid(false),
|
||||
parsingForInit(false),
|
||||
parsingWith(prs->pc ? prs->pc->parsingWith : false), // inherit from parent context
|
||||
inDeclDestructuring(false)
|
||||
{
|
||||
prs->pc = this;
|
||||
|
@ -398,7 +398,7 @@ FunctionBox::FunctionBox(ObjectBox* traceListHead, JSObject *obj, ParseContext *
|
||||
bufEnd(0),
|
||||
ndefaults(0),
|
||||
strictModeState(sms),
|
||||
inWith(!!outerpc->innermostWith),
|
||||
inWith(outerpc->parsingWith),
|
||||
inGenexpLambda(false),
|
||||
cxFlags(outerpc->sc->context) // the cxFlags are set in LeaveFunction
|
||||
{
|
||||
@ -1151,7 +1151,7 @@ LeaveFunction(ParseNode *fn, Parser *parser, PropertyName *funName = NULL,
|
||||
* by eval and function statements (which both flag the function as
|
||||
* having an extensible scope) or any enclosing 'with'.
|
||||
*/
|
||||
if (funpc->sc->funHasExtensibleScope() || pc->innermostWith)
|
||||
if (funpc->sc->funHasExtensibleScope() || pc->parsingWith)
|
||||
DeoptimizeUsesWithin(dn, fn->pn_pos);
|
||||
|
||||
if (!outer_dn) {
|
||||
@ -3482,8 +3482,8 @@ Parser::withStatement()
|
||||
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_WITH);
|
||||
pn->pn_left = pn2;
|
||||
|
||||
ParseNode *oldWith = pc->innermostWith;
|
||||
pc->innermostWith = pn;
|
||||
bool oldParsingWith = pc->parsingWith;
|
||||
pc->parsingWith = true;
|
||||
|
||||
StmtInfoPC stmtInfo(context);
|
||||
PushStatementPC(pc, &stmtInfo, STMT_WITH);
|
||||
@ -3496,7 +3496,7 @@ Parser::withStatement()
|
||||
pn->pn_right = pn2;
|
||||
|
||||
pc->sc->setBindingsAccessedDynamically();
|
||||
pc->innermostWith = oldWith;
|
||||
pc->parsingWith = oldParsingWith;
|
||||
|
||||
/*
|
||||
* Make sure to deoptimize lexical dependencies inside the |with|
|
||||
@ -5523,8 +5523,8 @@ Parser::memberExpr(bool allowCallSyntax)
|
||||
pc->sc->setBindingsAccessedDynamically();
|
||||
|
||||
StmtInfoPC stmtInfo(context);
|
||||
ParseNode *oldWith = pc->innermostWith;
|
||||
pc->innermostWith = lhs;
|
||||
bool oldParsingWith = pc->parsingWith;
|
||||
pc->parsingWith = true;
|
||||
PushStatementPC(pc, &stmtInfo, STMT_WITH);
|
||||
|
||||
ParseNode *filter = bracketedExpr();
|
||||
@ -5533,7 +5533,7 @@ Parser::memberExpr(bool allowCallSyntax)
|
||||
filter->setInParens(true);
|
||||
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_IN_PAREN);
|
||||
|
||||
pc->innermostWith = oldWith;
|
||||
pc->parsingWith = oldParsingWith;
|
||||
PopStatementPC(context, pc);
|
||||
|
||||
nextMember =
|
||||
|
@ -174,8 +174,6 @@ struct ParseContext /* tree context for semantic checks */
|
||||
|
||||
ParseContext *parent; /* Enclosing function or global context. */
|
||||
|
||||
ParseNode *innermostWith; /* innermost WITH parse node */
|
||||
|
||||
FuncStmtSet *funcStmts; /* Set of (non-top-level) function statements
|
||||
that will alias any top-level bindings with
|
||||
the same name. */
|
||||
@ -189,6 +187,9 @@ struct ParseContext /* tree context for semantic checks */
|
||||
// source code, and cleared when that region is exited.
|
||||
bool parsingForInit:1; /* true while parsing init expr of for;
|
||||
exclude 'in' */
|
||||
bool parsingWith:1; /* true while we are within a
|
||||
with-statement or E4X filter-expression
|
||||
in the current ParseContext chain */
|
||||
|
||||
// Set when parsing a declaration-like destructuring pattern. This flag
|
||||
// causes PrimaryExpr to create PN_NAME parse nodes for variable references
|
||||
|
Loading…
Reference in New Issue
Block a user