Chromium Code Reviews| Index: src/ia32/code-stubs-ia32.cc |
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
| index 52f1d94e966752dbcd677be3eac7163f9e5257c8..1665d757e395c6446ec8e8801cf40c1b49ea5899 100644 |
| --- a/src/ia32/code-stubs-ia32.cc |
| +++ b/src/ia32/code-stubs-ia32.cc |
| @@ -5792,14 +5792,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); // ReturnValue |
|
Jakob Kummerow
2016/04/18 13:22:34
nit: comment is redundant (and contradictory) with
|
| + __ 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; |
| @@ -5809,9 +5829,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)); |
| @@ -5821,22 +5838,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::kGetterOffset)); |
|
jbramley
2016/04/18 14:46:54
For consistency, all platforms should use kJsGette
|
| + 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); |
| } |
| namespace { |