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

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

Issue 2770003002: Set the current context to the function's context when entering to LAP. (Closed)
Patch Set: Synced. Created 3 years, 5 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/code-stubs-arm.cc ('k') | src/compiler/js-call-reducer.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 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 2923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 // -- x0 : callee 2934 // -- x0 : callee
2935 // -- x4 : call_data 2935 // -- x4 : call_data
2936 // -- x2 : holder 2936 // -- x2 : holder
2937 // -- x1 : api_function_address 2937 // -- x1 : api_function_address
2938 // -- cp : context 2938 // -- cp : context
2939 // -- 2939 // --
2940 // -- sp[0] : last argument 2940 // -- sp[0] : last argument
2941 // -- ... 2941 // -- ...
2942 // -- sp[(argc - 1) * 8] : first argument 2942 // -- sp[(argc - 1) * 8] : first argument
2943 // -- sp[argc * 8] : receiver 2943 // -- sp[argc * 8] : receiver
2944 // -- sp[(argc + 1) * 8] : accessor_holder
2944 // ----------------------------------- 2945 // -----------------------------------
2945 2946
2946 Register callee = x0; 2947 Register callee = x0;
2947 Register call_data = x4; 2948 Register call_data = x4;
2948 Register holder = x2; 2949 Register holder = x2;
2949 Register api_function_address = x1; 2950 Register api_function_address = x1;
2950 Register context = cp; 2951 Register context = cp;
2951 2952
2952 typedef FunctionCallbackArguments FCA; 2953 typedef FunctionCallbackArguments FCA;
2953 2954
2954 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 2955 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
2955 STATIC_ASSERT(FCA::kCalleeIndex == 5); 2956 STATIC_ASSERT(FCA::kCalleeIndex == 5);
2956 STATIC_ASSERT(FCA::kDataIndex == 4); 2957 STATIC_ASSERT(FCA::kDataIndex == 4);
2957 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 2958 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
2958 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 2959 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
2959 STATIC_ASSERT(FCA::kIsolateIndex == 1); 2960 STATIC_ASSERT(FCA::kIsolateIndex == 1);
2960 STATIC_ASSERT(FCA::kHolderIndex == 0); 2961 STATIC_ASSERT(FCA::kHolderIndex == 0);
2961 STATIC_ASSERT(FCA::kNewTargetIndex == 7); 2962 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
2962 STATIC_ASSERT(FCA::kArgsLength == 8); 2963 STATIC_ASSERT(FCA::kArgsLength == 8);
2963 2964
2964 // FunctionCallbackArguments 2965 // FunctionCallbackArguments
2965 2966
2966 // new target 2967 // new target
2967 __ PushRoot(Heap::kUndefinedValueRootIndex); 2968 __ PushRoot(Heap::kUndefinedValueRootIndex);
2968 2969
2969 // context, callee and call data. 2970 // context, callee and call data.
2970 __ Push(context, callee, call_data); 2971 __ Push(context, callee, call_data);
2971 2972
2972 if (!is_lazy()) { 2973 Register scratch = call_data;
2973 // Load context from callee 2974 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2974 __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2975 }
2976
2977 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
2978 Register isolate_reg = x5; 2975 Register isolate_reg = x5;
2979 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate())); 2976 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate()));
2980 2977
2981 // FunctionCallbackArguments: 2978 // FunctionCallbackArguments:
2982 // return value, return value default, isolate, holder. 2979 // return value, return value default, isolate, holder.
2983 __ Push(call_data, call_data, isolate_reg, holder); 2980 __ Push(scratch, scratch, isolate_reg, holder);
2981
2982 // Enter a new context
2983 if (is_lazy()) {
2984 // Load context from accessor_holder
2985 Register accessor_holder = context;
2986 __ Ldr(accessor_holder,
2987 MemOperand(__ StackPointer(),
2988 (FCA::kArgsLength + 1 + argc()) * kPointerSize));
2989 __ Ldr(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
2990 __ GetMapConstructor(scratch, scratch, context, callee);
2991 __ Ldr(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
2992 } else {
2993 // Load context from callee
2994 __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2995 }
2984 2996
2985 // Prepare arguments. 2997 // Prepare arguments.
2986 Register args = x6; 2998 Register args = x6;
2987 __ Mov(args, masm->StackPointer()); 2999 __ Mov(args, masm->StackPointer());
2988 3000
2989 // Allocate the v8::Arguments structure in the arguments' space, since it's 3001 // Allocate the v8::Arguments structure in the arguments' space, since it's
2990 // not controlled by GC. 3002 // not controlled by GC.
2991 const int kApiStackSpace = 3; 3003 const int kApiStackSpace = 3;
2992 3004
2993 // Allocate space for CallApiFunctionAndReturn can store some scratch 3005 // Allocate space for CallApiFunctionAndReturn can store some scratch
(...skipping 21 matching lines...) Expand all
3015 MemOperand context_restore_operand( 3027 MemOperand context_restore_operand(
3016 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 3028 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
3017 // Stores return the first js argument 3029 // Stores return the first js argument
3018 int return_value_offset = 0; 3030 int return_value_offset = 0;
3019 if (is_store()) { 3031 if (is_store()) {
3020 return_value_offset = 2 + FCA::kArgsLength; 3032 return_value_offset = 2 + FCA::kArgsLength;
3021 } else { 3033 } else {
3022 return_value_offset = 2 + FCA::kReturnValueOffset; 3034 return_value_offset = 2 + FCA::kReturnValueOffset;
3023 } 3035 }
3024 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 3036 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
3025 int stack_space = 0; 3037 const int stack_space = argc() + FCA::kArgsLength + 2;
3026 MemOperand length_operand = 3038 MemOperand* stack_space_operand = nullptr;
3027 MemOperand(masm->StackPointer(), 3 * kPointerSize);
3028 MemOperand* stack_space_operand = &length_operand;
3029 stack_space = argc() + FCA::kArgsLength + 1;
3030 stack_space_operand = NULL;
3031 3039
3032 const int spill_offset = 1 + kApiStackSpace; 3040 const int spill_offset = 1 + kApiStackSpace;
3033 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 3041 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
3034 stack_space_operand, spill_offset, 3042 stack_space_operand, spill_offset,
3035 return_value_operand, &context_restore_operand); 3043 return_value_operand, &context_restore_operand);
3036 } 3044 }
3037 3045
3038 3046
3039 void CallApiGetterStub::Generate(MacroAssembler* masm) { 3047 void CallApiGetterStub::Generate(MacroAssembler* masm) {
3040 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property 3048 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 kStackUnwindSpace, NULL, spill_offset, 3112 kStackUnwindSpace, NULL, spill_offset,
3105 return_value_operand, NULL); 3113 return_value_operand, NULL);
3106 } 3114 }
3107 3115
3108 #undef __ 3116 #undef __
3109 3117
3110 } // namespace internal 3118 } // namespace internal
3111 } // namespace v8 3119 } // namespace v8
3112 3120
3113 #endif // V8_TARGET_ARCH_ARM64 3121 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/compiler/js-call-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698