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

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

Issue 2841913003: [WIP] Initial CallFunctionCallback builtin.
Patch Set: Fix wrong register for arm64. Created 3 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/arm/macro-assembler-arm.cc ('k') | src/arm64/macro-assembler-arm64.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/api-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/arm64/assembler-arm64-inl.h" 8 #include "src/arm64/assembler-arm64-inl.h"
9 #include "src/arm64/frames-arm64.h" 9 #include "src/arm64/frames-arm64.h"
10 #include "src/arm64/macro-assembler-arm64-inl.h" 10 #include "src/arm64/macro-assembler-arm64-inl.h"
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 __ Bind(&fast_elements_case); 2821 __ Bind(&fast_elements_case);
2822 GenerateCase(masm, FAST_ELEMENTS); 2822 GenerateCase(masm, FAST_ELEMENTS);
2823 } 2823 }
2824 2824
2825 // The number of register that CallApiFunctionAndReturn will need to save on 2825 // The number of register that CallApiFunctionAndReturn will need to save on
2826 // the stack. The space for these registers need to be allocated in the 2826 // the stack. The space for these registers need to be allocated in the
2827 // ExitFrame before calling CallApiFunctionAndReturn. 2827 // ExitFrame before calling CallApiFunctionAndReturn.
2828 static const int kCallApiFunctionSpillSpace = 4; 2828 static const int kCallApiFunctionSpillSpace = 4;
2829 2829
2830 2830
2831 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
2832 return static_cast<int>(ref0.address() - ref1.address());
2833 }
2834
2835
2836 // Calls an API function. Allocates HandleScope, extracts returned value 2831 // Calls an API function. Allocates HandleScope, extracts returned value
2837 // from handle and propagates exceptions. 2832 // from handle and propagates exceptions.
2838 // 'stack_space' is the space to be unwound on exit (includes the call JS 2833 // 'stack_space' is the space to be unwound on exit (includes the call JS
2839 // arguments space and the additional space allocated for the fast call). 2834 // arguments space and the additional space allocated for the fast call).
2840 // 'spill_offset' is the offset from the stack pointer where 2835 // 'spill_offset' is the offset from the stack pointer where
2841 // CallApiFunctionAndReturn can spill registers. 2836 // CallApiFunctionAndReturn can spill registers.
2842 static void CallApiFunctionAndReturn( 2837 static void CallApiFunctionAndReturn(
2843 MacroAssembler* masm, Register function_address, 2838 MacroAssembler* masm, Register function_address,
2844 ExternalReference thunk_ref, int stack_space, 2839 ExternalReference thunk_ref, int stack_space,
2845 MemOperand* stack_space_operand, int spill_offset, 2840 MemOperand* stack_space_operand, int spill_offset,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 } 2950 }
2956 2951
2957 __ LeaveExitFrame(false, x1, !restore_context); 2952 __ LeaveExitFrame(false, x1, !restore_context);
2958 2953
2959 // Check if the function scheduled an exception. 2954 // Check if the function scheduled an exception.
2960 __ Mov(x5, ExternalReference::scheduled_exception_address(isolate)); 2955 __ Mov(x5, ExternalReference::scheduled_exception_address(isolate));
2961 __ Ldr(x5, MemOperand(x5)); 2956 __ Ldr(x5, MemOperand(x5));
2962 __ JumpIfNotRoot(x5, Heap::kTheHoleValueRootIndex, 2957 __ JumpIfNotRoot(x5, Heap::kTheHoleValueRootIndex,
2963 &promote_scheduled_exception); 2958 &promote_scheduled_exception);
2964 2959
2960 // Check if the function returned a valid JavaScript value.
2961 __ AssertApiCallResult(x0);
2962
2965 if (stack_space_operand != NULL) { 2963 if (stack_space_operand != NULL) {
2966 __ Drop(x2, 1); 2964 __ Drop(x2, 1);
2967 } else { 2965 } else {
2968 __ Drop(stack_space); 2966 __ Drop(stack_space);
2969 } 2967 }
2970 __ Ret(); 2968 __ Ret();
2971 2969
2972 // Re-throw by promoting a scheduled exception. 2970 // Re-throw by promoting a scheduled exception.
2973 __ Bind(&promote_scheduled_exception); 2971 __ Bind(&promote_scheduled_exception);
2974 __ TailCallRuntime(Runtime::kPromoteScheduledException); 2972 __ TailCallRuntime(Runtime::kPromoteScheduledException);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3032 } 3030 }
3033 3031
3034 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex); 3032 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
3035 Register isolate_reg = x5; 3033 Register isolate_reg = x5;
3036 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate())); 3034 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate()));
3037 3035
3038 // FunctionCallbackArguments: 3036 // FunctionCallbackArguments:
3039 // return value, return value default, isolate, holder. 3037 // return value, return value default, isolate, holder.
3040 __ Push(call_data, call_data, isolate_reg, holder); 3038 __ Push(call_data, call_data, isolate_reg, holder);
3041 3039
3040 if (!is_store()) {
3041 __ Mov(x0, argc());
3042 __ Jump(masm->isolate()->builtins()->CallFunctionCallback(),
3043 RelocInfo::CODE_TARGET);
3044 }
3045
3042 // Prepare arguments. 3046 // Prepare arguments.
3043 Register args = x6; 3047 Register args = x6;
3044 __ Mov(args, masm->StackPointer()); 3048 __ Mov(args, masm->StackPointer());
3045 3049
3046 // Allocate the v8::Arguments structure in the arguments' space, since it's 3050 // Allocate the v8::Arguments structure in the arguments' space, since it's
3047 // not controlled by GC. 3051 // not controlled by GC.
3048 const int kApiStackSpace = 3; 3052 const int kApiStackSpace = 3;
3049 3053
3050 // Allocate space for CallApiFunctionAndReturn can store some scratch 3054 // Allocate space for CallApiFunctionAndReturn can store some scratch
3051 // registeres on the stack. 3055 // registeres on the stack.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 kStackUnwindSpace, NULL, spill_offset, 3165 kStackUnwindSpace, NULL, spill_offset,
3162 return_value_operand, NULL); 3166 return_value_operand, NULL);
3163 } 3167 }
3164 3168
3165 #undef __ 3169 #undef __
3166 3170
3167 } // namespace internal 3171 } // namespace internal
3168 } // namespace v8 3172 } // namespace v8
3169 3173
3170 #endif // V8_TARGET_ARCH_ARM64 3174 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/arm64/macro-assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698