Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index a44beec299a39ce120f929ea22d323f913afc274..589b85d35aad4e8b69d51ced8acd6f3ec21f404a 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -418,7 +418,7 @@ static void CompileCallLoadPropertyWithInterceptor( |
// Number of pointers to be reserved on stack for fast API call. |
-static const int kFastApiCallArguments = 4; |
+static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; |
// Reserves space for the extra arguments to API function in the |
@@ -467,10 +467,11 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
// (first fast api call extra argument) |
// -- esp[12] : api call data |
// -- esp[16] : isolate |
- // -- esp[20] : last argument |
+ // -- esp[20] : ReturnValue |
+ // -- esp[24] : last argument |
// -- ... |
- // -- esp[(argc + 4) * 4] : first argument |
- // -- esp[(argc + 5) * 4] : receiver |
+ // -- esp[(argc + 5) * 4] : first argument |
+ // -- esp[(argc + 6) * 4] : receiver |
// ----------------------------------- |
// Get the function and setup the context. |
Handle<JSFunction> function = optimization.constant_function(); |
@@ -490,9 +491,12 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
} |
__ mov(Operand(esp, 4 * kPointerSize), |
Immediate(reinterpret_cast<int>(masm->isolate()))); |
+ __ mov(Operand(esp, 5 * kPointerSize), |
+ masm->isolate()->factory()->undefined_value()); |
// Prepare arguments. |
- __ lea(eax, Operand(esp, 4 * kPointerSize)); |
+ STATIC_ASSERT(kFastApiCallArguments == 5); |
+ __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); |
const int kApiArgc = 1; // API function gets reference to the v8::Arguments. |
@@ -516,7 +520,8 @@ static void GenerateFastApiCall(MacroAssembler* masm, |
// Function address is a foreign pointer outside V8's heap. |
Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
__ CallApiFunctionAndReturn(function_address, |
- argc + kFastApiCallArguments + 1); |
+ argc + kFastApiCallArguments + 1, |
+ 16); // TODO(dcarney): compute this somehow |
} |
@@ -1223,6 +1228,7 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
__ push(Immediate(Handle<Object>(callback->data(), isolate()))); |
} |
__ push(Immediate(reinterpret_cast<int>(isolate()))); |
+ __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
// Save a pointer to where we pushed the arguments pointer. This will be |
// passed as the const ExecutableAccessorInfo& to the C++ callback. |
@@ -1233,9 +1239,9 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
__ push(scratch3()); // Restore return address. |
- // 4 elements array for v8::Arguments::values_, handler for name and pointer |
+ // array for v8::Arguments::values_, handler for name and pointer |
// to the values (it considered as smi in GC). |
- const int kStackSpace = 6; |
+ const int kStackSpace = PropertyCallbackArguments::kArgsLength + 2; |
const int kApiArgc = 2; |
__ PrepareCallApiFunction(kApiArgc); |
@@ -1248,7 +1254,9 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
// garbage collection but instead return the allocation failure |
// object. |
Address getter_address = v8::ToCData<Address>(callback->getter()); |
- __ CallApiFunctionAndReturn(getter_address, kStackSpace); |
+ __ CallApiFunctionAndReturn(getter_address, |
+ kStackSpace, |
+ 8); // TODO(dcarney): compute this somehow |
} |
@@ -2349,7 +2357,7 @@ Handle<Code> CallStubCompiler::CompileFastApiCall( |
name, depth, &miss); |
// Move the return address on top of the stack. |
- __ mov(eax, Operand(esp, 4 * kPointerSize)); |
+ __ mov(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); |
__ mov(Operand(esp, 0 * kPointerSize), eax); |
// esp[2 * kPointerSize] is uninitialized, esp[3 * kPointerSize] contains |