mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 22:38:41 +09:00
1344477 - Part 1: Add JSOP_CALL_IGNORES_RV for function call that ignores return value.
This commit is contained in:
parent
43c3ab5a0e
commit
417aa02122
22 changed files with 243 additions and 92 deletions
|
|
@ -3688,7 +3688,13 @@ CodeGenerator::visitCallNative(LCallNative* call)
|
|||
masm.passABIArg(argContextReg);
|
||||
masm.passABIArg(argUintNReg);
|
||||
masm.passABIArg(argVpReg);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, target->native()));
|
||||
JSNative native = target->native();
|
||||
if (call->ignoresReturnValue()) {
|
||||
const JSJitInfo* jitInfo = target->jitInfo();
|
||||
if (jitInfo && jitInfo->type() == JSJitInfo::IgnoresReturnValueNative)
|
||||
native = jitInfo->ignoresReturnValueMethod;
|
||||
}
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, native));
|
||||
|
||||
emitTracelogStopEvent(TraceLogger_Call);
|
||||
|
||||
|
|
@ -3845,13 +3851,15 @@ CodeGenerator::visitCallGetIntrinsicValue(LCallGetIntrinsicValue* lir)
|
|||
callVM(GetIntrinsicValueInfo, lir);
|
||||
}
|
||||
|
||||
typedef bool (*InvokeFunctionFn)(JSContext*, HandleObject, bool, uint32_t, Value*, MutableHandleValue);
|
||||
typedef bool (*InvokeFunctionFn)(JSContext*, HandleObject, bool, bool, uint32_t, Value*,
|
||||
MutableHandleValue);
|
||||
static const VMFunction InvokeFunctionInfo =
|
||||
FunctionInfo<InvokeFunctionFn>(InvokeFunction, "InvokeFunction");
|
||||
|
||||
void
|
||||
CodeGenerator::emitCallInvokeFunction(LInstruction* call, Register calleereg,
|
||||
bool constructing, uint32_t argc, uint32_t unusedStack)
|
||||
bool constructing, bool ignoresReturnValue,
|
||||
uint32_t argc, uint32_t unusedStack)
|
||||
{
|
||||
// Nestle %esp up to the argument vector.
|
||||
// Each path must account for framePushed_ separately, for callVM to be valid.
|
||||
|
|
@ -3859,6 +3867,7 @@ CodeGenerator::emitCallInvokeFunction(LInstruction* call, Register calleereg,
|
|||
|
||||
pushArg(masm.getStackPointer()); // argv.
|
||||
pushArg(Imm32(argc)); // argc.
|
||||
pushArg(Imm32(ignoresReturnValue));
|
||||
pushArg(Imm32(constructing)); // constructing.
|
||||
pushArg(calleereg); // JSFunction*.
|
||||
|
||||
|
|
@ -3945,8 +3954,8 @@ CodeGenerator::visitCallGeneric(LCallGeneric* call)
|
|||
|
||||
// Handle uncompiled or native functions.
|
||||
masm.bind(&invoke);
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->numActualArgs(),
|
||||
unusedStack);
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->ignoresReturnValue(),
|
||||
call->numActualArgs(), unusedStack);
|
||||
|
||||
masm.bind(&end);
|
||||
|
||||
|
|
@ -4001,7 +4010,8 @@ CodeGenerator::visitCallKnown(LCallKnown* call)
|
|||
masm.checkStackAlignment();
|
||||
|
||||
if (target->isClassConstructor() && !call->isConstructing()) {
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->numActualArgs(), unusedStack);
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->ignoresReturnValue(),
|
||||
call->numActualArgs(), unusedStack);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4045,7 +4055,8 @@ CodeGenerator::visitCallKnown(LCallKnown* call)
|
|||
if (call->isConstructing() && target->nargs() > call->numActualArgs())
|
||||
emitCallInvokeFunctionShuffleNewTarget(call, calleereg, target->nargs(), unusedStack);
|
||||
else
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->numActualArgs(), unusedStack);
|
||||
emitCallInvokeFunction(call, calleereg, call->isConstructing(), call->ignoresReturnValue(),
|
||||
call->numActualArgs(), unusedStack);
|
||||
|
||||
masm.bind(&end);
|
||||
|
||||
|
|
@ -4072,6 +4083,7 @@ CodeGenerator::emitCallInvokeFunction(T* apply, Register extraStackSize)
|
|||
|
||||
pushArg(objreg); // argv.
|
||||
pushArg(ToRegister(apply->getArgc())); // argc.
|
||||
pushArg(Imm32(false)); // ignoresReturnValue.
|
||||
pushArg(Imm32(false)); // isConstrucing.
|
||||
pushArg(ToRegister(apply->getFunction())); // JSFunction*.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue