Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1543)

Unified Diff: src/x64/code-stubs-x64.cc

Issue 1903093003: Reland of Change calling convention of CallApiGetterStub to accept the AccessorInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-printer.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « src/objects-printer.cc ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698