Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index d339da92c489141f1fb9baf8a1acdef69d613c54..eb26477c5db38c658689b6a2b2c871e5d8405a82 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -462,51 +462,48 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
bool restore_context) { |
// ----------- S t a t e ------------- |
// -- esp[0] : return address |
- // -- esp[4] : context |
- // -- esp[8] : object passing the type check |
- // (last fast api call extra argument, |
- // set by CheckPrototypes) |
- // -- esp[12] : api function |
- // (first fast api call extra argument) |
- // -- esp[16] : api call data |
- // -- esp[20] : isolate |
- // -- esp[24] : ReturnValue default value |
- // -- esp[28] : ReturnValue |
+ // -- esp[4] - esp[28] : FunctionCallbackInfo, incl. |
+ // : object passing the type check |
+ // (set by CheckPrototypes) |
// -- esp[32] : last argument |
// -- ... |
// -- esp[(argc + 7) * 4] : first argument |
// -- esp[(argc + 8) * 4] : receiver |
// ----------------------------------- |
+ typedef FunctionCallbackArguments FCA; |
+ const int kArgs = kFastApiCallArguments; |
// Save calling context. |
- __ mov(Operand(esp, kPointerSize), esi); |
+ __ mov(Operand(esp, (kArgs + FCA::kContextSaveIndex) * kPointerSize), esi); |
// Get the function and setup the context. |
Handle<JSFunction> function = optimization.constant_function(); |
__ LoadHeapObject(edi, function); |
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
- // Pass the additional arguments. |
- __ mov(Operand(esp, 3 * kPointerSize), edi); |
+ // Construct the FunctionCallbackInfo. |
+ __ mov(Operand(esp, (kArgs + FCA::kCalleeIndex) * kPointerSize), edi); |
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
__ mov(ecx, api_call_info); |
__ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset)); |
- __ mov(Operand(esp, 4 * kPointerSize), ebx); |
+ __ mov(Operand(esp, (kArgs + FCA::kDataIndex) * kPointerSize), ebx); |
} else { |
- __ mov(Operand(esp, 4 * kPointerSize), Immediate(call_data)); |
+ __ mov(Operand(esp, (kArgs + FCA::kDataIndex) * kPointerSize), |
+ Immediate(call_data)); |
} |
- __ mov(Operand(esp, 5 * kPointerSize), |
+ __ mov(Operand(esp, (kArgs + FCA::kIsolateIndex) * kPointerSize), |
Immediate(reinterpret_cast<int>(masm->isolate()))); |
- __ mov(Operand(esp, 6 * kPointerSize), |
- masm->isolate()->factory()->undefined_value()); |
- __ mov(Operand(esp, 7 * kPointerSize), |
+ __ mov(Operand(esp, (kArgs + FCA::kReturnValueOffset) * kPointerSize), |
masm->isolate()->factory()->undefined_value()); |
+ __ mov( |
+ Operand(esp, (kArgs + FCA::kReturnValueDefaultValueIndex) * kPointerSize), |
+ masm->isolate()->factory()->undefined_value()); |
// Prepare arguments. |
- STATIC_ASSERT(kFastApiCallArguments == 7); |
- __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); |
+ STATIC_ASSERT(kArgs == 7); |
+ __ lea(eax, Operand(esp, kArgs * kPointerSize)); |
// API function gets reference to the v8::Arguments. If CPU profiler |
@@ -539,13 +536,14 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); |
- Operand context_restore_operand(ebp, 2 * kPointerSize); |
+ Operand context_restore_operand( |
+ ebp, (kArgs + 1 + FCA::kContextSaveIndex) * kPointerSize); |
Operand return_value_operand( |
- ebp, (kFastApiCallArguments + 1) * kPointerSize); |
+ ebp, (kArgs + 1 + FCA::kReturnValueOffset) * kPointerSize); |
__ CallApiFunctionAndReturn(function_address, |
thunk_address, |
ApiParameterOperand(1), |
- argc + kFastApiCallArguments + 1, |
+ argc + kArgs + 1, |
return_value_operand, |
restore_context ? |
&context_restore_operand : NULL); |