mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-03 05:47:29 +09:00
Bug 1332881 - Handle stack value in correct order when leaving loop and try-finally
Issue #74
This commit is contained in:
parent
da23a493b7
commit
ad8ad6e109
2 changed files with 60 additions and 0 deletions
|
|
@ -2359,6 +2359,9 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
|
||||||
}
|
}
|
||||||
|
|
||||||
case StatementKind::ForOfLoop:
|
case StatementKind::ForOfLoop:
|
||||||
|
if (!flushPops(bce_))
|
||||||
|
return false;
|
||||||
|
|
||||||
// The iterator and the current value are on the stack.
|
// The iterator and the current value are on the stack.
|
||||||
//
|
//
|
||||||
if (emitIteratorClose) {
|
if (emitIteratorClose) {
|
||||||
|
|
@ -2378,6 +2381,9 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StatementKind::ForInLoop:
|
case StatementKind::ForInLoop:
|
||||||
|
if (!flushPops(bce_))
|
||||||
|
return false;
|
||||||
|
|
||||||
// The iterator and the current value are on the stack.
|
// The iterator and the current value are on the stack.
|
||||||
if (!bce_->emit1(JSOP_POP)) // ... ITER
|
if (!bce_->emit1(JSOP_POP)) // ... ITER
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
54
js/src/tests/ecma_6/Statements/for-inof-finally.js
Normal file
54
js/src/tests/ecma_6/Statements/for-inof-finally.js
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
var BUGNUMBER = 1332881;
|
||||||
|
var summary =
|
||||||
|
"Leaving for-in and try should handle stack value in correct order";
|
||||||
|
|
||||||
|
print(BUGNUMBER + ": " + summary);
|
||||||
|
|
||||||
|
var a = (function () {
|
||||||
|
for (var x in [0]) {
|
||||||
|
try {} finally {
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
assertEq(a, 11);
|
||||||
|
|
||||||
|
var b = (function () {
|
||||||
|
for (var x of [0]) {
|
||||||
|
try {} finally {
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
assertEq(b, 12);
|
||||||
|
|
||||||
|
var c = (function () {
|
||||||
|
for (var x in [0]) {
|
||||||
|
for (var y of [0]) {
|
||||||
|
try {} finally {
|
||||||
|
return 13;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
assertEq(c, 13);
|
||||||
|
|
||||||
|
var d = (function () {
|
||||||
|
for (var x in [0]) {
|
||||||
|
for (var y of [0]) {
|
||||||
|
try {} finally {
|
||||||
|
for (var z in [0]) {
|
||||||
|
for (var w of [0]) {
|
||||||
|
try {} finally {
|
||||||
|
return 14;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
assertEq(d, 14);
|
||||||
|
|
||||||
|
if (typeof reportCompare === "function")
|
||||||
|
reportCompare(true, true);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue