Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 757c58f90753242a51f988c61507f31f587a2e49..1e20da3117c5242439c09daabfa0f3e4c022bc82 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -5274,6 +5274,66 @@ void CallApiFunctionStub::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 |
+ // -- ... |
+ // -- r8 : api_function_address |
+ // ----------------------------------- |
+ |
+#if defined(__MINGW64__) || defined(_WIN64) |
+ Register getter_arg = r8; |
+ Register accessor_info_arg = rdx; |
+ Register name_arg = rcx; |
+#else |
+ Register getter_arg = rdx; |
+ Register accessor_info_arg = rsi; |
+ Register name_arg = rdi; |
+#endif |
+ Register api_function_address = r8; |
+ Register scratch = rax; |
+ |
+ // v8::Arguments::values_ and handler for name. |
+ const int kStackSpace = PropertyCallbackArguments::kArgsLength + 1; |
+ |
+ // Allocate v8::AccessorInfo in non-GCed stack space. |
+ const int kArgStackSpace = 1; |
+ |
+ __ lea(name_arg, Operand(rsp, 1 * kPointerSize)); |
+ |
+ __ PrepareCallApiFunction(kArgStackSpace); |
+ __ lea(scratch, Operand(name_arg, 1 * kPointerSize)); |
+ |
+ // v8::PropertyAccessorInfo::args_. |
+ __ movp(StackSpaceOperand(0), scratch); |
+ |
+ // The context register (rsi) has been saved in PrepareCallApiFunction and |
+ // could be used to pass arguments. |
+ __ lea(accessor_info_arg, StackSpaceOperand(0)); |
+ |
+ Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
+ |
+ // It's okay if api_function_address == getter_arg |
+ // but not accessor_info_arg or name_arg |
+ ASSERT(!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); |
+ __ CallApiFunctionAndReturn(api_function_address, |
+ thunk_address, |
+ getter_arg, |
+ kStackSpace, |
+ return_value_operand, |
+ NULL); |
+} |
+ |
+ |
#undef __ |
} } // namespace v8::internal |