Skip to content

Commit

Permalink
Bug 1640211 - Rename function to callee in MCall. r=iain
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed May 22, 2020
1 parent f6bf58a commit 1895e30
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion js/src/jit/IonBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6268,7 +6268,7 @@ AbortReasonOr<MCall*> IonBuilder::makeCallHelper(
}
}

call->initFunction(callInfo.callee());
call->initCallee(callInfo.callee());

current->add(call);
return call;
Expand Down
6 changes: 3 additions & 3 deletions js/src/jit/Lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ bool LIRGenerator::lowerCallArguments(MCall* call) {
}

void LIRGenerator::visitCall(MCall* call) {
MOZ_ASSERT(call->getFunction()->type() == MIRType::Object);
MOZ_ASSERT(call->getCallee()->type() == MIRType::Object);

// In case of oom, skip the rest of the allocations.
if (!lowerCallArguments(call)) {
Expand Down Expand Up @@ -445,13 +445,13 @@ void LIRGenerator::visitCall(MCall* call) {
tempFixed(vpReg), tempFixed(tmpReg));
} else {
lir = new (alloc())
LCallKnown(useFixedAtStart(call->getFunction(), CallTempReg0),
LCallKnown(useFixedAtStart(call->getCallee(), CallTempReg0),
tempFixed(CallTempReg2));
}
} else {
// Call anything, using the most generic code.
lir = new (alloc())
LCallGeneric(useFixedAtStart(call->getFunction(), CallTempReg0),
LCallGeneric(useFixedAtStart(call->getCallee(), CallTempReg0),
tempFixed(CallTempReg1), tempFixed(CallTempReg2));
}
defineReturn(lir, call);
Expand Down
19 changes: 8 additions & 11 deletions js/src/jit/MIR.h
Original file line number Diff line number Diff line change
Expand Up @@ -2663,13 +2663,12 @@ class WrappedFunction : public TempObject {

class MCall : public MVariadicInstruction, public CallPolicy::Data {
private:
// An MCall uses the MPrepareCall, MDefinition for the function, and
// MPassArg instructions. They are stored in the same list.
static const size_t FunctionOperandIndex = 0;
// The callee, this, and the actual arguments are all operands of MCall.
static const size_t CalleeOperandIndex = 0;
static const size_t NumNonArgumentOperands = 1;

protected:
// Monomorphic cache of single target from TI, or nullptr.
// Monomorphic cache for MCalls with a single JSFunction target.
WrappedFunction* target_;

// Original value of argc from the bytecode.
Expand Down Expand Up @@ -2707,9 +2706,7 @@ class MCall : public MVariadicInstruction, public CallPolicy::Data {
bool ignoresReturnValue, bool isDOMCall,
DOMObjectKind objectKind);

void initFunction(MDefinition* func) {
initOperand(FunctionOperandIndex, func);
}
void initCallee(MDefinition* func) { initOperand(CalleeOperandIndex, func); }

bool needsArgCheck() const { return needsArgCheck_; }
void disableArgCheck() { needsArgCheck_ = false; }
Expand All @@ -2726,9 +2723,9 @@ class MCall : public MVariadicInstruction, public CallPolicy::Data {
needsThisCheck_ = true;
}

MDefinition* getFunction() const { return getOperand(FunctionOperandIndex); }
void replaceFunction(MInstruction* newfunc) {
replaceOperand(FunctionOperandIndex, newfunc);
MDefinition* getCallee() const { return getOperand(CalleeOperandIndex); }
void replaceCallee(MInstruction* newfunc) {
replaceOperand(CalleeOperandIndex, newfunc);
}

void addArg(size_t argnum, MDefinition* arg);
Expand All @@ -2745,7 +2742,7 @@ class MCall : public MVariadicInstruction, public CallPolicy::Data {
return NumNonArgumentOperands + index;
}

// For TI-informed monomorphic callsites.
// For monomorphic callsites.
WrappedFunction* getSingleTarget() const { return target_; }

bool isConstructing() const { return construct_; }
Expand Down
4 changes: 2 additions & 2 deletions js/src/jit/TypePolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -910,12 +910,12 @@ template bool ObjectPolicy<3>::staticAdjustInputs(TempAllocator& alloc,
bool CallPolicy::adjustInputs(TempAllocator& alloc, MInstruction* ins) const {
MCall* call = ins->toCall();

MDefinition* func = call->getFunction();
MDefinition* func = call->getCallee();
if (func->type() != MIRType::Object) {
MInstruction* unbox =
MUnbox::New(alloc, func, MIRType::Object, MUnbox::Fallible);
call->block()->insertBefore(call, unbox);
call->replaceFunction(unbox);
call->replaceCallee(unbox);

if (!unbox->typePolicy()->adjustInputs(alloc, unbox)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/WarpBuilderShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ MCall* WarpBuilderShared::makeCall(CallInfo& callInfo, bool needsThisCheck,

// Pass |this| and callee.
call->addArg(0, callInfo.thisArg());
call->initFunction(callInfo.callee());
call->initCallee(callInfo.callee());

return call;
}

0 comments on commit 1895e30

Please sign in to comment.