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

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

Issue 1910253005: [api] Expose FunctionCallbackInfo::NewTarget (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a TODO Created 4 years, 7 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/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('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 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 5784 matching lines...) Expand 10 before | Expand all | Expand 10 after
5795 5795
5796 typedef FunctionCallbackArguments FCA; 5796 typedef FunctionCallbackArguments FCA;
5797 5797
5798 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5798 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5799 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5799 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5800 STATIC_ASSERT(FCA::kDataIndex == 4); 5800 STATIC_ASSERT(FCA::kDataIndex == 4);
5801 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5801 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5802 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5802 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5803 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5803 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5804 STATIC_ASSERT(FCA::kHolderIndex == 0); 5804 STATIC_ASSERT(FCA::kHolderIndex == 0);
5805 STATIC_ASSERT(FCA::kArgsLength == 7); 5805 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
5806 STATIC_ASSERT(FCA::kArgsLength == 8);
5806 5807
5807 // FunctionCallbackArguments: context, callee and call data. 5808 // FunctionCallbackArguments
5809
5810 // new target
5811 __ PushRoot(Heap::kUndefinedValueRootIndex);
5812
5813 // context, callee and call data.
5808 __ Push(context, callee, call_data); 5814 __ Push(context, callee, call_data);
5809 5815
5810 if (!is_lazy()) { 5816 if (!is_lazy()) {
5811 // Load context from callee 5817 // Load context from callee
5812 __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset)); 5818 __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
5813 } 5819 }
5814 5820
5815 if (!call_data_undefined()) { 5821 if (!call_data_undefined()) {
5816 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 5822 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
5817 } 5823 }
5818 Register isolate_reg = x5; 5824 Register isolate_reg = x5;
5819 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate())); 5825 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate()));
5820 5826
5821 // FunctionCallbackArguments: 5827 // FunctionCallbackArguments:
5822 // return value, return value default, isolate, holder. 5828 // return value, return value default, isolate, holder.
5823 __ Push(call_data, call_data, isolate_reg, holder); 5829 __ Push(call_data, call_data, isolate_reg, holder);
5824 5830
5825 // Prepare arguments. 5831 // Prepare arguments.
5826 Register args = x6; 5832 Register args = x6;
5827 __ Mov(args, masm->StackPointer()); 5833 __ Mov(args, masm->StackPointer());
5828 5834
5829 // Allocate the v8::Arguments structure in the arguments' space, since it's 5835 // Allocate the v8::Arguments structure in the arguments' space, since it's
5830 // not controlled by GC. 5836 // not controlled by GC.
5831 const int kApiStackSpace = 4; 5837 const int kApiStackSpace = 3;
5832 5838
5833 // Allocate space for CallApiFunctionAndReturn can store some scratch 5839 // Allocate space for CallApiFunctionAndReturn can store some scratch
5834 // registeres on the stack. 5840 // registeres on the stack.
5835 const int kCallApiFunctionSpillSpace = 4; 5841 const int kCallApiFunctionSpillSpace = 4;
5836 5842
5837 FrameScope frame_scope(masm, StackFrame::MANUAL); 5843 FrameScope frame_scope(masm, StackFrame::MANUAL);
5838 __ EnterExitFrame(false, x10, kApiStackSpace + kCallApiFunctionSpillSpace); 5844 __ EnterExitFrame(false, x10, kApiStackSpace + kCallApiFunctionSpillSpace);
5839 5845
5840 DCHECK(!AreAliased(x0, api_function_address)); 5846 DCHECK(!AreAliased(x0, api_function_address));
5841 // x0 = FunctionCallbackInfo& 5847 // x0 = FunctionCallbackInfo&
5842 // Arguments is after the return address. 5848 // Arguments is after the return address.
5843 __ Add(x0, masm->StackPointer(), 1 * kPointerSize); 5849 __ Add(x0, masm->StackPointer(), 1 * kPointerSize);
5844 // FunctionCallbackInfo::implicit_args_ and FunctionCallbackInfo::values_ 5850 // FunctionCallbackInfo::implicit_args_ and FunctionCallbackInfo::values_
5845 __ Add(x10, args, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); 5851 __ Add(x10, args, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize));
5846 __ Stp(args, x10, MemOperand(x0, 0 * kPointerSize)); 5852 __ Stp(args, x10, MemOperand(x0, 0 * kPointerSize));
5847 // FunctionCallbackInfo::length_ = argc and 5853 // FunctionCallbackInfo::length_ = argc
5848 // FunctionCallbackInfo::is_construct_call = 0
5849 __ Mov(x10, argc()); 5854 __ Mov(x10, argc());
5850 __ Stp(x10, xzr, MemOperand(x0, 2 * kPointerSize)); 5855 __ Str(x10, MemOperand(x0, 2 * kPointerSize));
5851 5856
5852 ExternalReference thunk_ref = 5857 ExternalReference thunk_ref =
5853 ExternalReference::invoke_function_callback(masm->isolate()); 5858 ExternalReference::invoke_function_callback(masm->isolate());
5854 5859
5855 AllowExternalCallThatCantCauseGC scope(masm); 5860 AllowExternalCallThatCantCauseGC scope(masm);
5856 MemOperand context_restore_operand( 5861 MemOperand context_restore_operand(
5857 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5862 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5858 // Stores return the first js argument 5863 // Stores return the first js argument
5859 int return_value_offset = 0; 5864 int return_value_offset = 0;
5860 if (is_store()) { 5865 if (is_store()) {
5861 return_value_offset = 2 + FCA::kArgsLength; 5866 return_value_offset = 2 + FCA::kArgsLength;
5862 } else { 5867 } else {
5863 return_value_offset = 2 + FCA::kReturnValueOffset; 5868 return_value_offset = 2 + FCA::kReturnValueOffset;
5864 } 5869 }
5865 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 5870 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
5866 int stack_space = 0; 5871 int stack_space = 0;
5867 MemOperand is_construct_call_operand = 5872 MemOperand length_operand =
5868 MemOperand(masm->StackPointer(), 4 * kPointerSize); 5873 MemOperand(masm->StackPointer(), 3 * kPointerSize);
5869 MemOperand* stack_space_operand = &is_construct_call_operand; 5874 MemOperand* stack_space_operand = &length_operand;
5870 stack_space = argc() + FCA::kArgsLength + 1; 5875 stack_space = argc() + FCA::kArgsLength + 1;
5871 stack_space_operand = NULL; 5876 stack_space_operand = NULL;
5872 5877
5873 const int spill_offset = 1 + kApiStackSpace; 5878 const int spill_offset = 1 + kApiStackSpace;
5874 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5879 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5875 stack_space_operand, spill_offset, 5880 stack_space_operand, spill_offset,
5876 return_value_operand, &context_restore_operand); 5881 return_value_operand, &context_restore_operand);
5877 } 5882 }
5878 5883
5879 5884
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
5945 kStackUnwindSpace, NULL, spill_offset, 5950 kStackUnwindSpace, NULL, spill_offset,
5946 return_value_operand, NULL); 5951 return_value_operand, NULL);
5947 } 5952 }
5948 5953
5949 #undef __ 5954 #undef __
5950 5955
5951 } // namespace internal 5956 } // namespace internal
5952 } // namespace v8 5957 } // namespace v8
5953 5958
5954 #endif // V8_TARGET_ARCH_ARM64 5959 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698