X64 Crankshaft: Fix another error in pushed registers at safepoints.
authorwhesse@chromium.org <whesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 15 Feb 2011 12:17:53 +0000 (12:17 +0000)
committerwhesse@chromium.org <whesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 15 Feb 2011 12:17:53 +0000 (12:17 +0000)
Review URL: http://codereview.chromium.org/6525014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6789 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/x64/macro-assembler-x64.cc

index 1053664e11694bfa955cc89f13f0186e6c08fd0e..e990cfc353c9550d154536f2a56154cb70c64a63 100644 (file)
@@ -1443,13 +1443,15 @@ void MacroAssembler::Pushad() {
   push(r14);
   // r15 is kSmiConstantRegister
   STATIC_ASSERT(11 == kNumSafepointSavedRegisters);
-  subq(rsp, Immediate(
-      (kNumSafepointRegisters-kNumSafepointSavedRegisters) * kPointerSize));
+  // Use lea for symmetry with Popad.
+  lea(rsp, Operand(rsp,
+      -(kNumSafepointRegisters-kNumSafepointSavedRegisters) * kPointerSize));
 }
 
 
 void MacroAssembler::Popad() {
-  addq(rsp, Immediate(
+  // Popad must not change the flags, so use lea instead of addq.
+  lea(rsp, Operand(rsp,
       (kNumSafepointRegisters-kNumSafepointSavedRegisters) * kPointerSize));
   pop(r14);
   pop(r12);