OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 5872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5883 stack_space_operand = NULL; | 5883 stack_space_operand = NULL; |
5884 | 5884 |
5885 const int spill_offset = 1 + kApiStackSpace; | 5885 const int spill_offset = 1 + kApiStackSpace; |
5886 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 5886 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
5887 stack_space_operand, spill_offset, | 5887 stack_space_operand, spill_offset, |
5888 return_value_operand, &context_restore_operand); | 5888 return_value_operand, &context_restore_operand); |
5889 } | 5889 } |
5890 | 5890 |
5891 | 5891 |
5892 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5892 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
5893 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 5893 // ----------- S t a t e ------------- |
5894 // name below the exit frame to make GC aware of them. | 5894 // -- sp[0] : name |
5895 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 5895 // -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_ |
5896 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); | 5896 // -- ... |
5897 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); | 5897 // -- x2 : api_function_address |
5898 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); | 5898 // ----------------------------------- |
5899 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); | |
5900 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); | |
5901 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); | |
5902 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); | |
5903 | 5899 |
5904 Register receiver = ApiGetterDescriptor::ReceiverRegister(); | 5900 Register api_function_address = ApiGetterDescriptor::function_address(); |
5905 Register holder = ApiGetterDescriptor::HolderRegister(); | 5901 DCHECK(api_function_address.is(x2)); |
5906 Register callback = ApiGetterDescriptor::CallbackRegister(); | |
5907 Register scratch = x4; | |
5908 Register scratch2 = x5; | |
5909 Register scratch3 = x6; | |
5910 DCHECK(!AreAliased(receiver, holder, callback, scratch)); | |
5911 | |
5912 __ Push(receiver); | |
5913 | |
5914 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | |
5915 __ Mov(scratch2, Operand(ExternalReference::isolate_address(isolate()))); | |
5916 __ Ldr(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset)); | |
5917 __ Push(scratch3, scratch, scratch, scratch2, holder); | |
5918 __ Push(Smi::FromInt(0)); // should_throw_on_error -> false | |
5919 __ Ldr(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset)); | |
5920 __ Push(scratch); | |
5921 | 5902 |
5922 // v8::PropertyCallbackInfo::args_ array and name handle. | 5903 // v8::PropertyCallbackInfo::args_ array and name handle. |
5923 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5904 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
5924 | 5905 |
5925 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. | 5906 // Load address of v8::PropertyAccessorInfo::args_ array and name handle. |
5926 __ Mov(x0, masm->StackPointer()); // x0 = Handle<Name> | 5907 __ Mov(x0, masm->StackPointer()); // x0 = Handle<Name> |
5927 __ Add(x1, x0, 1 * kPointerSize); // x1 = v8::PCI::args_ | 5908 __ Add(x1, x0, 1 * kPointerSize); // x1 = v8::PCI::args_ |
5928 | 5909 |
5929 const int kApiStackSpace = 1; | 5910 const int kApiStackSpace = 1; |
5930 | 5911 |
5931 // Allocate space for CallApiFunctionAndReturn can store some scratch | 5912 // Allocate space for CallApiFunctionAndReturn can store some scratch |
5932 // registeres on the stack. | 5913 // registeres on the stack. |
5933 const int kCallApiFunctionSpillSpace = 4; | 5914 const int kCallApiFunctionSpillSpace = 4; |
5934 | 5915 |
5935 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5916 FrameScope frame_scope(masm, StackFrame::MANUAL); |
5936 __ EnterExitFrame(false, x10, kApiStackSpace + kCallApiFunctionSpillSpace); | 5917 __ EnterExitFrame(false, x10, kApiStackSpace + kCallApiFunctionSpillSpace); |
5937 | 5918 |
5938 // Create v8::PropertyCallbackInfo object on the stack and initialize | 5919 // Create v8::PropertyCallbackInfo object on the stack and initialize |
5939 // it's args_ field. | 5920 // it's args_ field. |
5940 __ Poke(x1, 1 * kPointerSize); | 5921 __ Poke(x1, 1 * kPointerSize); |
5941 __ Add(x1, masm->StackPointer(), 1 * kPointerSize); | 5922 __ Add(x1, masm->StackPointer(), 1 * kPointerSize); |
5942 // x1 = v8::PropertyCallbackInfo& | 5923 // x1 = v8::PropertyCallbackInfo& |
5943 | 5924 |
5944 ExternalReference thunk_ref = | 5925 ExternalReference thunk_ref = |
5945 ExternalReference::invoke_accessor_getter_callback(isolate()); | 5926 ExternalReference::invoke_accessor_getter_callback(isolate()); |
5946 | 5927 |
5947 Register api_function_address = x2; | |
5948 __ Ldr(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset)); | |
5949 __ Ldr(api_function_address, | |
5950 FieldMemOperand(scratch, Foreign::kForeignAddressOffset)); | |
5951 | |
5952 const int spill_offset = 1 + kApiStackSpace; | 5928 const int spill_offset = 1 + kApiStackSpace; |
5953 // +3 is to skip prolog, return address and name handle. | 5929 // +3 is to skip prolog, return address and name handle. |
5954 MemOperand return_value_operand( | 5930 MemOperand return_value_operand( |
5955 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5931 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5956 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5932 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5957 kStackUnwindSpace, NULL, spill_offset, | 5933 kStackUnwindSpace, NULL, spill_offset, |
5958 return_value_operand, NULL); | 5934 return_value_operand, NULL); |
5959 } | 5935 } |
5960 | 5936 |
5961 namespace { | 5937 namespace { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6096 __ Dmb(InnerShareable, BarrierAll); | 6072 __ Dmb(InnerShareable, BarrierAll); |
6097 ReturnUnsignedInteger32(masm, d0, x0, x1, x2); | 6073 ReturnUnsignedInteger32(masm, d0, x0, x1, x2); |
6098 } | 6074 } |
6099 | 6075 |
6100 #undef __ | 6076 #undef __ |
6101 | 6077 |
6102 } // namespace internal | 6078 } // namespace internal |
6103 } // namespace v8 | 6079 } // namespace v8 |
6104 | 6080 |
6105 #endif // V8_TARGET_ARCH_ARM64 | 6081 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |