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

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

Issue 1897823005: X87: 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/ic/x87/handler-compiler-x87.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index 76fb1e229ba3d680d462991521691880b5780f26..b2aabc41e7ec42b341d787ffe837afd81c9d3f47 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -5460,14 +5460,34 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
void CallApiGetterStub::Generate(MacroAssembler* masm) {
- // ----------- S t a t e -------------
- // -- esp[0] : return address
- // -- esp[4] : name
- // -- esp[8 .. (8 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_
- // -- ...
- // -- edx : api_function_address
- // -----------------------------------
- DCHECK(edx.is(ApiGetterDescriptor::function_address()));
+ // 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);
+
+ Register receiver = ApiGetterDescriptor::ReceiverRegister();
+ Register holder = ApiGetterDescriptor::HolderRegister();
+ Register callback = ApiGetterDescriptor::CallbackRegister();
+ Register scratch = ebx;
+ DCHECK(!AreAliased(receiver, holder, callback, scratch));
+
+ __ pop(scratch); // Pop return address to extend the frame.
+ __ push(receiver);
+ __ push(FieldOperand(callback, AccessorInfo::kDataOffset));
+ __ PushRoot(Heap::kUndefinedValueRootIndex); // ReturnValue
+ // ReturnValue default value
+ __ PushRoot(Heap::kUndefinedValueRootIndex);
+ __ push(Immediate(ExternalReference::isolate_address(isolate())));
+ __ push(holder);
+ __ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false
+ __ push(FieldOperand(callback, AccessorInfo::kNameOffset));
+ __ push(scratch); // Restore return address.
// v8::PropertyCallbackInfo::args_ array and name handle.
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
@@ -5477,9 +5497,6 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
// active) in non-GCed stack space.
const int kApiArgc = 3 + 1;
- Register api_function_address = edx;
- Register scratch = ebx;
-
// Load address of v8::PropertyAccessorInfo::args_ array.
__ lea(scratch, Operand(esp, 2 * kPointerSize));
@@ -5489,22 +5506,28 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
Operand info_object = ApiParameterOperand(3);
__ mov(info_object, scratch);
+ // Name as handle.
__ sub(scratch, Immediate(kPointerSize));
- __ mov(ApiParameterOperand(0), scratch); // name.
+ __ mov(ApiParameterOperand(0), scratch);
+ // Arguments pointer.
__ lea(scratch, info_object);
- __ mov(ApiParameterOperand(1), scratch); // arguments pointer.
+ __ mov(ApiParameterOperand(1), scratch);
// Reserve space for optional callback address parameter.
Operand thunk_last_arg = ApiParameterOperand(2);
ExternalReference thunk_ref =
ExternalReference::invoke_accessor_getter_callback(isolate());
+ __ mov(scratch, FieldOperand(callback, AccessorInfo::kJsGetterOffset));
+ Register function_address = edx;
+ __ mov(function_address,
+ FieldOperand(scratch, Foreign::kForeignAddressOffset));
// +3 is to skip prolog, return address and name handle.
Operand return_value_operand(
ebp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
- CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
- thunk_last_arg, kStackUnwindSpace, nullptr,
- return_value_operand, NULL);
+ CallApiFunctionAndReturn(masm, function_address, thunk_ref, thunk_last_arg,
+ kStackUnwindSpace, nullptr, return_value_operand,
+ NULL);
}
#undef __
« no previous file with comments | « src/ic/x87/handler-compiler-x87.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698