Bug 1149510 - Don't try to read the result object when doing in-place debug mode bailout in a for-of loop. (r=jandem)

This commit is contained in:
Shu-yu Guo 2015-04-03 14:18:05 -07:00
parent b485a53afc
commit cff53ed7c9
2 changed files with 28 additions and 5 deletions

View File

@ -0,0 +1,25 @@
// Test that Ion->Baseline in-place debug mode bailout can recover the iterator
// from the snapshot in a for-of loop.
g = newGlobal();
g.parent = this;
g.eval("Debugger(parent).onExceptionUnwind=(function() {})");
function throwInNext() {
yield 1;
yield 2;
yield 3;
throw 42;
}
function f() {
for (var o of new throwInNext);
}
var log = "";
try {
f();
} catch (e) {
log += e;
}
assertEq(log, "42");

View File

@ -487,12 +487,10 @@ HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDept
if (tn->kind == JSTRY_FOR_IN && stackDepth == tn->stackDepth)
return true;
// For-of loops have both the iterator and the result on stack.
if (tn->kind == JSTRY_FOR_OF &&
(stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1))
{
// For-of loops have both the iterator and the result object on
// stack. The iterator is below the result object.
if (tn->kind == JSTRY_FOR_OF && stackDepth == tn->stackDepth - 1)
return true;
}
}
return false;