Bug 745194 - [jsdbg2] Crash on Heap, trying to execute NULL, with Debugger forced return, methodjit, and GC. r=bhackett.

--HG--
extra : rebase_source : f5dbf256b10161f0859df94dcccec123415d7a4b
This commit is contained in:
Jason Orendorff 2012-12-14 13:48:46 -06:00
parent 3160635b11
commit f8fbc8b1c9
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// |jit-test| mjitalways
// Bug 745194.
var g = newGlobal('new-compartment');
var dbg = Debugger(g);
g.eval("function f() {}");
dbg.onEnterFrame = function (frame) {
if (frame.type == 'call') {
gc();
return { return: 'PASS' };
}
};
assertEq(g.eval("f()"), 'PASS');

View File

@ -0,0 +1,16 @@
// |jit-test| mjitalways
// Bug 745194.
var g = newGlobal('new-compartment');
g.eval("function f() {}" +
"function h() { return new f; }");
var dbg = Debugger(g);
dbg.onEnterFrame = function (frame) {
if (frame.constructing) {
gc();
return { return: 0 };
}
};
var result = g.eval("h()");
assertEq(typeof result, 'object');
assertEq(Object.getPrototypeOf(result), g.f.prototype);

View File

@ -668,12 +668,19 @@ stubs::ScriptDebugPrologue(VMFrame &f)
switch (status) {
case JSTRAP_CONTINUE:
break;
case JSTRAP_RETURN:
if (!f.fp()->nativeReturnAddress()) {
// ClearAllFrames was called. Resume in the interpreter.
f.fp()->setNativeReturnAddress(JS_FUNC_TO_DATA_PTR(void *, JaegerInterpolineScripted));
}
*f.returnAddressLocation() = f.cx->jaegerRuntime().forceReturnFromFastCall();
return;
case JSTRAP_ERROR:
case JSTRAP_THROW:
THROW();
default:
JS_NOT_REACHED("bad ScriptDebugPrologue status");
}