Bug 1640211 - Rename function to callee in MCall. r=iain
authorTom Schuster <evilpies@gmail.com>
Fri, 22 May 2020 21:06:20 +0000
changeset 531715 37c1d57785f72a65f7d8c91a13c5118c53f56ce3
parent 531714 3738ba3a4c9a7d50455173a048f1bf44ea7104fb
child 531716 d82fb36343f3444158da13f56f6bb86e667255d5
push id37442
push userncsoregi@mozilla.com
push dateSat, 23 May 2020 09:21:24 +0000
treeherdermozilla-central@bbcc193fe0f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1640211
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1640211 - Rename function to callee in MCall. r=iain Differential Revision: https://phabricator.services.mozilla.com/D76524
js/src/jit/IonBuilder.cpp
js/src/jit/Lowering.cpp
js/src/jit/MIR.h
js/src/jit/TypePolicy.cpp
js/src/jit/WarpBuilderShared.cpp
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -6263,17 +6263,17 @@ AbortReasonOr<MCall*> IonBuilder::makeCa
     if (!needArgCheck) {
       call->disableArgCheck();
     }
     if (!maybeCrossRealm) {
       call->setNotCrossRealm();
     }
   }
 
-  call->initFunction(callInfo.callee());
+  call->initCallee(callInfo.callee());
 
   current->add(call);
   return call;
 }
 
 static bool DOMCallNeedsBarrier(const JSJitInfo* jitinfo,
                                 TemporaryTypeSet* types) {
   MOZ_ASSERT(jitinfo->type() != JSJitInfo::InlinableNative);
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -400,17 +400,17 @@ bool LIRGenerator::lowerCallArguments(MC
     if (!alloc().ensureBallast()) {
       return false;
     }
   }
   return true;
 }
 
 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)) {
     abort(AbortReason::Alloc, "OOM: LIRGenerator::visitCall");
     return;
   }
 
   WrappedFunction* target = call->getSingleTarget();
@@ -440,23 +440,23 @@ void LIRGenerator::visitCall(MCall* call
       // register collisions.
       mozilla::DebugOnly<bool> ok = GetTempRegForIntArg(3, 0, &tmpReg);
       MOZ_ASSERT(ok, "How can we not have four temp registers?");
 
       lir = new (alloc()) LCallNative(tempFixed(cxReg), tempFixed(numReg),
                                       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);
   assignSafepoint(lir, call);
 }
 
 void LIRGenerator::visitApplyArgs(MApplyArgs* apply) {
   MOZ_ASSERT(apply->getFunction()->type() == MIRType::Object);
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -2658,23 +2658,22 @@ class WrappedFunction : public TempObjec
 
   JSFunction* rawJSFunction() const { return fun_; }
 
   bool appendRoots(MRootList& roots) const { return roots.append(fun_); }
 };
 
 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.
   uint32_t numActualArgs_;
 
   // True if the call is for JSOp::New or JSOp::SuperCall.
   bool construct_ : 1;
 
@@ -2702,55 +2701,53 @@ class MCall : public MVariadicInstructio
 
  public:
   INSTRUCTION_HEADER(Call)
   static MCall* New(TempAllocator& alloc, JSFunction* target, size_t maxArgc,
                     size_t numActualArgs, bool construct,
                     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; }
 
   bool needsClassCheck() const { return needsClassCheck_; }
   void disableClassCheck() { needsClassCheck_ = false; }
 
   bool maybeCrossRealm() const { return maybeCrossRealm_; }
   void setNotCrossRealm() { maybeCrossRealm_ = false; }
 
   bool needsThisCheck() const { return needsThisCheck_; }
   void setNeedsThisCheck() {
     MOZ_ASSERT(construct_);
     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);
 
   MDefinition* getArg(uint32_t index) const {
     return getOperand(NumNonArgumentOperands + index);
   }
 
   static size_t IndexOfThis() { return NumNonArgumentOperands; }
   static size_t IndexOfArgument(size_t index) {
     return NumNonArgumentOperands + index + 1;  // +1 to skip |this|.
   }
   static size_t IndexOfStackArg(size_t index) {
     return NumNonArgumentOperands + index;
   }
 
-  // For TI-informed monomorphic callsites.
+  // For monomorphic callsites.
   WrappedFunction* getSingleTarget() const { return target_; }
 
   bool isConstructing() const { 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
--- a/js/src/jit/TypePolicy.cpp
+++ b/js/src/jit/TypePolicy.cpp
@@ -905,22 +905,22 @@ template bool ObjectPolicy<1>::staticAdj
 template bool ObjectPolicy<2>::staticAdjustInputs(TempAllocator& alloc,
                                                   MInstruction* ins);
 template bool ObjectPolicy<3>::staticAdjustInputs(TempAllocator& alloc,
                                                   MInstruction* ins);
 
 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;
     }
   }
 
   for (uint32_t i = 0; i < call->numStackArgs(); i++) {
     if (!alloc.ensureBallast()) {
--- a/js/src/jit/WarpBuilderShared.cpp
+++ b/js/src/jit/WarpBuilderShared.cpp
@@ -76,12 +76,12 @@ MCall* WarpBuilderShared::makeCall(CallI
   // Add explicit arguments.
   // Skip addArg(0) because it is reserved for |this|.
   for (int32_t i = callInfo.argc() - 1; i >= 0; i--) {
     call->addArg(i + 1, callInfo.getArg(i));
   }
 
   // Pass |this| and callee.
   call->addArg(0, callInfo.thisArg());
-  call->initFunction(callInfo.callee());
+  call->initCallee(callInfo.callee());
 
   return call;
 }