mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 0f0f444d57ad
This commit is contained in:
parent
fd993d7db3
commit
e2e1e9a8cc
@ -240,11 +240,6 @@ struct JSStmtInfo {
|
||||
*/
|
||||
#define TCF_FUN_ENTRAINS_SCOPES 0x400000
|
||||
|
||||
/*
|
||||
* Function uses eval.
|
||||
*/
|
||||
#define TCF_FUN_USES_EVAL 0x800000
|
||||
|
||||
/*
|
||||
* Flags to check for return; vs. return expr; in a function.
|
||||
*/
|
||||
@ -259,7 +254,6 @@ struct JSStmtInfo {
|
||||
TCF_FUN_HEAVYWEIGHT | \
|
||||
TCF_FUN_IS_GENERATOR | \
|
||||
TCF_FUN_USES_OWN_NAME | \
|
||||
TCF_FUN_USES_EVAL | \
|
||||
TCF_HAS_SHARPS | \
|
||||
TCF_STRICT_MODE_CODE)
|
||||
|
||||
@ -293,8 +287,6 @@ struct JSTreeContext { /* tree context for semantic checks */
|
||||
Compiler::compileFunctionBody */
|
||||
JSFunctionBox *functionList;
|
||||
|
||||
JSParseNode *innermostWith; /* innermost WITH parse node */
|
||||
|
||||
#ifdef JS_SCOPE_DEPTH_METER
|
||||
uint16 scopeDepth; /* current lexical scope chain depth */
|
||||
uint16 maxScopeDepth; /* maximum lexical scope chain depth */
|
||||
@ -304,7 +296,7 @@ struct JSTreeContext { /* tree context for semantic checks */
|
||||
: flags(0), ngvars(0), bodyid(0), blockidGen(0),
|
||||
topStmt(NULL), topScopeStmt(NULL), blockChain(NULL), blockNode(NULL),
|
||||
parser(prs), scopeChain(NULL), parent(prs->tc), staticLevel(0),
|
||||
funbox(NULL), functionList(NULL), innermostWith(NULL), sharpSlotBase(-1)
|
||||
funbox(NULL), functionList(NULL), sharpSlotBase(-1)
|
||||
{
|
||||
prs->tc = this;
|
||||
JS_SCOPE_DEPTH_METERING(scopeDepth = maxScopeDepth = 0);
|
||||
|
@ -2111,10 +2111,11 @@ FlagHeavyweights(JSDefinition *dn, JSFunctionBox *funbox, uint32& tcflags)
|
||||
tcflags |= TCF_FUN_HEAVYWEIGHT;
|
||||
}
|
||||
|
||||
static bool
|
||||
DeoptimizeUsesWithin(JSDefinition *dn, const TokenPos &pos)
|
||||
static void
|
||||
DeoptimizeUsesWithin(JSDefinition *dn, JSFunctionBox *funbox, uint32& tcflags)
|
||||
{
|
||||
uintN ndeoptimized = 0;
|
||||
const TokenPos &pos = funbox->node->pn_body->pn_pos;
|
||||
|
||||
for (JSParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
|
||||
JS_ASSERT(pnu->pn_used);
|
||||
@ -2125,7 +2126,8 @@ DeoptimizeUsesWithin(JSDefinition *dn, const TokenPos &pos)
|
||||
}
|
||||
}
|
||||
|
||||
return ndeoptimized != 0;
|
||||
if (ndeoptimized != 0)
|
||||
FlagHeavyweights(dn, funbox, tcflags);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2287,8 +2289,7 @@ Parser::setFunctionKinds(JSFunctionBox *funbox, uint32& tcflags)
|
||||
++nflattened;
|
||||
continue;
|
||||
}
|
||||
if (DeoptimizeUsesWithin(lexdep, funbox->node->pn_body->pn_pos))
|
||||
FlagHeavyweights(lexdep, funbox, tcflags);
|
||||
DeoptimizeUsesWithin(lexdep, funbox, tcflags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2462,17 +2463,6 @@ LeaveFunction(JSParseNode *fn, JSTreeContext *funtc, JSAtom *funAtom = NULL,
|
||||
}
|
||||
|
||||
JSAtomListElement *outer_ale = tc->decls.lookup(atom);
|
||||
|
||||
/*
|
||||
* Make sure to deoptimize lexical dependencies that are polluted
|
||||
* by eval or with, to safely statically bind globals (see bug 561923).
|
||||
*/
|
||||
if ((funtc->flags & TCF_FUN_USES_EVAL) ||
|
||||
(outer_ale && tc->innermostWith &&
|
||||
ALE_DEFN(outer_ale)->pn_pos < tc->innermostWith->pn_pos)) {
|
||||
DeoptimizeUsesWithin(dn, fn->pn_pos);
|
||||
}
|
||||
|
||||
if (!outer_ale)
|
||||
outer_ale = tc->lexdeps.lookup(atom);
|
||||
if (outer_ale) {
|
||||
@ -5314,7 +5304,6 @@ Parser::statement()
|
||||
break;
|
||||
|
||||
case TOK_WITH:
|
||||
{
|
||||
/*
|
||||
* In most cases, we want the constructs forbidden in strict mode
|
||||
* code to be a subset of those that JSOPTION_STRICT warns about, and
|
||||
@ -5338,9 +5327,6 @@ Parser::statement()
|
||||
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_WITH);
|
||||
pn->pn_left = pn2;
|
||||
|
||||
JSParseNode *oldWith = tc->innermostWith;
|
||||
tc->innermostWith = pn;
|
||||
|
||||
js_PushStatement(tc, &stmtInfo, STMT_WITH, -1);
|
||||
pn2 = statement();
|
||||
if (!pn2)
|
||||
@ -5350,20 +5336,7 @@ Parser::statement()
|
||||
pn->pn_pos.end = pn2->pn_pos.end;
|
||||
pn->pn_right = pn2;
|
||||
tc->flags |= TCF_FUN_HEAVYWEIGHT;
|
||||
tc->innermostWith = oldWith;
|
||||
|
||||
/*
|
||||
* Make sure to deoptimize lexical dependencies inside the |with|
|
||||
* to safely optimize binding globals (see bug 561923).
|
||||
*/
|
||||
JSAtomListIterator iter(&tc->lexdeps);
|
||||
while (JSAtomListElement *ale = iter()) {
|
||||
JSDefinition *lexdep = ALE_DEFN(ale)->resolve();
|
||||
DeoptimizeUsesWithin(lexdep, pn->pn_pos);
|
||||
}
|
||||
|
||||
return pn;
|
||||
}
|
||||
|
||||
case TOK_VAR:
|
||||
pn = variables(false);
|
||||
@ -7040,7 +7013,7 @@ Parser::memberExpr(JSBool allowCallSyntax)
|
||||
if (pn->pn_atom == context->runtime->atomState.evalAtom) {
|
||||
/* Select JSOP_EVAL and flag tc as heavyweight. */
|
||||
pn2->pn_op = JSOP_EVAL;
|
||||
tc->flags |= TCF_FUN_HEAVYWEIGHT | TCF_FUN_USES_EVAL;
|
||||
tc->flags |= TCF_FUN_HEAVYWEIGHT;
|
||||
}
|
||||
} else if (pn->pn_op == JSOP_GETPROP) {
|
||||
if (pn->pn_atom == context->runtime->atomState.applyAtom ||
|
||||
|
@ -1,9 +0,0 @@
|
||||
var test;
|
||||
{
|
||||
let (a = 5) {
|
||||
with ({a: 2}) {
|
||||
test = (function () { return a; })();
|
||||
}
|
||||
}
|
||||
}
|
||||
assertEq(test, 2);
|
@ -1,9 +0,0 @@
|
||||
var test;
|
||||
{
|
||||
with ({a: 2}) {
|
||||
let (a = 5) {
|
||||
test = (function () { return a; })();
|
||||
}
|
||||
}
|
||||
}
|
||||
assertEq(test, 5);
|
@ -1,8 +0,0 @@
|
||||
var test;
|
||||
{
|
||||
with ({a: 2}) {
|
||||
test = (function () { return a; })();
|
||||
}
|
||||
let a = 5;
|
||||
}
|
||||
assertEq(test, 2);
|
@ -1,10 +0,0 @@
|
||||
var test;
|
||||
function f() {
|
||||
let (a = 5) {
|
||||
with ({a: 2}) {
|
||||
test = (function () { return a;} )();
|
||||
}
|
||||
}
|
||||
}
|
||||
f();
|
||||
assertEq(test, 2);
|
@ -1,10 +0,0 @@
|
||||
var test;
|
||||
function f() {
|
||||
with ({a: 2}) {
|
||||
let (a = 5) {
|
||||
test = (function () { return a; })();
|
||||
}
|
||||
}
|
||||
}
|
||||
f();
|
||||
assertEq(test, 5);
|
Loading…
Reference in New Issue
Block a user