Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 81fa29b911a0eea55090215bf75df2b6356cb7a6..b754e16dc7dde94ec1a654d7c56eff3a9fe6a6ce 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -5507,14 +5507,6 @@ |
void CallApiGetterStub::Generate(MacroAssembler* masm) { |
- // ----------- S t a t e ------------- |
- // -- rsp[0] : return address |
- // -- rsp[8] : name |
- // -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ |
- // -- ... |
- // -- r8 : api_function_address |
- // ----------------------------------- |
- |
#if defined(__MINGW64__) || defined(_WIN64) |
Register getter_arg = r8; |
Register accessor_info_arg = rdx; |
@@ -5524,9 +5516,36 @@ |
Register accessor_info_arg = rsi; |
Register name_arg = rdi; |
#endif |
- Register api_function_address = ApiGetterDescriptor::function_address(); |
- DCHECK(api_function_address.is(r8)); |
+ Register api_function_address = r8; |
+ Register receiver = ApiGetterDescriptor::ReceiverRegister(); |
+ Register holder = ApiGetterDescriptor::HolderRegister(); |
+ Register callback = ApiGetterDescriptor::CallbackRegister(); |
Register scratch = rax; |
+ DCHECK(!AreAliased(receiver, holder, callback, scratch)); |
+ |
+ // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
+ // name below the exit frame to make GC aware of them. |
+ STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
+ STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
+ STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
+ STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
+ STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
+ STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
+ STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
+ |
+ // Insert additional parameters into the stack frame above return address. |
+ __ PopReturnAddressTo(scratch); |
+ __ Push(receiver); |
+ __ Push(FieldOperand(callback, AccessorInfo::kDataOffset)); |
+ __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
+ __ Push(kScratchRegister); // return value |
+ __ Push(kScratchRegister); // return value default |
+ __ PushAddress(ExternalReference::isolate_address(isolate())); |
+ __ Push(holder); |
+ __ Push(Smi::FromInt(0)); // should_throw_on_error -> false |
+ __ Push(FieldOperand(callback, AccessorInfo::kNameOffset)); |
+ __ PushReturnAddressFrom(scratch); |
// v8::PropertyCallbackInfo::args_ array and name handle. |
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
@@ -5553,8 +5572,11 @@ |
// It's okay if api_function_address == getter_arg |
// but not accessor_info_arg or name_arg |
- DCHECK(!api_function_address.is(accessor_info_arg) && |
- !api_function_address.is(name_arg)); |
+ DCHECK(!api_function_address.is(accessor_info_arg)); |
+ DCHECK(!api_function_address.is(name_arg)); |
+ __ movp(scratch, FieldOperand(callback, AccessorInfo::kJsGetterOffset)); |
+ __ movp(api_function_address, |
+ FieldOperand(scratch, Foreign::kForeignAddressOffset)); |
// +3 is to skip prolog, return address and name handle. |
Operand return_value_operand( |