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