Revision: 7450
Author:   [email protected]
Date:     Wed Mar 30 11:05:16 2011
Log:      Only pass isolate parameter to C helper functions that need it.

Review URL: http://codereview.chromium.org/6778018
http://code.google.com/p/v8/source/detail?r=7450

Modified:
 /branches/bleeding_edge/src/arm/codegen-arm.cc
 /branches/bleeding_edge/src/arm/deoptimizer-arm.cc
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc
 /branches/bleeding_edge/src/arm/macro-assembler-arm.cc
 /branches/bleeding_edge/src/arm/regexp-macro-assembler-arm.cc
 /branches/bleeding_edge/src/deoptimizer.cc
 /branches/bleeding_edge/src/deoptimizer.h
 /branches/bleeding_edge/src/ia32/codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/deoptimizer-ia32.cc
 /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
 /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
 /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc
 /branches/bleeding_edge/src/v8.cc
 /branches/bleeding_edge/src/v8.h
 /branches/bleeding_edge/src/x64/codegen-x64.cc
 /branches/bleeding_edge/src/x64/deoptimizer-x64.cc
 /branches/bleeding_edge/src/x64/full-codegen-x64.cc
 /branches/bleeding_edge/src/x64/macro-assembler-x64.cc
 /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc      Wed Mar 23 06:40:07 2011
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc      Wed Mar 30 11:05:16 2011
@@ -5361,8 +5361,9 @@
   // by computing:
   // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
   if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) {
-    __ PrepareCallCFunction(0, r1);
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0);
+    __ PrepareCallCFunction(1, r0);
+    __ mov(r0, Operand(ExternalReference::isolate_address()));
+ __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);

     CpuFeatures::Scope scope(VFP3);
     // 0x41300000 is the top half of 1.0 x 2^20 as a double.
@@ -5380,10 +5381,11 @@
     __ vstr(d7, r0, HeapNumber::kValueOffset);
     frame_->EmitPush(r4);
   } else {
+    __ PrepareCallCFunction(2, r0);
     __ mov(r0, Operand(r4));
-    __ PrepareCallCFunction(1, r1);
+    __ mov(r1, Operand(ExternalReference::isolate_address()));
     __ CallCFunction(
- ExternalReference::fill_heap_number_with_random_function(isolate()), 1); + ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
     frame_->EmitPush(r0);
   }
 }
=======================================
--- /branches/bleeding_edge/src/arm/deoptimizer-arm.cc Mon Mar 28 05:27:56 2011 +++ /branches/bleeding_edge/src/arm/deoptimizer-arm.cc Wed Mar 30 11:05:16 2011
@@ -586,14 +586,16 @@

   // Allocate a new deoptimizer object.
   // Pass four arguments in r0 to r3 and fifth argument on stack.
-  __ PrepareCallCFunction(5, r5);
+  __ PrepareCallCFunction(6, r5);
   __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
   __ mov(r1, Operand(type()));  // bailout type,
   // r2: bailout id already loaded.
   // r3: code address or 0 already loaded.
   __ str(r4, MemOperand(sp, 0 * kPointerSize));  // Fp-to-sp delta.
+  __ mov(r5, Operand(ExternalReference::isolate_address()));
+  __ str(r5, MemOperand(sp, 1 * kPointerSize));  // Isolate.
   // Call Deoptimizer::New().
- __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 5); + __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);

   // Preserve "deoptimizer" object in register r0 and get the input
   // frame descriptor pointer to r1 (deoptimizer->input_);
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Mar 23 06:40:07 2011 +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Mar 30 11:05:16 2011
@@ -2803,8 +2803,9 @@
   // by computing:
   // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
   if (isolate()->cpu_features()->IsSupported(VFP3)) {
-    __ PrepareCallCFunction(0, r1);
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0);
+    __ PrepareCallCFunction(1, r0);
+    __ mov(r0, Operand(ExternalReference::isolate_address()));
+ __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);

     CpuFeatures::Scope scope(VFP3);
     // 0x41300000 is the top half of 1.0 x 2^20 as a double.
@@ -2822,10 +2823,11 @@
     __ vstr(d7, r0, HeapNumber::kValueOffset);
     __ mov(r0, r4);
   } else {
+    __ PrepareCallCFunction(2, r0);
     __ mov(r0, Operand(r4));
-    __ PrepareCallCFunction(1, r1);
+    __ mov(r1, Operand(ExternalReference::isolate_address()));
     __ CallCFunction(
- ExternalReference::fill_heap_number_with_random_function(isolate()), 1); + ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
   }

   context()->Plug(r0);
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Wed Mar 23 06:40:07 2011 +++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Wed Mar 30 11:05:16 2011
@@ -1799,9 +1799,10 @@
   bind(&delete_allocated_handles);
   str(r5, MemOperand(r7, kLimitOffset));
   mov(r4, r0);
-  PrepareCallCFunction(0, r5);
+  PrepareCallCFunction(1, r5);
+  mov(r0, Operand(ExternalReference::isolate_address()));
   CallCFunction(
-      ExternalReference::delete_handle_scope_extensions(isolate()), 0);
+      ExternalReference::delete_handle_scope_extensions(isolate()), 1);
   mov(r0, r4);
   jmp(&leave_exit_frame);

@@ -2797,9 +2798,6 @@
void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) {
   int frame_alignment = ActivationFrameAlignment();

- // Reserve space for Isolate address which is always passed as last parameter
-  num_arguments += 1;
-
   // Up to four simple arguments are passed in registers r0..r3.
int stack_passed_arguments = (num_arguments <= kRegisterPassedArguments) ? 0 : num_arguments - kRegisterPassedArguments;
@@ -2836,19 +2834,6 @@
ExternalReference function_reference,
                                          Register scratch,
                                          int num_arguments) {
-  // Push Isolate address as the last argument.
-  if (num_arguments < kRegisterPassedArguments) {
-    Register arg_to_reg[] = {r0, r1, r2, r3};
-    Register r = arg_to_reg[num_arguments];
-    mov(r, Operand(ExternalReference::isolate_address()));
-  } else {
-    int stack_passed_arguments = num_arguments - kRegisterPassedArguments;
-    // Push Isolate address on the stack after the arguments.
-    mov(scratch, Operand(ExternalReference::isolate_address()));
-    str(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize));
-  }
-  num_arguments += 1;
-
   // Make sure that the stack is aligned before calling a C function unless
// running in the simulator. The simulator has its own alignment check which
   // provides more information.
=======================================
--- /branches/bleeding_edge/src/arm/regexp-macro-assembler-arm.cc Tue Mar 22 06:20:04 2011 +++ /branches/bleeding_edge/src/arm/regexp-macro-assembler-arm.cc Wed Mar 30 11:05:16 2011
@@ -347,7 +347,7 @@
     __ sub(current_input_offset(), r2, end_of_input_address());
   } else {
     ASSERT(mode_ == UC16);
-    int argument_count = 3;
+    int argument_count = 4;
     __ PrepareCallCFunction(argument_count, r2);

     // r0 - offset of start of capture
@@ -358,6 +358,7 @@
     //   r0: Address byte_offset1 - Address captured substring's start.
     //   r1: Address byte_offset2 - Address of current character position.
     //   r2: size_t byte_length - length of capture in bytes(!)
+    //   r3: Isolate* isolate

     // Address of start of capture.
     __ add(r0, r0, Operand(end_of_input_address()));
@@ -367,6 +368,8 @@
     __ mov(r4, Operand(r1));
     // Address of current input position.
     __ add(r1, current_input_offset(), Operand(end_of_input_address()));
+    // Isolate.
+    __ mov(r3, Operand(ExternalReference::isolate_address()));

     ExternalReference function =
ExternalReference::re_case_insensitive_compare_uc16(masm_->isolate());
@@ -778,10 +781,11 @@
     Label grow_failed;

     // Call GrowStack(backtrack_stackpointer(), &stack_base)
-    static const int num_arguments = 2;
+    static const int num_arguments = 3;
     __ PrepareCallCFunction(num_arguments, r0);
     __ mov(r0, backtrack_stackpointer());
     __ add(r1, frame_pointer(), Operand(kStackHighEnd));
+    __ mov(r2, Operand(ExternalReference::isolate_address()));
     ExternalReference grow_stack =
         ExternalReference::re_grow_stack(masm_->isolate());
     __ CallCFunction(grow_stack, num_arguments);
=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/deoptimizer.cc  Wed Mar 30 11:05:16 2011
@@ -199,8 +199,7 @@
 }


-void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer,
-                                      Isolate* isolate) {
+void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) {
   deoptimizer->DoComputeOutputFrames();
 }

=======================================
--- /branches/bleeding_edge/src/deoptimizer.h   Fri Mar 25 06:26:55 2011
+++ /branches/bleeding_edge/src/deoptimizer.h   Wed Mar 30 11:05:16 2011
@@ -192,7 +192,7 @@

   void InsertHeapNumberValues(int index, JavaScriptFrame* frame);

- static void ComputeOutputFrames(Deoptimizer* deoptimizer, Isolate* isolate);
+  static void ComputeOutputFrames(Deoptimizer* deoptimizer);

   static Address GetDeoptimizationEntry(int id, BailoutType type);
   static int GetDeoptimizationId(Address addr, BailoutType type);
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Mar 30 07:31:32 2011 +++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Mar 30 11:05:16 2011
@@ -7448,9 +7448,10 @@

   __ bind(&heapnumber_allocated);

-  __ PrepareCallCFunction(0, ebx);
+  __ PrepareCallCFunction(1, ebx);
+  __ mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address()));
__ CallCFunction(ExternalReference::random_uint32_function(masm()->isolate()),
-                   0);
+                   1);

   // Convert 32 random bits in eax to 0.(32 random bits) in a double
   // by computing:
=======================================
--- /branches/bleeding_edge/src/ia32/deoptimizer-ia32.cc Mon Mar 28 05:27:56 2011 +++ /branches/bleeding_edge/src/ia32/deoptimizer-ia32.cc Wed Mar 30 11:05:16 2011
@@ -641,14 +641,16 @@
   __ neg(edx);

   // Allocate a new deoptimizer object.
-  __ PrepareCallCFunction(5, eax);
+  __ PrepareCallCFunction(6, eax);
   __ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
   __ mov(Operand(esp, 0 * kPointerSize), eax);  // Function.
__ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type.
   __ mov(Operand(esp, 2 * kPointerSize), ebx);  // Bailout id.
   __ mov(Operand(esp, 3 * kPointerSize), ecx);  // Code address or 0.
   __ mov(Operand(esp, 4 * kPointerSize), edx);  // Fp-to-sp delta.
- __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 5);
+  __ mov(Operand(esp, 5 * kPointerSize),
+         Immediate(ExternalReference::isolate_address()));
+ __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);

   // Preserve deoptimizer object in register eax and get the input
   // frame descriptor pointer.
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Fri Mar 25 06:21:30 2011 +++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed Mar 30 11:05:16 2011
@@ -2717,9 +2717,10 @@

   __ bind(&heapnumber_allocated);

-  __ PrepareCallCFunction(0, ebx);
+  __ PrepareCallCFunction(1, ebx);
+  __ mov(Operand(esp, 0), Immediate(ExternalReference::isolate_address()));
   __ CallCFunction(ExternalReference::random_uint32_function(isolate()),
-                   0);
+                   1);

   // Convert 32 random bits in eax to 0.(32 random bits) in a double
   // by computing:
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Fri Mar 25 06:21:30 2011 +++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Wed Mar 30 11:05:16 2011
@@ -1988,17 +1988,14 @@


void MacroAssembler::PrepareCallCFunction(int num_arguments, Register scratch) { - // Reserve space for Isolate address which is always passed as last parameter
-  num_arguments += 1;
-
-  int frameAlignment = OS::ActivationFrameAlignment();
-  if (frameAlignment != 0) {
+  int frame_alignment = OS::ActivationFrameAlignment();
+  if (frame_alignment != 0) {
     // Make stack end at alignment and make room for num_arguments words
     // and the original value of esp.
     mov(scratch, esp);
     sub(Operand(esp), Immediate((num_arguments + 1) * kPointerSize));
-    ASSERT(IsPowerOf2(frameAlignment));
-    and_(esp, -frameAlignment);
+    ASSERT(IsPowerOf2(frame_alignment));
+    and_(esp, -frame_alignment);
     mov(Operand(esp, num_arguments * kPointerSize), scratch);
   } else {
     sub(Operand(esp), Immediate(num_arguments * kPointerSize));
@@ -2016,11 +2013,6 @@

 void MacroAssembler::CallCFunction(Register function,
                                    int num_arguments) {
-  // Pass current isolate address as additional parameter.
-  mov(Operand(esp, num_arguments * kPointerSize),
-      Immediate(ExternalReference::isolate_address()));
-  num_arguments += 1;
-
   // Check stack alignment.
   if (emit_debug_code()) {
     CheckStackAlignment();
@@ -2030,7 +2022,7 @@
   if (OS::ActivationFrameAlignment() != 0) {
     mov(esp, Operand(esp, num_arguments * kPointerSize));
   } else {
-    add(Operand(esp), Immediate(num_arguments * sizeof(int32_t)));
+    add(Operand(esp), Immediate(num_arguments * kPointerSize));
   }
 }

=======================================
--- /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc Tue Mar 22 06:20:04 2011 +++ /branches/bleeding_edge/src/ia32/regexp-macro-assembler-ia32.cc Wed Mar 30 11:05:16 2011
@@ -372,14 +372,18 @@
     __ push(backtrack_stackpointer());
     __ push(ebx);

-    static const int argument_count = 3;
+    static const int argument_count = 4;
     __ PrepareCallCFunction(argument_count, ecx);
// Put arguments into allocated stack area, last argument highest on stack.
     // Parameters are
     //   Address byte_offset1 - Address captured substring's start.
     //   Address byte_offset2 - Address of current character position.
     //   size_t byte_length - length of capture in bytes(!)
-
+    //   Isolate* isolate
+
+    // Set isolate.
+    __ mov(Operand(esp, 3 * kPointerSize),
+           Immediate(ExternalReference::isolate_address()));
     // Set byte_length.
     __ mov(Operand(esp, 2 * kPointerSize), ebx);
     // Set byte_offset2.
@@ -838,8 +842,10 @@
     __ push(edi);

     // Call GrowStack(backtrack_stackpointer())
-    static const int num_arguments = 2;
+    static const int num_arguments = 3;
     __ PrepareCallCFunction(num_arguments, ebx);
+    __ mov(Operand(esp, 2 * kPointerSize),
+           Immediate(ExternalReference::isolate_address()));
     __ lea(eax, Operand(ebp, kStackHighEnd));
     __ mov(Operand(esp, 1 * kPointerSize), eax);
     __ mov(Operand(esp, 0 * kPointerSize), backtrack_stackpointer());
=======================================
--- /branches/bleeding_edge/src/v8.cc   Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/v8.cc   Wed Mar 30 11:05:16 2011
@@ -171,8 +171,8 @@
 } double_int_union;


-Object* V8::FillHeapNumberWithRandom(Object* heap_number) {
-  uint64_t random_bits = Random(Isolate::Current());
+Object* V8::FillHeapNumberWithRandom(Object* heap_number, Isolate* isolate) {
+  uint64_t random_bits = Random(isolate);
   // Make a double* from address (heap_number + sizeof(double)).
   double_int_union* r = reinterpret_cast<double_int_union*>(
       reinterpret_cast<char*>(heap_number) +
=======================================
--- /branches/bleeding_edge/src/v8.h    Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/v8.h    Wed Mar 30 11:05:16 2011
@@ -101,7 +101,8 @@
   // use a separate random state for internal random number
   // generation.
   static uint32_t RandomPrivate(Isolate* isolate);
-  static Object* FillHeapNumberWithRandom(Object* heap_number);
+  static Object* FillHeapNumberWithRandom(Object* heap_number,
+                                          Isolate* isolate);

   // Idle notification directly from the API.
   static bool IdleNotification();
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Wed Mar 30 07:31:32 2011
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Wed Mar 30 11:05:16 2011
@@ -6438,8 +6438,13 @@

   // Return a random uint32 number in rax.
   // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
-  __ PrepareCallCFunction(0);
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0);
+  __ PrepareCallCFunction(1);
+#ifdef _WIN64
+  __ LoadAddress(rcx, ExternalReference::isolate_address());
+#else
+  __ LoadAddress(rdi, ExternalReference::isolate_address());
+#endif
+ __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);

   // Convert 32 random bits in rax to 0.(32 random bits) in a double
   // by computing:
=======================================
--- /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Mon Mar 28 05:27:56 2011 +++ /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Wed Mar 30 11:05:16 2011
@@ -663,23 +663,26 @@
   __ neg(arg5);

   // Allocate a new deoptimizer object.
-  __ PrepareCallCFunction(5);
+  __ PrepareCallCFunction(6);
   __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
   __ movq(arg1, rax);
   __ movq(arg2, Immediate(type()));
   // Args 3 and 4 are already in the right registers.

-  // On windows put the argument on the stack (PrepareCallCFunction have
-  // created space for this). On linux pass the argument in r8.
+  // On windows put the arguments on the stack (PrepareCallCFunction
+  // has created space for this). On linux pass the arguments in r8 and r9.
 #ifdef _WIN64
   __ movq(Operand(rsp, 4 * kPointerSize), arg5);
+  __ LoadAddress(arg5, ExternalReference::isolate_address());
+  __ movq(Operand(rsp, 5 * kPointerSize), arg5);
 #else
   __ movq(r8, arg5);
+  __ LoadAddress(r9, ExternalReference::isolate_address());
 #endif

   Isolate* isolate = masm()->isolate();

- __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 5); + __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);
   // Preserve deoptimizer object in register rax and get the input
   // frame descriptor pointer.
   __ movq(rbx, Operand(rax, Deoptimizer::input_offset()));
@@ -722,10 +725,11 @@

   // Compute the output frame in the deoptimizer.
   __ push(rax);
-  __ PrepareCallCFunction(1);
+  __ PrepareCallCFunction(2);
   __ movq(arg1, rax);
+  __ LoadAddress(arg2, ExternalReference::isolate_address());
   __ CallCFunction(
-      ExternalReference::compute_output_frames_function(isolate), 1);
+      ExternalReference::compute_output_frames_function(isolate), 2);
   __ pop(rax);

   // Replace the current frame with the output frames.
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Thu Mar 24 05:24:28 2011 +++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Wed Mar 30 11:05:16 2011
@@ -2693,8 +2693,13 @@

   // Return a random uint32 number in rax.
   // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
-  __ PrepareCallCFunction(0);
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0);
+  __ PrepareCallCFunction(1);
+#ifdef _WIN64
+  __ LoadAddress(rcx, ExternalReference::isolate_address());
+#else
+  __ LoadAddress(rdi, ExternalReference::isolate_address());
+#endif
+ __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);

   // Convert 32 random bits in rax to 0.(32 random bits) in a double
   // by computing:
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Thu Mar 24 06:01:16 2011 +++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Wed Mar 30 11:05:16 2011
@@ -2851,9 +2851,6 @@
   ASSERT(frame_alignment != 0);
   ASSERT(num_arguments >= 0);

- // Reserve space for Isolate address which is always passed as last parameter
-  num_arguments += 1;
-
// Make stack end at alignment and allocate space for arguments and old rsp.
   movq(kScratchRegister, rsp);
   ASSERT(IsPowerOf2(frame_alignment));
@@ -2873,26 +2870,6 @@


 void MacroAssembler::CallCFunction(Register function, int num_arguments) {
-  // Pass current isolate address as additional parameter.
-  if (num_arguments < kRegisterPassedArguments) {
-#ifdef _WIN64
-    // First four arguments are passed in registers on Windows.
-    Register arg_to_reg[] = {rcx, rdx, r8, r9};
-#else
-    // First six arguments are passed in registers on other platforms.
-    Register arg_to_reg[] = {rdi, rsi, rdx, rcx, r8, r9};
-#endif
-    Register reg = arg_to_reg[num_arguments];
-    LoadAddress(reg, ExternalReference::isolate_address());
-  } else {
-    // Push Isolate pointer after all parameters.
-    int argument_slots_on_stack =
-        ArgumentStackSlotsForCFunctionCall(num_arguments);
-    LoadAddress(kScratchRegister, ExternalReference::isolate_address());
-    movq(Operand(rsp, argument_slots_on_stack * kPointerSize),
-         kScratchRegister);
-  }
-
   // Check stack alignment.
   if (emit_debug_code()) {
     CheckStackAlignment();
@@ -2901,7 +2878,6 @@
   call(function);
   ASSERT(OS::ActivationFrameAlignment() != 0);
   ASSERT(num_arguments >= 0);
-  num_arguments += 1;
   int argument_slots_on_stack =
       ArgumentStackSlotsForCFunctionCall(num_arguments);
   movq(rsp, Operand(rsp, argument_slots_on_stack * kPointerSize));
=======================================
--- /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Tue Mar 29 00:53:33 2011 +++ /branches/bleeding_edge/src/x64/regexp-macro-assembler-x64.cc Wed Mar 30 11:05:16 2011
@@ -402,13 +402,14 @@
 #endif
     __ push(backtrack_stackpointer());

-    static const int num_arguments = 3;
+    static const int num_arguments = 4;
     __ PrepareCallCFunction(num_arguments);

     // Put arguments into parameter registers. Parameters are
     //   Address byte_offset1 - Address captured substring's start.
     //   Address byte_offset2 - Address of current character position.
     //   size_t byte_length - length of capture in bytes(!)
+    //   Isolate* isolate
 #ifdef _WIN64
     // Compute and set byte_offset1 (start of capture).
     __ lea(rcx, Operand(rsi, rdx, times_1, 0));
@@ -416,6 +417,8 @@
     __ lea(rdx, Operand(rsi, rdi, times_1, 0));
     // Set byte_length.
     __ movq(r8, rbx);
+    // Isolate.
+    __ LoadAddress(r9, ExternalReference::isolate_address());
 #else  // AMD64 calling convention
     // Compute byte_offset2 (current position = rsi+rdi).
     __ lea(rax, Operand(rsi, rdi, times_1, 0));
@@ -425,6 +428,8 @@
     __ movq(rsi, rax);
     // Set byte_length.
     __ movq(rdx, rbx);
+    // Isolate.
+    __ LoadAddress(rcx, ExternalReference::isolate_address());
 #endif
     ExternalReference compare =
ExternalReference::re_case_insensitive_compare_uc16(masm_.isolate());
@@ -919,16 +924,18 @@
 #endif

     // Call GrowStack(backtrack_stackpointer())
-    static const int num_arguments = 2;
+    static const int num_arguments = 3;
     __ PrepareCallCFunction(num_arguments);
 #ifdef _WIN64
-    // Microsoft passes parameters in rcx, rdx.
+    // Microsoft passes parameters in rcx, rdx, r8.
     // First argument, backtrack stackpointer, is already in rcx.
     __ lea(rdx, Operand(rbp, kStackHighEnd));  // Second argument
+    __ LoadAddress(r8, ExternalReference::isolate_address());
 #else
-    // AMD64 ABI passes parameters in rdi, rsi.
+    // AMD64 ABI passes parameters in rdi, rsi, rdx.
     __ movq(rdi, backtrack_stackpointer());   // First argument.
     __ lea(rsi, Operand(rbp, kStackHighEnd));  // Second argument.
+    __ LoadAddress(rdx, ExternalReference::isolate_address());
 #endif
     ExternalReference grow_stack =
         ExternalReference::re_grow_stack(masm_.isolate());

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to