mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1213574 - Fix up static scopes inside scripts wrt the static global lexical scope when merging parse task compartments. (r=jandem)
This commit is contained in:
parent
b26c1f0454
commit
38300c53dc
15
js/src/jit-test/tests/bug1213574.js
Normal file
15
js/src/jit-test/tests/bug1213574.js
Normal file
@ -0,0 +1,15 @@
|
||||
if (helperThreadCount() === 0)
|
||||
quit(0);
|
||||
|
||||
var lfGlobal = newGlobal();
|
||||
lfGlobal.offThreadCompileScript(`let (x) { throw 42; }`);
|
||||
try {
|
||||
lfGlobal.runOffThreadScript();
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
lfGlobal.offThreadCompileScript(`function f() { { let x = 42; return x; } }`);
|
||||
try {
|
||||
lfGlobal.runOffThreadScript();
|
||||
} catch (e) {
|
||||
}
|
@ -6740,6 +6740,11 @@ gc::MergeCompartments(JSCompartment* source, JSCompartment* target)
|
||||
// Fixup compartment pointers in source to refer to target, and make sure
|
||||
// type information generations are in sync.
|
||||
|
||||
// Get the static global lexical scope of the target compartment. Static
|
||||
// scopes need to be fixed up below.
|
||||
RootedObject targetStaticGlobalLexicalScope(rt);
|
||||
targetStaticGlobalLexicalScope = &target->maybeGlobal()->lexicalScope().staticBlock();
|
||||
|
||||
for (ZoneCellIter iter(source->zone(), AllocKind::SCRIPT); !iter.done(); iter.next()) {
|
||||
JSScript* script = iter.get<JSScript>();
|
||||
MOZ_ASSERT(script->compartment() == source);
|
||||
@ -6753,6 +6758,20 @@ gc::MergeCompartments(JSCompartment* source, JSCompartment* target)
|
||||
if (IsStaticGlobalLexicalScope(enclosing))
|
||||
script->fixEnclosingStaticGlobalLexicalScope();
|
||||
}
|
||||
|
||||
if (script->hasBlockScopes()) {
|
||||
BlockScopeArray* scopes = script->blockScopes();
|
||||
for (uint32_t i = 0; i < scopes->length; i++) {
|
||||
uint32_t scopeIndex = scopes->vector[i].index;
|
||||
if (scopeIndex != BlockScopeNote::NoBlockScopeIndex) {
|
||||
ScopeObject* scope = &script->getObject(scopeIndex)->as<ScopeObject>();
|
||||
MOZ_ASSERT(!IsStaticGlobalLexicalScope(scope));
|
||||
JSObject* enclosing = &scope->enclosingScope();
|
||||
if (IsStaticGlobalLexicalScope(enclosing))
|
||||
scope->setEnclosingScope(targetStaticGlobalLexicalScope);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ZoneCellIter iter(source->zone(), AllocKind::BASE_SHAPE); !iter.done(); iter.next()) {
|
||||
|
Loading…
Reference in New Issue
Block a user