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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 1892533004: Change calling convention of CallApiGetterStub to accept the AccessorInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Importing mips patch from 1896963002 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 unified diff | Download patch
« no previous file with comments | « src/external-reference-table.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 5774 matching lines...) Expand 10 before | Expand all | Expand 10 after
5785 stack_space = argc() + FCA::kArgsLength + 1; 5785 stack_space = argc() + FCA::kArgsLength + 1;
5786 stack_space_operand = nullptr; 5786 stack_space_operand = nullptr;
5787 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5787 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5788 ApiParameterOperand(1), stack_space, 5788 ApiParameterOperand(1), stack_space,
5789 stack_space_operand, return_value_operand, 5789 stack_space_operand, return_value_operand,
5790 &context_restore_operand); 5790 &context_restore_operand);
5791 } 5791 }
5792 5792
5793 5793
5794 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5794 void CallApiGetterStub::Generate(MacroAssembler* masm) {
5795 // ----------- S t a t e ------------- 5795 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
5796 // -- esp[0] : return address 5796 // name below the exit frame to make GC aware of them.
5797 // -- esp[4] : name 5797 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
5798 // -- esp[8 .. (8 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_ 5798 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
5799 // -- ... 5799 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
5800 // -- edx : api_function_address 5800 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
5801 // ----------------------------------- 5801 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
5802 DCHECK(edx.is(ApiGetterDescriptor::function_address())); 5802 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
5803 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
5804 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
5805
5806 Register receiver = ApiGetterDescriptor::ReceiverRegister();
5807 Register holder = ApiGetterDescriptor::HolderRegister();
5808 Register callback = ApiGetterDescriptor::CallbackRegister();
5809 Register scratch = ebx;
5810 DCHECK(!AreAliased(receiver, holder, callback, scratch));
5811
5812 __ pop(scratch); // Pop return address to extend the frame.
5813 __ push(receiver);
5814 __ push(FieldOperand(callback, AccessorInfo::kDataOffset));
5815 __ PushRoot(Heap::kUndefinedValueRootIndex); // ReturnValue
5816 // ReturnValue default value
5817 __ PushRoot(Heap::kUndefinedValueRootIndex);
5818 __ push(Immediate(ExternalReference::isolate_address(isolate())));
5819 __ push(holder);
5820 __ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false
5821 __ push(FieldOperand(callback, AccessorInfo::kNameOffset));
5822 __ push(scratch); // Restore return address.
5803 5823
5804 // v8::PropertyCallbackInfo::args_ array and name handle. 5824 // v8::PropertyCallbackInfo::args_ array and name handle.
5805 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; 5825 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
5806 5826
5807 // Allocate v8::PropertyCallbackInfo object, arguments for callback and 5827 // Allocate v8::PropertyCallbackInfo object, arguments for callback and
5808 // space for optional callback address parameter (in case CPU profiler is 5828 // space for optional callback address parameter (in case CPU profiler is
5809 // active) in non-GCed stack space. 5829 // active) in non-GCed stack space.
5810 const int kApiArgc = 3 + 1; 5830 const int kApiArgc = 3 + 1;
5811 5831
5812 Register api_function_address = edx;
5813 Register scratch = ebx;
5814
5815 // Load address of v8::PropertyAccessorInfo::args_ array. 5832 // Load address of v8::PropertyAccessorInfo::args_ array.
5816 __ lea(scratch, Operand(esp, 2 * kPointerSize)); 5833 __ lea(scratch, Operand(esp, 2 * kPointerSize));
5817 5834
5818 PrepareCallApiFunction(masm, kApiArgc); 5835 PrepareCallApiFunction(masm, kApiArgc);
5819 // Create v8::PropertyCallbackInfo object on the stack and initialize 5836 // Create v8::PropertyCallbackInfo object on the stack and initialize
5820 // it's args_ field. 5837 // it's args_ field.
5821 Operand info_object = ApiParameterOperand(3); 5838 Operand info_object = ApiParameterOperand(3);
5822 __ mov(info_object, scratch); 5839 __ mov(info_object, scratch);
5823 5840
5841 // Name as handle.
5824 __ sub(scratch, Immediate(kPointerSize)); 5842 __ sub(scratch, Immediate(kPointerSize));
5825 __ mov(ApiParameterOperand(0), scratch); // name. 5843 __ mov(ApiParameterOperand(0), scratch);
5844 // Arguments pointer.
5826 __ lea(scratch, info_object); 5845 __ lea(scratch, info_object);
5827 __ mov(ApiParameterOperand(1), scratch); // arguments pointer. 5846 __ mov(ApiParameterOperand(1), scratch);
5828 // Reserve space for optional callback address parameter. 5847 // Reserve space for optional callback address parameter.
5829 Operand thunk_last_arg = ApiParameterOperand(2); 5848 Operand thunk_last_arg = ApiParameterOperand(2);
5830 5849
5831 ExternalReference thunk_ref = 5850 ExternalReference thunk_ref =
5832 ExternalReference::invoke_accessor_getter_callback(isolate()); 5851 ExternalReference::invoke_accessor_getter_callback(isolate());
5833 5852
5853 __ mov(scratch, FieldOperand(callback, AccessorInfo::kJsGetterOffset));
5854 Register function_address = edx;
5855 __ mov(function_address,
5856 FieldOperand(scratch, Foreign::kForeignAddressOffset));
5834 // +3 is to skip prolog, return address and name handle. 5857 // +3 is to skip prolog, return address and name handle.
5835 Operand return_value_operand( 5858 Operand return_value_operand(
5836 ebp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 5859 ebp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
5837 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5860 CallApiFunctionAndReturn(masm, function_address, thunk_ref, thunk_last_arg,
5838 thunk_last_arg, kStackUnwindSpace, nullptr, 5861 kStackUnwindSpace, nullptr, return_value_operand,
5839 return_value_operand, NULL); 5862 NULL);
5840 } 5863 }
5841 5864
5842 namespace { 5865 namespace {
5843 5866
5844 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store, 5867 void GetTypedArrayBackingStore(MacroAssembler* masm, Register backing_store,
5845 Register object, Register scratch) { 5868 Register object, Register scratch) {
5846 Label offset_is_not_smi, done; 5869 Label offset_is_not_smi, done;
5847 __ mov(scratch, FieldOperand(object, JSTypedArray::kBufferOffset)); 5870 __ mov(scratch, FieldOperand(object, JSTypedArray::kBufferOffset));
5848 __ mov(backing_store, 5871 __ mov(backing_store,
5849 FieldOperand(scratch, JSArrayBuffer::kBackingStoreOffset)); 5872 FieldOperand(scratch, JSArrayBuffer::kBackingStoreOffset));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
6008 TypedArrayJumpTableEpilogue(masm, &table, &i8, &u8, &i16, &u16, &i32, &u32, 6031 TypedArrayJumpTableEpilogue(masm, &table, &i8, &u8, &i16, &u16, &i32, &u32,
6009 &u8); 6032 &u8);
6010 } 6033 }
6011 6034
6012 #undef __ 6035 #undef __
6013 6036
6014 } // namespace internal 6037 } // namespace internal
6015 } // namespace v8 6038 } // namespace v8
6016 6039
6017 #endif // V8_TARGET_ARCH_IA32 6040 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/external-reference-table.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698