mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix constructors that return objects in catch blocks (bug 604381, r=dmandelin).
This commit is contained in:
parent
2e7f4be85c
commit
473a8118a1
14
js/src/jit-test/tests/jaeger/bug604381.js
Normal file
14
js/src/jit-test/tests/jaeger/bug604381.js
Normal file
@ -0,0 +1,14 @@
|
||||
// vim: set ts=4 sw=4 tw=99 et:
|
||||
|
||||
function F() {
|
||||
var T = { };
|
||||
try {
|
||||
throw 12;
|
||||
} catch (e) {
|
||||
T.x = 5;
|
||||
return T;
|
||||
}
|
||||
}
|
||||
|
||||
assertEq((new F()).x, 5);
|
||||
|
@ -2177,8 +2177,12 @@ mjit::Compiler::fixPrimitiveReturn(Assembler *masm, FrameEntry *fe)
|
||||
bool ool = (masm != &this->masm);
|
||||
Address thisv(JSFrameReg, JSStackFrame::offsetOfThis(fun));
|
||||
|
||||
// Easy cases - no return value, or known primitive, so just return thisv.
|
||||
if (!fe || (fe->isTypeKnown() && fe->getKnownType() != JSVAL_TYPE_OBJECT)) {
|
||||
// We can just load |thisv| if either of the following is true:
|
||||
// (1) There is no explicit return value, AND fp->rval is not used.
|
||||
// (2) There is an explicit return value, and it's known to be primitive.
|
||||
if ((!fe && !analysis->usesReturnValue()) ||
|
||||
(fe && fe->isTypeKnown() && fe->getKnownType() != JSVAL_TYPE_OBJECT))
|
||||
{
|
||||
if (ool)
|
||||
masm->loadValueAsComponents(thisv, JSReturnReg_Type, JSReturnReg_Data);
|
||||
else
|
||||
@ -2187,7 +2191,7 @@ mjit::Compiler::fixPrimitiveReturn(Assembler *masm, FrameEntry *fe)
|
||||
}
|
||||
|
||||
// If the type is known to be an object, just load the return value as normal.
|
||||
if (fe->isTypeKnown() && fe->getKnownType() == JSVAL_TYPE_OBJECT) {
|
||||
if (fe && fe->isTypeKnown() && fe->getKnownType() == JSVAL_TYPE_OBJECT) {
|
||||
loadReturnValue(masm, fe);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user