Index: src/mips/stub-cache-mips.cc |
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc |
index 90ae404d25b27941c962415b53b3eae9e26d35d0..8df369e29bd61c11e738e3b7f13940ad3446393b 100644 |
--- a/src/mips/stub-cache-mips.cc |
+++ b/src/mips/stub-cache-mips.cc |
@@ -842,8 +842,7 @@ static void CompileCallLoadPropertyWithInterceptor( |
} |
-static const int kFastApiCallArguments = 4; |
- |
+static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; |
// Reserves space for the extra arguments to API function in the |
// caller's frame. |
@@ -872,10 +871,11 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
// -- sp[4] : callee JS function |
// -- sp[8] : call data |
// -- sp[12] : isolate |
- // -- sp[16] : last JS argument |
+ // -- sp[16] : ReturnValue |
+ // -- sp[20] : last JS argument |
// -- ... |
- // -- sp[(argc + 3) * 4] : first JS argument |
- // -- sp[(argc + 4) * 4] : receiver |
+ // -- sp[(argc + 4) * 4] : first JS argument |
+ // -- sp[(argc + 5) * 4] : receiver |
// ----------------------------------- |
// Get the function and setup the context. |
Handle<JSFunction> function = optimization.constant_function(); |
@@ -893,13 +893,15 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
} |
__ li(t3, Operand(ExternalReference::isolate_address(masm->isolate()))); |
- // Store JS function, call data and isolate. |
+ // Store JS function, call data, isolate and ReturnValue. |
__ sw(t1, MemOperand(sp, 1 * kPointerSize)); |
__ sw(t2, MemOperand(sp, 2 * kPointerSize)); |
__ sw(t3, MemOperand(sp, 3 * kPointerSize)); |
+ __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); |
+ __ sw(t1, MemOperand(sp, 4 * kPointerSize)); |
// Prepare arguments. |
- __ Addu(a2, sp, Operand(3 * kPointerSize)); |
+ __ Addu(a2, sp, Operand(4 * kPointerSize)); |
// Allocate the v8::Arguments structure in the arguments' space since |
// it's not controlled by GC. |
@@ -930,13 +932,18 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; |
Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
+ bool returns_handle = |
+ !CallbackTable::ReturnsVoid(masm->isolate(), function_address); |
ApiFunction fun(function_address); |
ExternalReference ref = |
ExternalReference(&fun, |
ExternalReference::DIRECT_API_CALL, |
masm->isolate()); |
AllowExternalCallThatCantCauseGC scope(masm); |
- __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); |
+ __ CallApiFunctionAndReturn(ref, |
+ kStackUnwindSpace, |
+ returns_handle, |
+ kFastApiCallArguments + 1); |
} |
class CallInterceptorCompiler BASE_EMBEDDED { |
@@ -1410,12 +1417,14 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
} else { |
__ li(scratch3(), Handle<Object>(callback->data(), isolate())); |
} |
- __ Subu(sp, sp, 4 * kPointerSize); |
- __ sw(reg, MemOperand(sp, 3 * kPointerSize)); |
- __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); |
+ __ Subu(sp, sp, 5 * kPointerSize); |
+ __ sw(reg, MemOperand(sp, 4 * kPointerSize)); |
+ __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); |
__ li(scratch3(), |
Operand(ExternalReference::isolate_address(isolate()))); |
- __ sw(scratch3(), MemOperand(sp, 1 * kPointerSize)); |
+ __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); |
+ __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); |
+ __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); |
__ sw(name(), MemOperand(sp, 0 * kPointerSize)); |
__ mov(a2, scratch2()); // Saved in case scratch2 == a1. |
@@ -1436,12 +1445,17 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
// a2 (second argument - see note above) = AccessorInfo& |
__ Addu(a2, sp, kPointerSize); |
- const int kStackUnwindSpace = 5; |
+ const int kStackUnwindSpace = kFastApiCallArguments + 1; |
Address getter_address = v8::ToCData<Address>(callback->getter()); |
+ bool returns_handle = |
+ !CallbackTable::ReturnsVoid(isolate(), getter_address); |
ApiFunction fun(getter_address); |
ExternalReference ref = ExternalReference( |
&fun, ExternalReference::DIRECT_GETTER_CALL, isolate()); |
- __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); |
+ __ CallApiFunctionAndReturn(ref, |
+ kStackUnwindSpace, |
+ returns_handle, |
+ 3); |
} |