Revision: 18674
Author:   [email protected]
Date:     Mon Jan 20 01:52:21 2014 UTC
Log: Use kRegisterSize when passing arguments to the C++ runtime for X64

[email protected]

Review URL: https://codereview.chromium.org/137443004
http://code.google.com/p/v8/source/detail?r=18674

Modified:
 /branches/bleeding_edge/src/x64/code-stubs-x64.cc
 /branches/bleeding_edge/src/x64/debug-x64.cc
 /branches/bleeding_edge/src/x64/deoptimizer-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc

=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Wed Jan 15 17:00:35 2014 UTC +++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Mon Jan 20 01:52:21 2014 UTC
@@ -1666,11 +1666,11 @@
   // Argument 9: Pass current isolate address.
   __ LoadAddress(kScratchRegister,
                  ExternalReference::isolate_address(masm->isolate()));
-  __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kPointerSize),
+  __ movq(Operand(rsp, (argument_slots_on_stack - 1) * kRegisterSize),
           kScratchRegister);

   // Argument 8: Indicate that this is a direct call from JavaScript.
-  __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kPointerSize),
+  __ movq(Operand(rsp, (argument_slots_on_stack - 2) * kRegisterSize),
           Immediate(1));

   // Argument 7: Start (high end) of backtracking stack memory area.
@@ -1678,13 +1678,13 @@
   __ movq(r9, Operand(kScratchRegister, 0));
   __ Move(kScratchRegister, address_of_regexp_stack_memory_size);
   __ addq(r9, Operand(kScratchRegister, 0));
-  __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kPointerSize), r9);
+  __ movq(Operand(rsp, (argument_slots_on_stack - 3) * kRegisterSize), r9);

// Argument 6: Set the number of capture registers to zero to force global // regexps to behave as non-global. This does not affect non-global regexps.
   // Argument 6 is passed in r9 on Linux and on the stack on Windows.
 #ifdef _WIN64
-  __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kPointerSize),
+  __ movq(Operand(rsp, (argument_slots_on_stack - 4) * kRegisterSize),
           Immediate(0));
 #else
   __ Set(r9, 0);
@@ -1695,7 +1695,7 @@
ExternalReference::address_of_static_offsets_vector(isolate));
   // Argument 5 passed in r8 on Linux and on the stack on Windows.
 #ifdef _WIN64
-  __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kPointerSize), r8);
+  __ movq(Operand(rsp, (argument_slots_on_stack - 5) * kRegisterSize), r8);
 #endif

   // rdi: subject string
@@ -2627,8 +2627,8 @@
     // Read result values stored on stack. Result is stored
     // above the four argument mirror slots and the two
     // Arguments object slots.
-    __ movq(rax, Operand(rsp, 6 * kPointerSize));
-    __ movq(rdx, Operand(rsp, 7 * kPointerSize));
+    __ movq(rax, Operand(rsp, 6 * kRegisterSize));
+    __ movq(rdx, Operand(rsp, 7 * kRegisterSize));
   }
 #endif
   __ lea(rcx, Operand(rax, 1));
@@ -5174,10 +5174,11 @@
   __ push(arg_reg_2);

   // Calculate the original stack pointer and store it in the second arg.
-  __ lea(arg_reg_2, Operand(rsp, (kNumSavedRegisters + 1) * kPointerSize));
+  __ lea(arg_reg_2,
+ Operand(rsp, kNumSavedRegisters * kRegisterSize + kPCOnStackSize));

   // Calculate the function address to the first arg.
-  __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kPointerSize));
+  __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kRegisterSize));
   __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength));

   // Save the remainder of the volatile registers.
=======================================
--- /branches/bleeding_edge/src/x64/debug-x64.cc Thu Nov 7 02:08:53 2013 UTC +++ /branches/bleeding_edge/src/x64/debug-x64.cc Mon Jan 20 01:52:21 2014 UTC
@@ -164,7 +164,7 @@
// If this call did not replace a call but patched other code then there will // be an unwanted return address left on the stack. Here we get rid of that.
   if (convert_call_to_jmp) {
-    __ addq(rsp, Immediate(kPointerSize));
+    __ addq(rsp, Immediate(kPCOnStackSize));
   }

   // Now that the break point has been handled, resume normal execution by
=======================================
--- /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Fri Nov 22 10:21:47 2013 UTC +++ /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Mon Jan 20 01:52:21 2014 UTC
@@ -156,7 +156,7 @@
     __ push(r);
   }

-  const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize +
+  const int kSavedRegistersAreaSize = kNumberOfRegisters * kRegisterSize +
                                       kDoubleRegsSize;

   // We use this to keep the value of the fifth argument temporarily.
@@ -169,9 +169,9 @@

   // Get the address of the location in the code object
   // and compute the fp-to-sp delta in register arg5.
-  __ movq(arg_reg_4,
-          Operand(rsp, kSavedRegistersAreaSize + 1 * kPointerSize));
-  __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 2 * kPointerSize));
+ __ movq(arg_reg_4, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize));
+  __ lea(arg5, Operand(rsp, kSavedRegistersAreaSize + 1 * kRegisterSize +
+                            kPCOnStackSize));

   __ subq(arg5, rbp);
   __ neg(arg5);
@@ -215,7 +215,7 @@
   }

   // Remove the bailout id and return address from the stack.
-  __ addq(rsp, Immediate(2 * kPointerSize));
+  __ addq(rsp, Immediate(1 * kRegisterSize + kPCOnStackSize));

   // Compute a pointer to the unwinding limit in register rcx; that is
   // the first stack slot not part of the input frame.
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Wed Jan 15 17:00:35 2014 UTC +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Jan 20 01:52:21 2014 UTC
@@ -3714,7 +3714,7 @@
   // Optionally save all XMM registers.
   if (save_doubles) {
     int space = XMMRegister::kMaxNumAllocatableRegisters * kDoubleSize +
-        arg_stack_space * kPointerSize;
+        arg_stack_space * kRegisterSize;
     subq(rsp, Immediate(space));
     int offset = -2 * kPointerSize;
     for (int i = 0; i < XMMRegister::NumAllocatableRegisters(); i++) {
@@ -3722,7 +3722,7 @@
       movsd(Operand(rbp, offset - ((i + 1) * kDoubleSize)), reg);
     }
   } else if (arg_stack_space > 0) {
-    subq(rsp, Immediate(arg_stack_space * kPointerSize));
+    subq(rsp, Immediate(arg_stack_space * kRegisterSize));
   }

   // Get the required frame alignment for the OS.
@@ -3767,7 +3767,7 @@
     }
   }
   // Get the return address from the stack and restore the frame pointer.
-  movq(rcx, Operand(rbp, 1 * kPointerSize));
+  movq(rcx, Operand(rbp, kFPOnStackSize));
   movq(rbp, Operand(rbp, 0 * kPointerSize));

   // Drop everything up to and including the arguments and the receiver
@@ -4640,9 +4640,9 @@
   ASSERT(IsPowerOf2(frame_alignment));
   int argument_slots_on_stack =
       ArgumentStackSlotsForCFunctionCall(num_arguments);
-  subq(rsp, Immediate((argument_slots_on_stack + 1) * kPointerSize));
+  subq(rsp, Immediate((argument_slots_on_stack + 1) * kRegisterSize));
   and_(rsp, Immediate(-frame_alignment));
- movq(Operand(rsp, argument_slots_on_stack * kPointerSize), kScratchRegister); + movq(Operand(rsp, argument_slots_on_stack * kRegisterSize), kScratchRegister);
 }


@@ -4665,7 +4665,7 @@
   ASSERT(num_arguments >= 0);
   int argument_slots_on_stack =
       ArgumentStackSlotsForCFunctionCall(num_arguments);
-  movq(rsp, Operand(rsp, argument_slots_on_stack * kPointerSize));
+  movq(rsp, Operand(rsp, argument_slots_on_stack * kRegisterSize));
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to