Bug 1271010 - Baldr: rename Call to CallArgs (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Sat, 28 May 2016 16:51:00 -0500
changeset 340600 ff7d5e4ca750c0ad228e5e4dc0dfc70e9770efee
parent 340599 8ca82dcfc2a31722ac005ba8cbce4e7704643ea5
child 340601 520c9c228706376f3285bff5e693cad017db3435
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1271010
milestone49.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 1271010 - Baldr: rename Call to CallArgs (r=bbouvier) MozReview-Commit-ID: 1fZu58yJ735
js/src/asmjs/WasmIonCompile.cpp
--- a/js/src/asmjs/WasmIonCompile.cpp
+++ b/js/src/asmjs/WasmIonCompile.cpp
@@ -62,36 +62,36 @@ class FunctionCompiler
             index(index)
         {}
     };
 
     typedef Vector<ControlFlowPatch, 0, SystemAllocPolicy> ControlFlowPatchVector;
     typedef Vector<ControlFlowPatchVector, 0, SystemAllocPolicy> ControlFlowPatchsVector;
 
   public:
-    class Call;
+    class CallArgs;
 
   private:
-    typedef Vector<Call*, 0, SystemAllocPolicy> CallVector;
+    typedef Vector<CallArgs*, 0, SystemAllocPolicy> CallArgsVector;
 
     const ModuleGeneratorData& mg_;
     IonExprIter                iter_;
     const FuncBytes&           func_;
     const ValTypeVector&       locals_;
     size_t                     lastReadCallSite_;
 
     TempAllocator&             alloc_;
     MIRGraph&                  graph_;
     const CompileInfo&         info_;
     MIRGenerator&              mirGen_;
 
     MInstruction*              dummyIns_;
 
     MBasicBlock*               curBlock_;
-    CallVector                 callStack_;
+    CallArgsVector             callStack_;
     uint32_t                   maxStackArgBytes_;
 
     uint32_t                   loopDepth_;
     uint32_t                   blockDepth_;
     ControlFlowPatchsVector    blockPatches_;
 
     FuncCompileResults&        compileResults_;
 
@@ -759,130 +759,130 @@ class FunctionCompiler
     // stored to the stack immediately after evaluation (to decrease live
     // ranges and reduce spilling). This introduces the complexity that,
     // between evaluating an argument and making the call, another argument
     // evaluation could perform a call that also needs to store to the stack.
     // When this occurs childClobbers_ = true and the parent expression's
     // arguments are stored above the maximum depth clobbered by a child
     // expression.
 
-    class Call
+    class CallArgs
     {
         uint32_t lineOrBytecode_;
         ABIArgGenerator abi_;
         uint32_t maxChildStackBytes_;
         uint32_t spIncrement_;
         MAsmJSCall::Args regArgs_;
         Vector<MAsmJSPassStackArg*, 0, SystemAllocPolicy> stackArgs_;
         bool childClobbers_;
 
         friend class FunctionCompiler;
 
       public:
-        Call(FunctionCompiler& f, uint32_t lineOrBytecode)
+        CallArgs(FunctionCompiler& f, uint32_t lineOrBytecode)
           : lineOrBytecode_(lineOrBytecode),
             maxChildStackBytes_(0),
             spIncrement_(0),
             childClobbers_(false)
         { }
     };
 
-    bool startCallArgs(Call* call)
+    bool startCallArgs(CallArgs* args)
     {
         // Always push calls to maintain the invariant that if we're inDeadCode
         // in finishCallArgs, we have something to pop.
-        return callStack_.append(call);
+        return callStack_.append(args);
     }
 
-    bool passArg(MDefinition* argDef, ValType type, Call* call)
+    bool passArg(MDefinition* argDef, ValType type, CallArgs* args)
     {
         if (inDeadCode())
             return true;
 
-        ABIArg arg = call->abi_.next(ToMIRType(type));
+        ABIArg arg = args->abi_.next(ToMIRType(type));
         if (arg.kind() != ABIArg::Stack)
-            return call->regArgs_.append(MAsmJSCall::Arg(arg.reg(), argDef));
+            return args->regArgs_.append(MAsmJSCall::Arg(arg.reg(), argDef));
 
         auto* mir = MAsmJSPassStackArg::New(alloc(), arg.offsetFromArgBase(), argDef);
         curBlock_->add(mir);
-        return call->stackArgs_.append(mir);
+        return args->stackArgs_.append(mir);
     }
 
     void propagateMaxStackArgBytes(uint32_t stackBytes)
     {
         if (callStack_.empty()) {
             // Outermost call
             maxStackArgBytes_ = Max(maxStackArgBytes_, stackBytes);
             return;
         }
 
         // Non-outermost call
-        Call* outer = callStack_.back();
+        CallArgs* outer = callStack_.back();
         outer->maxChildStackBytes_ = Max(outer->maxChildStackBytes_, stackBytes);
         if (stackBytes && !outer->stackArgs_.empty())
             outer->childClobbers_ = true;
     }
 
-    void finishCallArgs(Call* call)
+    void finishCallArgs(CallArgs* args)
     {
-        MOZ_ALWAYS_TRUE(callStack_.popCopy() == call);
+        MOZ_ALWAYS_TRUE(callStack_.popCopy() == args);
 
         if (inDeadCode()) {
-            propagateMaxStackArgBytes(call->maxChildStackBytes_);
+            propagateMaxStackArgBytes(args->maxChildStackBytes_);
             return;
         }
 
-        uint32_t stackBytes = call->abi_.stackBytesConsumedSoFar();
-
-        if (call->childClobbers_) {
-            call->spIncrement_ = AlignBytes(call->maxChildStackBytes_, AsmJSStackAlignment);
-            for (MAsmJSPassStackArg* stackArg : call->stackArgs_)
-                stackArg->incrementOffset(call->spIncrement_);
-            stackBytes += call->spIncrement_;
+        uint32_t stackBytes = args->abi_.stackBytesConsumedSoFar();
+
+        if (args->childClobbers_) {
+            args->spIncrement_ = AlignBytes(args->maxChildStackBytes_, AsmJSStackAlignment);
+            for (MAsmJSPassStackArg* stackArg : args->stackArgs_)
+                stackArg->incrementOffset(args->spIncrement_);
+            stackBytes += args->spIncrement_;
         } else {
-            call->spIncrement_ = 0;
-            stackBytes = Max(stackBytes, call->maxChildStackBytes_);
+            args->spIncrement_ = 0;
+            stackBytes = Max(stackBytes, args->maxChildStackBytes_);
         }
 
         propagateMaxStackArgBytes(stackBytes);
     }
 
   private:
-    bool callPrivate(MAsmJSCall::Callee callee, const Call& call, ExprType ret, MDefinition** def)
+    bool callPrivate(MAsmJSCall::Callee callee, const CallArgs& args, ExprType ret, MDefinition** def)
     {
         if (inDeadCode()) {
             *def = nullptr;
             return true;
         }
 
         CallSiteDesc::Kind kind = CallSiteDesc::Kind(-1);
         switch (callee.which()) {
           case MAsmJSCall::Callee::Internal: kind = CallSiteDesc::Relative; break;
           case MAsmJSCall::Callee::Dynamic:  kind = CallSiteDesc::Register; break;
           case MAsmJSCall::Callee::Builtin:  kind = CallSiteDesc::Register; break;
         }
 
-        MAsmJSCall* ins = MAsmJSCall::New(alloc(), CallSiteDesc(call.lineOrBytecode_, kind),
-                                          callee, call.regArgs_, ToMIRType(ret), call.spIncrement_);
+        MAsmJSCall* ins = MAsmJSCall::New(alloc(), CallSiteDesc(args.lineOrBytecode_, kind),
+                                          callee, args.regArgs_, ToMIRType(ret), args.spIncrement_);
         if (!ins)
             return false;
 
         curBlock_->add(ins);
         *def = ins;
         return true;
     }
 
   public:
-    bool internalCall(const Sig& sig, uint32_t funcIndex, const Call& call, MDefinition** def)
+    bool internalCall(const Sig& sig, uint32_t funcIndex, const CallArgs& args, MDefinition** def)
     {
-        return callPrivate(MAsmJSCall::Callee(funcIndex), call, sig.ret(), def);
+        return callPrivate(MAsmJSCall::Callee(funcIndex), args, sig.ret(), def);
     }
 
     bool funcPtrCall(const Sig& sig, uint32_t length, uint32_t globalDataOffset, MDefinition* index,
-                     const Call& call, MDefinition** def)
+                     const CallArgs& args, MDefinition** def)
     {
         if (inDeadCode()) {
             *def = nullptr;
             return true;
         }
 
         MAsmJSLoadFuncPtr* ptrFun;
         if (mg().kind == ModuleKind::AsmJS) {
@@ -902,35 +902,35 @@ class FunctionCompiler
             MOZ_ASSERT(!length || length == mg_.numTableElems);
             bool alwaysThrow = !length;
 
             ptrFun = MAsmJSLoadFuncPtr::New(alloc(), index, mg_.numTableElems, alwaysThrow,
                                             globalDataOffset);
             curBlock_->add(ptrFun);
         }
 
-        return callPrivate(MAsmJSCall::Callee(ptrFun), call, sig.ret(), def);
+        return callPrivate(MAsmJSCall::Callee(ptrFun), args, sig.ret(), def);
     }
 
-    bool ffiCall(unsigned globalDataOffset, const Call& call, ExprType ret, MDefinition** def)
+    bool ffiCall(unsigned globalDataOffset, const CallArgs& args, ExprType ret, MDefinition** def)
     {
         if (inDeadCode()) {
             *def = nullptr;
             return true;
         }
 
         MAsmJSLoadFFIFunc* ptrFun = MAsmJSLoadFFIFunc::New(alloc(), globalDataOffset);
         curBlock_->add(ptrFun);
 
-        return callPrivate(MAsmJSCall::Callee(ptrFun), call, ret, def);
+        return callPrivate(MAsmJSCall::Callee(ptrFun), args, ret, def);
     }
 
-    bool builtinCall(SymbolicAddress builtin, const Call& call, ValType type, MDefinition** def)
+    bool builtinCall(SymbolicAddress builtin, const CallArgs& args, ValType type, MDefinition** def)
     {
-        return callPrivate(MAsmJSCall::Callee(builtin), call, ToExprType(type), def);
+        return callPrivate(MAsmJSCall::Callee(builtin), args, ToExprType(type), def);
     }
 
     /*********************************************** Control flow generation */
 
     inline bool inDeadCode() const {
         return curBlock_ == nullptr;
     }
 
@@ -1651,60 +1651,60 @@ EmitReturn(FunctionCompiler& f)
         return true;
     }
 
     f.returnExpr(value);
     return true;
 }
 
 static bool
-EmitCallArgs(FunctionCompiler& f, const Sig& sig, FunctionCompiler::Call* ionCall)
+EmitCallArgs(FunctionCompiler& f, const Sig& sig, FunctionCompiler::CallArgs* args)
 {
-    if (!f.startCallArgs(ionCall))
+    if (!f.startCallArgs(args))
         return false;
 
     MDefinition* arg;
-    const ValTypeVector& args = sig.args();
-    uint32_t numArgs = args.length();
+    const ValTypeVector& argTypes = sig.args();
+    uint32_t numArgs = argTypes.length();
     for (size_t i = 0; i < numArgs; ++i) {
-        ValType argType = args[i];
+        ValType argType = argTypes[i];
         if (!f.iter().readCallArg(argType, numArgs, i, &arg))
             return false;
-        if (!f.passArg(arg, argType, ionCall))
+        if (!f.passArg(arg, argType, args))
             return false;
     }
 
     if (!f.iter().readCallArgsEnd(numArgs))
         return false;
 
-    f.finishCallArgs(ionCall);
+    f.finishCallArgs(args);
     return true;
 }
 
 static bool
 EmitCall(FunctionCompiler& f, uint32_t callOffset)
 {
     uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode(callOffset);
 
     uint32_t calleeIndex;
     uint32_t arity;
     if (!f.iter().readCall(&calleeIndex, &arity))
         return false;
 
     const Sig& sig = *f.mg().funcSigs[calleeIndex];
 
-    FunctionCompiler::Call ionCall(f, lineOrBytecode);
-    if (!EmitCallArgs(f, sig, &ionCall))
+    FunctionCompiler::CallArgs args(f, lineOrBytecode);
+    if (!EmitCallArgs(f, sig, &args))
         return false;
 
     if (!f.iter().readCallReturn(sig.ret()))
         return false;
 
     MDefinition* def;
-    if (!f.internalCall(sig, calleeIndex, ionCall, &def))
+    if (!f.internalCall(sig, calleeIndex, args, &def))
         return false;
 
     if (IsVoid(sig.ret()))
         return true;
 
     f.iter().setResult(def);
     return true;
 }
@@ -1716,30 +1716,30 @@ EmitCallIndirect(FunctionCompiler& f, ui
 
     uint32_t sigIndex;
     uint32_t arity;
     if (!f.iter().readCallIndirect(&sigIndex, &arity))
         return false;
 
     const Sig& sig = f.mg().sigs[sigIndex];
 
-    FunctionCompiler::Call ionCall(f, lineOrBytecode);
-    if (!EmitCallArgs(f, sig, &ionCall))
+    FunctionCompiler::CallArgs args(f, lineOrBytecode);
+    if (!EmitCallArgs(f, sig, &args))
         return false;
 
     MDefinition* callee;
     if (!f.iter().readCallIndirectCallee(&callee))
         return false;
 
     if (!f.iter().readCallReturn(sig.ret()))
         return false;
 
     MDefinition* def;
     const TableModuleGeneratorData& table = f.mg().sigToTable[sigIndex];
-    if (!f.funcPtrCall(sig, table.numElems, table.globalDataOffset, callee, ionCall, &def))
+    if (!f.funcPtrCall(sig, table.numElems, table.globalDataOffset, callee, args, &def))
         return false;
 
     if (IsVoid(sig.ret()))
         return true;
 
     f.iter().setResult(def);
     return true;
 }
@@ -1752,25 +1752,25 @@ EmitCallImport(FunctionCompiler& f, uint
     uint32_t importIndex;
     uint32_t arity;
     if (!f.iter().readCallImport(&importIndex, &arity))
         return false;
 
     const ImportModuleGeneratorData& import = f.mg().imports[importIndex];
     const Sig& sig = *import.sig;
 
-    FunctionCompiler::Call ionCall(f, lineOrBytecode);
-    if (!EmitCallArgs(f, sig, &ionCall))
+    FunctionCompiler::CallArgs args(f, lineOrBytecode);
+    if (!EmitCallArgs(f, sig, &args))
         return false;
 
     if (!f.iter().readCallReturn(sig.ret()))
         return false;
 
     MDefinition* def;
-    if (!f.ffiCall(import.globalDataOffset, ionCall, sig.ret(), &def))
+    if (!f.ffiCall(import.globalDataOffset, args, sig.ret(), &def))
         return false;
 
     if (IsVoid(sig.ret()))
         return true;
 
     f.iter().setResult(def);
     return true;
 }
@@ -2182,62 +2182,62 @@ EmitStoreWithCoercion(FunctionCompiler& 
 }
 
 static bool
 EmitUnaryMathBuiltinCall(FunctionCompiler& f, uint32_t callOffset, SymbolicAddress callee,
                          ValType operandType)
 {
     uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode(callOffset);
 
-    FunctionCompiler::Call call(f, lineOrBytecode);
-    if (!f.startCallArgs(&call))
+    FunctionCompiler::CallArgs args(f, lineOrBytecode);
+    if (!f.startCallArgs(&args))
         return false;
 
     MDefinition* input;
     if (!f.iter().readUnary(operandType, &input))
         return false;
 
-    if (!f.passArg(input, operandType, &call))
+    if (!f.passArg(input, operandType, &args))
         return false;
 
-    f.finishCallArgs(&call);
+    f.finishCallArgs(&args);
 
     MDefinition* def;
-    if (!f.builtinCall(callee, call, operandType, &def))
+    if (!f.builtinCall(callee, args, operandType, &def))
         return false;
 
     f.iter().setResult(def);
     return true;
 }
 
 static bool
 EmitBinaryMathBuiltinCall(FunctionCompiler& f, uint32_t callOffset, SymbolicAddress callee,
                           ValType operandType)
 {
     uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode(callOffset);
 
-    FunctionCompiler::Call call(f, lineOrBytecode);
-    if (!f.startCallArgs(&call))
+    FunctionCompiler::CallArgs args(f, lineOrBytecode);
+    if (!f.startCallArgs(&args))
         return false;
 
     MDefinition* lhs;
     MDefinition* rhs;
     if (!f.iter().readBinary(operandType, &lhs, &rhs))
         return false;
 
-    if (!f.passArg(lhs, operandType, &call))
+    if (!f.passArg(lhs, operandType, &args))
         return false;
 
-    if (!f.passArg(rhs, operandType, &call))
+    if (!f.passArg(rhs, operandType, &args))
         return false;
 
-    f.finishCallArgs(&call);
+    f.finishCallArgs(&args);
 
     MDefinition* def;
-    if (!f.builtinCall(callee, call, operandType, &def))
+    if (!f.builtinCall(callee, args, operandType, &def))
         return false;
 
     f.iter().setResult(def);
     return true;
 }
 
 static bool
 EmitAtomicsLoad(FunctionCompiler& f)