Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 6308b346eb935e338be26e11dd9f7950f93924dc..b860e3eb4d048fed6da45ecb18f67584f652287b 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -842,27 +842,25 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
int argc, |
bool restore_context) { |
// ----------- S t a t e ------------- |
- // -- sp[0] : context |
- // -- sp[4] : holder (set by CheckPrototypes) |
- // -- sp[8] : callee JS function |
- // -- sp[12] : call data |
- // -- sp[16] : isolate |
- // -- sp[20] : ReturnValue default value |
- // -- sp[24] : ReturnValue |
+ // -- sp[0] - sp[24] : FunctionCallbackInfo, incl. |
+ // : holder (set by CheckPrototypes) |
// -- sp[28] : last JS argument |
// -- ... |
// -- sp[(argc + 6) * 4] : first JS argument |
// -- sp[(argc + 7) * 4] : receiver |
// ----------------------------------- |
+ typedef FunctionCallbackArguments FCA; |
+ const int kArgs = kFastApiCallArguments; |
// Save calling context. |
- __ str(cp, MemOperand(sp)); |
+ __ str(cp, |
+ MemOperand(sp, (kArgs - 1 + FCA::kContextSaveIndex) * kPointerSize)); |
// Get the function and setup the context. |
Handle<JSFunction> function = optimization.constant_function(); |
__ LoadHeapObject(r5, function); |
__ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); |
- __ str(r5, MemOperand(sp, 2 * kPointerSize)); |
+ __ str(r5, MemOperand(sp, (kArgs - 1 + FCA::kCalleeIndex) * kPointerSize)); |
- // Pass the additional arguments. |
+ // Construct the FunctionCallbackInfo. |
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)) { |
@@ -872,17 +870,21 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
__ Move(r6, call_data); |
} |
// Store call data. |
- __ str(r6, MemOperand(sp, 3 * kPointerSize)); |
+ __ str(r6, MemOperand(sp, (kArgs - 1 + FCA::kDataIndex) * kPointerSize)); |
// Store isolate. |
__ mov(r5, Operand(ExternalReference::isolate_address(masm->isolate()))); |
- __ str(r5, MemOperand(sp, 4 * kPointerSize)); |
+ __ str(r5, MemOperand(sp, (kArgs - 1 + FCA::kIsolateIndex) * kPointerSize)); |
// Store ReturnValue default and ReturnValue. |
__ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
- __ str(r5, MemOperand(sp, 5 * kPointerSize)); |
- __ str(r5, MemOperand(sp, 6 * kPointerSize)); |
+ __ str(r5, |
+ MemOperand(sp, (kArgs - 1 + FCA::kReturnValueOffset) * kPointerSize)); |
+ __ str( |
+ r5, |
+ MemOperand( |
+ sp, (kArgs - 1 + FCA::kReturnValueDefaultValueIndex) * kPointerSize)); |
// Prepare arguments. |
- __ add(r2, sp, Operand((kFastApiCallArguments - 1) * kPointerSize)); |
+ __ add(r2, sp, Operand((kArgs - 1) * kPointerSize)); |
// Allocate the v8::Arguments structure in the arguments' space since |
// it's not controlled by GC. |
@@ -906,7 +908,7 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
__ mov(ip, Operand::Zero()); |
__ str(ip, MemOperand(r0, 3 * kPointerSize)); |
- const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; |
+ const int kStackUnwindSpace = argc + kArgs + 1; |
Address function_address = v8::ToCData<Address>(api_call_info->callback()); |
ApiFunction fun(function_address); |
ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; |
@@ -921,9 +923,9 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm, |
AllowExternalCallThatCantCauseGC scope(masm); |
MemOperand context_restore_operand( |
- fp, 2 * kPointerSize); |
+ fp, (kArgs + 1 + FCA::kContextSaveIndex) * kPointerSize); |
MemOperand return_value_operand( |
- fp, (kFastApiCallArguments + 1) * kPointerSize); |
+ fp, (kArgs + 1 + FCA::kReturnValueOffset) * kPointerSize); |
__ CallApiFunctionAndReturn(ref, |
function_address, |
thunk_ref, |