Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 7f976940b5a2213e505c3af0005405d9efb1dc8b..476724335d2602159b4927def4f7c5c6da7adc68 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -5368,11 +5368,11 @@ void CallApiAccessorStub::Generate(MacroAssembler* masm) { |
void CallApiGetterStub::Generate(MacroAssembler* masm) { |
// ----------- S t a t e ------------- |
- // -- rsp[0] : return address |
- // -- rsp[8] : name |
- // -- rsp[16 - kArgsLength*8] : PropertyCallbackArguments object |
+ // -- rsp[0] : return address |
+ // -- rsp[8] : name |
+ // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ |
// -- ... |
- // -- r8 : api_function_address |
+ // -- r8 : api_function_address |
// ----------------------------------- |
#if defined(__MINGW64__) || defined(_WIN64) |
@@ -5388,23 +5388,25 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { |
DCHECK(api_function_address.is(r8)); |
Register scratch = rax; |
- // v8::Arguments::values_ and handler for name. |
- const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; |
+ // v8::PropertyCallbackInfo::args_ array and name handle. |
+ const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
- // Allocate v8::AccessorInfo in non-GCed stack space. |
+ // Allocate v8::PropertyCallbackInfo in non-GCed stack space. |
const int kArgStackSpace = 1; |
- __ leap(name_arg, Operand(rsp, kPCOnStackSize)); |
+ // Load address of v8::PropertyAccessorInfo::args_ array. |
+ __ leap(scratch, Operand(rsp, 2 * kPointerSize)); |
PrepareCallApiFunction(masm, kArgStackSpace); |
- __ leap(scratch, Operand(name_arg, 1 * kPointerSize)); |
- |
- // v8::PropertyAccessorInfo::args_. |
- __ movp(StackSpaceOperand(0), scratch); |
+ // Create v8::PropertyCallbackInfo object on the stack and initialize |
+ // it's args_ field. |
+ Operand info_object = StackSpaceOperand(0); |
+ __ movp(info_object, scratch); |
+ __ leap(name_arg, Operand(scratch, -kPointerSize)); |
// The context register (rsi) has been saved in PrepareCallApiFunction and |
// could be used to pass arguments. |
- __ leap(accessor_info_arg, StackSpaceOperand(0)); |
+ __ leap(accessor_info_arg, info_object); |
ExternalReference thunk_ref = |
ExternalReference::invoke_accessor_getter_callback(isolate()); |
@@ -5414,13 +5416,12 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) { |
DCHECK(!api_function_address.is(accessor_info_arg) && |
!api_function_address.is(name_arg)); |
- // The name handler is counted as an argument. |
- StackArgumentsAccessor args(rbp, PropertyCallbackArguments::kArgsLength); |
- Operand return_value_operand = args.GetArgumentOperand( |
- PropertyCallbackArguments::kArgsLength - 1 - |
- PropertyCallbackArguments::kReturnValueOffset); |
+ // +3 is to skip prolog, return address and name handle. |
+ Operand return_value_operand( |
+ rbp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, |
- kStackSpace, nullptr, return_value_operand, NULL); |
+ kStackUnwindSpace, nullptr, return_value_operand, |
+ NULL); |
} |