Bug 1282518 - Propagate return values from RematerializedFrames to BaselineFrames. r=shu

This commit is contained in:
Jim Blandy 2016-07-22 14:19:48 -07:00
parent 8baceda97e
commit 002186dad9
4 changed files with 51 additions and 2 deletions

View File

@ -0,0 +1,39 @@
// |jit-test| error: InternalError; --baseline-eager; --ion-eager
// Make sure that return values we store in RematerializedFrames via resumption
// values get propagated to the BaselineFrames we build from them.
//
// Test case from bug 1285939; there's another in bug 1282518, but this one
// takes less time to run, when it doesn't crash.
var lfLogBuffer = `
function testResumptionVal(resumptionVal, turnOffDebugMode) {
var g = newGlobal();
var dbg = new Debugger;
setInterruptCallback(function () {
dbg.addDebuggee(g);
var frame = dbg.getNewestFrame();
frame.onStep = function () {
frame.onStep = undefined;
return resumptionVal;
};
return true;
});
try {
return g.eval("(" + function f() {
invokeInterruptCallback(function (interruptRv) {
f({ valueOf: function () { dbg.g(dbg); }});
});
} + ")();");
} finally { }
}
assertEq(testResumptionVal({ return: "not 42" }), "not 42");
`;
loadFile(lfLogBuffer);
function loadFile(lfVarx) {
try {
let m = parseModule(lfVarx);
m.declarationInstantiation();
m.evaluation();
} catch (lfVare) {}
}

View File

@ -1720,6 +1720,8 @@ CopyFromRematerializedFrame(JSContext* cx, JitActivation* act, uint8_t* fp, size
for (size_t i = 0; i < frame->script()->nfixed(); i++)
*frame->valueSlot(i) = rematFrame->locals()[i];
frame->setReturnValue(rematFrame->returnValue());
if (rematFrame->hasCachedSavedFrame())
frame->setHasCachedSavedFrame();

View File

@ -219,7 +219,11 @@ class RematerializedFrame
return UndefinedValue();
}
Value returnValue() const {
void setReturnValue(const Value& value) {
returnValue_ = value;
}
Value& returnValue() {
return returnValue_;
}

View File

@ -437,7 +437,11 @@ AbstractFramePtr::setReturnValue(const Value& rval) const
asInterpreterFrame()->setReturnValue(rval);
return;
}
asBaselineFrame()->setReturnValue(rval);
if (isBaselineFrame()) {
asBaselineFrame()->setReturnValue(rval);
return;
}
asRematerializedFrame()->setReturnValue(rval);
}
inline JSObject*