mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 620838: propagate aliases-globals flag to inner lexical scopes, r=jwalden
This commit is contained in:
parent
5b174f775e
commit
7325cf5f95
22
js/src/jit-test/tests/basic/bug620838.js
Normal file
22
js/src/jit-test/tests/basic/bug620838.js
Normal file
@ -0,0 +1,22 @@
|
||||
function g() {
|
||||
return "global";
|
||||
}
|
||||
|
||||
function q(fun) {
|
||||
return fun();
|
||||
}
|
||||
|
||||
function f(x) {
|
||||
if (x) {
|
||||
function g() {
|
||||
return "local";
|
||||
}
|
||||
var ans = q(function() {
|
||||
return g();
|
||||
});
|
||||
}
|
||||
g = null;
|
||||
return ans;
|
||||
}
|
||||
|
||||
assertEq(f(true), "local");
|
@ -4626,7 +4626,8 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
if (!cg2->init())
|
||||
return JS_FALSE;
|
||||
|
||||
cg2->flags = pn->pn_funbox->tcflags | TCF_COMPILING | TCF_IN_FUNCTION;
|
||||
cg2->flags = pn->pn_funbox->tcflags | TCF_COMPILING | TCF_IN_FUNCTION |
|
||||
(cg->flags & TCF_FUN_MIGHT_ALIAS_LOCALS);
|
||||
#if JS_HAS_SHARP_VARS
|
||||
if (cg2->flags & TCF_HAS_SHARPS) {
|
||||
cg2->sharpSlotBase = fun->sharpSlotBase(cx);
|
||||
|
@ -252,10 +252,8 @@ struct JSStmtInfo {
|
||||
#define TCF_COMPILE_FOR_EVAL 0x2000000
|
||||
|
||||
/*
|
||||
* The function has broken or incorrect def-use information, and it cannot
|
||||
* safely optimize free variables to global names. This can happen because
|
||||
* of a named function statement not at the top level (emitting a DEFFUN),
|
||||
* or a variable declaration inside a "with".
|
||||
* The function or a function that encloses it may define new local names
|
||||
* at runtime through means other than calling eval.
|
||||
*/
|
||||
#define TCF_FUN_MIGHT_ALIAS_LOCALS 0x4000000
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user