Back out 30d5d70de548:1d61285b1da5 (bug 958672) for Linux32 jit-test failures
authorPhil Ringnalda <philringnalda@gmail.com>
Fri, 10 Jan 2014 18:44:50 -0800
changeset 179037 abf4a69f46e2f044da13b297cfae62b4846af149
parent 179036 046258beb9286f7ad22565f33e51c7757461cb84
child 179038 1d32a34f7011bb0582697c33825b3e8a10fe128e
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs958672
milestone29.0a1
backs out30d5d70de548a2e1726dd7010482cfbd62d04d9b
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
Back out 30d5d70de548:1d61285b1da5 (bug 958672) for Linux32 jit-test failures
js/src/jit/CodeGenerator.cpp
js/src/jit/LIR-Common.h
js/src/jit/Lowering.cpp
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -1788,20 +1788,18 @@ CodeGenerator::visitCallNative(LCallNati
 
       default:
         MOZ_ASSUME_UNREACHABLE("No such execution mode");
     }
 
     // Test for failure.
     masm.branchIfFalseBool(ReturnReg, masm.failureLabel(executionMode));
 
-    // Load the outparam vp[0] into output register(s), if observable.
-    Address ResultAddress(StackPointer, IonNativeExitFrameLayout::offsetOfResult());
-    if (call->mir()->hasUses())
-        masm.loadValue(ResultAddress, JSReturnOperand);
+    // Load the outparam vp[0] into output register(s).
+    masm.loadValue(Address(StackPointer, IonNativeExitFrameLayout::offsetOfResult()), JSReturnOperand);
 
     // The next instruction is removing the footer of the exit frame, so there
     // is no need for leaveFakeExitFrame.
 
     // Move the StackPointer back to its original location, unwinding the native exit frame.
     masm.adjustStack(IonNativeExitFrameLayout::Size() - unusedStack);
     JS_ASSERT(masm.framePushed() == initialStack);
 
@@ -1889,23 +1887,27 @@ CodeGenerator::visitCallDOMNative(LCallD
     masm.loadJSContext(argJSContext);
 
     masm.passABIArg(argJSContext);
     masm.passABIArg(argObj);
     masm.passABIArg(argPrivate);
     masm.passABIArg(argArgs);
     masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, target->jitInfo()->method));
 
-    if (!target->jitInfo()->isInfallible)
+    if (target->jitInfo()->isInfallible) {
+        masm.loadValue(Address(StackPointer, IonDOMMethodExitFrameLayout::offsetOfResult()),
+                       JSReturnOperand);
+    } else {
+        // Test for failure.
         masm.branchIfFalseBool(ReturnReg, masm.exceptionLabel());
 
-    // Load the outparam vp[0] into output register(s), if observable.
-    Address ResultAddress(StackPointer, IonDOMMethodExitFrameLayout::offsetOfResult());
-    if (call->mir()->hasUses())
-        masm.loadValue(ResultAddress, JSReturnOperand);
+        // Load the outparam vp[0] into output register(s).
+        masm.loadValue(Address(StackPointer, IonDOMMethodExitFrameLayout::offsetOfResult()),
+                       JSReturnOperand);
+    }
 
     // The next instruction is removing the footer of the exit frame, so there
     // is no need for leaveFakeExitFrame.
 
     // Move the StackPointer back to its original location, unwinding the native exit frame.
     masm.adjustStack(IonDOMMethodExitFrameLayout::Size() - unusedStack);
     JS_ASSERT(masm.framePushed() == initialStack);
 
--- a/js/src/jit/LIR-Common.h
+++ b/js/src/jit/LIR-Common.h
@@ -999,19 +999,27 @@ class LStackArgV : public LInstructionHe
         return argslot_;
     }
 };
 
 // Common code for LIR descended from MCall.
 template <size_t Defs, size_t Operands, size_t Temps>
 class LJSCallInstructionHelper : public LCallInstructionHelper<Defs, Operands, Temps>
 {
-  public:
+    // Slot below which %esp should be adjusted to make the call.
+    // Zero for a function without arguments.
+    uint32_t argslot_;
+
+  public:
+    LJSCallInstructionHelper(uint32_t argslot)
+      : argslot_(argslot)
+    { }
+
     uint32_t argslot() const {
-        return mir()->numStackArgs();
+        return argslot_;
     }
     MCall *mir() const {
         return this->mir_->toCall();
     }
 
     bool hasSingleTarget() const {
         return getSingleTarget() != nullptr;
     }
@@ -1026,27 +1034,30 @@ class LJSCallInstructionHelper : public 
     uint32_t numStackArgs() const {
         JS_ASSERT(mir()->numStackArgs() >= 1);
         return mir()->numStackArgs() - 1; // |this| is not a formal argument.
     }
     // Does not include |this|.
     uint32_t numActualArgs() const {
         return mir()->numActualArgs();
     }
+
+    typedef LJSCallInstructionHelper<Defs, Operands, Temps> JSCallHelper;
 };
 
 // Generates a polymorphic callsite, wherein the function being called is
 // unknown and anticipated to vary.
 class LCallGeneric : public LJSCallInstructionHelper<BOX_PIECES, 1, 2>
 {
   public:
     LIR_HEADER(CallGeneric)
 
-    LCallGeneric(const LAllocation &func, const LDefinition &nargsreg,
-                 const LDefinition &tmpobjreg)
+    LCallGeneric(const LAllocation &func, uint32_t argslot,
+                 const LDefinition &nargsreg, const LDefinition &tmpobjreg)
+      : JSCallHelper(argslot)
     {
         setOperand(0, func);
         setTemp(0, nargsreg);
         setTemp(1, tmpobjreg);
     }
 
     const LAllocation *getFunction() {
         return getOperand(0);
@@ -1060,17 +1071,18 @@ class LCallGeneric : public LJSCallInstr
 };
 
 // Generates a hardcoded callsite for a known, non-native target.
 class LCallKnown : public LJSCallInstructionHelper<BOX_PIECES, 1, 1>
 {
   public:
     LIR_HEADER(CallKnown)
 
-    LCallKnown(const LAllocation &func, const LDefinition &tmpobjreg)
+    LCallKnown(const LAllocation &func, uint32_t argslot, const LDefinition &tmpobjreg)
+      : JSCallHelper(argslot)
     {
         setOperand(0, func);
         setTemp(0, tmpobjreg);
     }
 
     const LAllocation *getFunction() {
         return getOperand(0);
     }
@@ -1080,18 +1092,20 @@ class LCallKnown : public LJSCallInstruc
 };
 
 // Generates a hardcoded callsite for a known, native target.
 class LCallNative : public LJSCallInstructionHelper<BOX_PIECES, 0, 4>
 {
   public:
     LIR_HEADER(CallNative)
 
-    LCallNative(const LDefinition &argContext, const LDefinition &argUintN,
+    LCallNative(uint32_t argslot,
+                const LDefinition &argContext, const LDefinition &argUintN,
                 const LDefinition &argVp, const LDefinition &tmpreg)
+      : JSCallHelper(argslot)
     {
         // Registers used for callWithABI().
         setTemp(0, argContext);
         setTemp(1, argUintN);
         setTemp(2, argVp);
 
         // Temporary registers.
         setTemp(3, tmpreg);
@@ -1112,18 +1126,20 @@ class LCallNative : public LJSCallInstru
 };
 
 // Generates a hardcoded callsite for a known, DOM-native target.
 class LCallDOMNative : public LJSCallInstructionHelper<BOX_PIECES, 0, 4>
 {
   public:
     LIR_HEADER(CallDOMNative)
 
-    LCallDOMNative(const LDefinition &argJSContext, const LDefinition &argObj,
+    LCallDOMNative(uint32_t argslot,
+                   const LDefinition &argJSContext, const LDefinition &argObj,
                    const LDefinition &argPrivate, const LDefinition &argArgs)
+      : JSCallHelper(argslot)
     {
         setTemp(0, argJSContext);
         setTemp(1, argObj);
         setTemp(2, argPrivate);
         setTemp(3, argArgs);
     }
 
     const LDefinition *getArgJSContext() {
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -399,59 +399,62 @@ LIRGenerator::visitCall(MCall *call)
     JS_ASSERT(CallTempReg0 != ArgumentsRectifierReg);
     JS_ASSERT(CallTempReg1 != ArgumentsRectifierReg);
     JS_ASSERT(call->getFunction()->type() == MIRType_Object);
 
     if (!lowerCallArguments(call))
         return false;
 
     // Height of the current argument vector.
+    uint32_t argslot = call->numStackArgs();
     JSFunction *target = call->getSingleTarget();
 
     // Call DOM functions.
     if (call->isCallDOMNative()) {
         JS_ASSERT(target && target->isNative());
         Register cxReg, objReg, privReg, argsReg;
         GetTempRegForIntArg(0, 0, &cxReg);
         GetTempRegForIntArg(1, 0, &objReg);
         GetTempRegForIntArg(2, 0, &privReg);
         mozilla::DebugOnly<bool> ok = GetTempRegForIntArg(3, 0, &argsReg);
         MOZ_ASSERT(ok, "How can we not have four temp registers?");
-        LCallDOMNative *lir = new(alloc()) LCallDOMNative(tempFixed(cxReg), tempFixed(objReg),
-                                                          tempFixed(privReg), tempFixed(argsReg));
-        return defineReturn(lir, call) && assignSafepoint(lir, call);
+        LCallDOMNative *lir = new(alloc()) LCallDOMNative(argslot, tempFixed(cxReg),
+                                                          tempFixed(objReg), tempFixed(privReg),
+                                                          tempFixed(argsReg));
+        return (defineReturn(lir, call) && assignSafepoint(lir, call));
     }
 
     // Call known functions.
     if (target) {
         if (target->isNative()) {
             Register cxReg, numReg, vpReg, tmpReg;
             GetTempRegForIntArg(0, 0, &cxReg);
             GetTempRegForIntArg(1, 0, &numReg);
             GetTempRegForIntArg(2, 0, &vpReg);
 
             // Even though this is just a temp reg, use the same API to avoid
             // register collisions.
             mozilla::DebugOnly<bool> ok = GetTempRegForIntArg(3, 0, &tmpReg);
             MOZ_ASSERT(ok, "How can we not have four temp registers?");
 
-            LCallNative *lir = new(alloc()) LCallNative(tempFixed(cxReg), tempFixed(numReg),
-                                                        tempFixed(vpReg), tempFixed(tmpReg));
+            LCallNative *lir = new(alloc()) LCallNative(argslot, tempFixed(cxReg),
+                                                        tempFixed(numReg),
+                                                        tempFixed(vpReg),
+                                                        tempFixed(tmpReg));
             return (defineReturn(lir, call) && assignSafepoint(lir, call));
         }
 
         LCallKnown *lir = new(alloc()) LCallKnown(useFixed(call->getFunction(), CallTempReg0),
-                                                  tempFixed(CallTempReg2));
-        return defineReturn(lir, call) && assignSafepoint(lir, call);
+                                                  argslot, tempFixed(CallTempReg2));
+        return (defineReturn(lir, call) && assignSafepoint(lir, call));
     }
 
     // Call anything, using the most generic code.
     LCallGeneric *lir = new(alloc()) LCallGeneric(useFixed(call->getFunction(), CallTempReg0),
-                                                  tempFixed(ArgumentsRectifierReg),
-                                                  tempFixed(CallTempReg2));
+        argslot, tempFixed(ArgumentsRectifierReg), tempFixed(CallTempReg2));
     return defineReturn(lir, call) && assignSafepoint(lir, call);
 }
 
 bool
 LIRGenerator::visitApplyArgs(MApplyArgs *apply)
 {
     JS_ASSERT(apply->getFunction()->type() == MIRType_Object);