1344477 - Part 1: Add JSOP_CALL_IGNORES_RV for function call that ignores return value.

This commit is contained in:
Gaming4JC 2019-07-14 19:04:34 -04:00 • committed by Roy Tam
commit 417aa02122
22 changed files with 243 additions and 92 deletions

View file

@ -4043,14 +4043,18 @@ class MCall
uint32_t numActualArgs_;
// True if the call is for JSOP_NEW.
bool construct_;
bool construct_:1;
bool needsArgCheck_;
// True if the caller does not use the return value.
bool ignoresReturnValue_:1;
MCall(WrappedFunction* target, uint32_t numActualArgs, bool construct)
bool needsArgCheck_:1;
MCall(WrappedFunction* target, uint32_t numActualArgs, bool construct, bool ignoresReturnValue)
: target_(target),
numActualArgs_(numActualArgs),
construct_(construct),
ignoresReturnValue_(ignoresReturnValue),
needsArgCheck_(true)
{
setResultType(MIRType::Value);
@ -4059,7 +4063,7 @@ class MCall
public:
INSTRUCTION_HEADER(Call)
static MCall* New(TempAllocator& alloc, JSFunction* target, size_t maxArgc, size_t numActualArgs,
bool construct, bool isDOMCall);
bool construct, bool ignoresReturnValue, bool isDOMCall);
void initFunction(MDefinition* func) {
initOperand(FunctionOperandIndex, func);
@ -4104,6 +4108,10 @@ class MCall
return construct_;
}
bool ignoresReturnValue() const {
return ignoresReturnValue_;
}
// The number of stack arguments is the max between the number of formal
// arguments and the number of actual arguments. The number of stack
// argument includes the |undefined| padding added in case of underflow.
@ -4147,7 +4155,7 @@ class MCallDOMNative : public MCall
// virtual things from MCall.
protected:
MCallDOMNative(WrappedFunction* target, uint32_t numActualArgs)
: MCall(target, numActualArgs, false)
: MCall(target, numActualArgs, false, false)
{
MOZ_ASSERT(getJitInfo()->type() != JSJitInfo::InlinableNative);
@ -4162,7 +4170,8 @@ class MCallDOMNative : public MCall
}
friend MCall* MCall::New(TempAllocator& alloc, JSFunction* target, size_t maxArgc,
size_t numActualArgs, bool construct, bool isDOMCall);
size_t numActualArgs, bool construct, bool ignoresReturnValue,
bool isDOMCall);
const JSJitInfo* getJitInfo() const;
public: