Bug 953120 - IonMonkey: Don't use pushedAtCycle_ when using push/pop. r=jandem
authorDan Gohman <sunfish@google.com>
Mon, 06 Jan 2014 08:59:58 -0800
changeset 162192 71c810816820a0e4a7b6c6f9e80e8e41080268e9
parent 162191 5568609fa907c87e48d5cb78bd612cf6f7402949
child 162193 8ffb10cf61383bdda9dad5d70a172a022734396b
push idunknown
push userunknown
push dateunknown
reviewersjandem
bugs953120
milestone29.0a1
Bug 953120 - IonMonkey: Don't use pushedAtCycle_ when using push/pop. r=jandem
js/src/jit/shared/MoveEmitter-x86-shared.cpp
--- a/js/src/jit/shared/MoveEmitter-x86-shared.cpp
+++ b/js/src/jit/shared/MoveEmitter-x86-shared.cpp
@@ -251,78 +251,72 @@ MoveEmitterX86::breakCycle(const MoveOpe
             masm.store32(to.reg(), cycleSlot());
         }
         break;
 #endif
 #ifndef JS_CPU_X64
       case MoveOp::INT32:
 #endif
       case MoveOp::GENERAL:
-        JS_ASSERT(pushedAtCycle_ == -1);
         masm.Push(toOperand(to));
-        pushedAtCycle_ = masm.framePushed();
         break;
       default:
         MOZ_ASSUME_UNREACHABLE("Unexpected move type");
     }
 }
 
 void
 MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type)
 {
-    JS_ASSERT(pushedAtCycle_ != -1);
-
     // There is some pattern:
     //   (A -> B)
     //   (B -> A)
     //
     // This case handles (B -> A), which we reach last. We emit a move from the
     // saved value of B, to A.
     switch (type) {
       case MoveOp::FLOAT32:
+        JS_ASSERT(pushedAtCycle_ != -1);
         JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(float));
         if (to.isMemory()) {
             masm.loadFloat32(cycleSlot(), ScratchFloatReg);
             masm.storeFloat32(ScratchFloatReg, toAddress(to));
         } else {
             masm.loadFloat32(cycleSlot(), to.floatReg());
         }
         break;
       case MoveOp::DOUBLE:
+        JS_ASSERT(pushedAtCycle_ != -1);
         JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(double));
         if (to.isMemory()) {
             masm.loadDouble(cycleSlot(), ScratchFloatReg);
             masm.storeDouble(ScratchFloatReg, toAddress(to));
         } else {
             masm.loadDouble(cycleSlot(), to.floatReg());
         }
         break;
 #ifdef JS_CPU_X64
       case MoveOp::INT32:
+        JS_ASSERT(pushedAtCycle_ != -1);
         JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(int32_t));
         // x64 can't pop to a 32-bit destination.
         if (to.isMemory()) {
             masm.load32(cycleSlot(), ScratchReg);
             masm.store32(ScratchReg, toAddress(to));
         } else {
             masm.load32(cycleSlot(), to.reg());
         }
         break;
 #endif
 #ifndef JS_CPU_X64
       case MoveOp::INT32:
 #endif
       case MoveOp::GENERAL:
-        JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(intptr_t));
-        if (to.isMemory()) {
-            masm.Pop(toPopOperand(to));
-        } else {
-            masm.Pop(to.reg());
-        }
-        pushedAtCycle_ = -1;
+        JS_ASSERT(masm.framePushed() - pushedAtStart_ >= sizeof(intptr_t));
+        masm.Pop(toPopOperand(to));
         break;
       default:
         MOZ_ASSUME_UNREACHABLE("Unexpected move type");
     }
 }
 
 void
 MoveEmitterX86::emitInt32Move(const MoveOperand &from, const MoveOperand &to)