mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1185957 - Properly handle known derived class constructors in ion. (r=jandem)
This commit is contained in:
parent
8c3cdc697d
commit
995f19e9f9
15
js/src/jit-test/tests/ion/bug1185957.js
Normal file
15
js/src/jit-test/tests/ion/bug1185957.js
Normal file
@ -0,0 +1,15 @@
|
||||
// |jit-test| error: TypeError
|
||||
|
||||
load(libdir + "class.js");
|
||||
|
||||
var test = `
|
||||
class test {
|
||||
constructor() {};
|
||||
}
|
||||
(function() {
|
||||
test()
|
||||
})();
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
eval(test);
|
@ -3127,15 +3127,21 @@ CodeGenerator::visitCallKnown(LCallKnown* call)
|
||||
|
||||
// Native single targets are handled by LCallNative.
|
||||
MOZ_ASSERT(!target->isNative());
|
||||
MOZ_ASSERT_IF(target->isClassConstructor(), call->isConstructing());
|
||||
// Missing arguments must have been explicitly appended by the IonBuilder.
|
||||
DebugOnly<unsigned> numNonArgsOnStack = 1 + call->isConstructing();
|
||||
MOZ_ASSERT(target->nargs() <= call->mir()->numStackArgs() - numNonArgsOnStack);
|
||||
|
||||
MOZ_ASSERT_IF(call->mir()->isConstructing(), target->isConstructor());
|
||||
MOZ_ASSERT_IF(call->isConstructing(), target->isConstructor());
|
||||
|
||||
masm.checkStackAlignment();
|
||||
|
||||
if (target->isClassConstructor() && !call->isConstructing()) {
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->numActualArgs(), unusedStack);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT_IF(target->isClassConstructor(), call->isConstructing());
|
||||
|
||||
// The calleereg is known to be a non-native function, but might point to
|
||||
// a LazyScript instead of a JSScript.
|
||||
masm.branchIfFunctionHasNoScript(calleereg, &uncompiled);
|
||||
|
@ -456,9 +456,11 @@ LIRGenerator::visitCall(MCall* call)
|
||||
MOZ_ASSERT(ok, "How can we not have four temp registers?");
|
||||
lir = new(alloc()) LCallDOMNative(tempFixed(cxReg), tempFixed(objReg),
|
||||
tempFixed(privReg), tempFixed(argsReg));
|
||||
} else if (target && !(target->isClassConstructor() && !call->isConstructing())) {
|
||||
} else if (target) {
|
||||
// Call known functions.
|
||||
if (target->isNative()) {
|
||||
MOZ_ASSERT(!target->isClassConstructor());
|
||||
|
||||
Register cxReg, numReg, vpReg, tmpReg;
|
||||
GetTempRegForIntArg(0, 0, &cxReg);
|
||||
GetTempRegForIntArg(1, 0, &numReg);
|
||||
|
Loading…
Reference in New Issue
Block a user