mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1151326 - Don't inline yields in legacy generators in Baseline. r=shu
This commit is contained in:
parent
eefac7a6c1
commit
96c9b59939
16
js/src/jit-test/tests/generators/bug1151326.js
Normal file
16
js/src/jit-test/tests/generators/bug1151326.js
Normal file
@ -0,0 +1,16 @@
|
||||
// |jit-test| error: closing generator
|
||||
var finally3;
|
||||
function gen() {
|
||||
try {
|
||||
try {
|
||||
yield 1;
|
||||
} finally {
|
||||
finally3();
|
||||
}
|
||||
} catch (e) {
|
||||
yield finally3 === parseInt;
|
||||
}
|
||||
}
|
||||
iter = gen();
|
||||
iter.next();
|
||||
iter.close();
|
@ -3485,23 +3485,11 @@ BaselineCompiler::emit_JSOP_YIELD()
|
||||
|
||||
MOZ_ASSERT(frame.stackDepth() >= 1);
|
||||
|
||||
if (frame.stackDepth() == 1) {
|
||||
// If the expression stack is empty, we can inline the YIELD. For legacy
|
||||
// generators we normally check if we're in the closing state and throw
|
||||
// an exception, but we don't have to do anything here as the expression
|
||||
// stack is never empty in finally blocks. In debug builds, we assert
|
||||
// we're not in the closing state.
|
||||
#ifdef DEBUG
|
||||
if (script->isLegacyGenerator()) {
|
||||
Label ok;
|
||||
masm.unboxInt32(Address(genObj, GeneratorObject::offsetOfYieldIndexSlot()),
|
||||
R0.scratchReg());
|
||||
masm.branch32(Assembler::NotEqual, R0.scratchReg(),
|
||||
Imm32(GeneratorObject::YIELD_INDEX_CLOSING), &ok);
|
||||
masm.assumeUnreachable("Inline yield with closing generator");
|
||||
masm.bind(&ok);
|
||||
}
|
||||
#endif
|
||||
if (frame.stackDepth() == 1 && !script->isLegacyGenerator()) {
|
||||
// If the expression stack is empty, we can inline the YIELD. Don't do
|
||||
// this for legacy generators: we have to throw an exception if the
|
||||
// generator is in the closing state, see GeneratorObject::suspend.
|
||||
|
||||
masm.storeValue(Int32Value(GET_UINT24(pc)),
|
||||
Address(genObj, GeneratorObject::offsetOfYieldIndexSlot()));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user