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

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: Crashing at cctest test-accessors/AccessorIC Created 3 years, 6 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
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 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 // -- x0 : callee 2991 // -- x0 : callee
2992 // -- x4 : call_data 2992 // -- x4 : call_data
2993 // -- x2 : holder 2993 // -- x2 : holder
2994 // -- x1 : api_function_address 2994 // -- x1 : api_function_address
2995 // -- cp : context 2995 // -- cp : context
2996 // -- 2996 // --
2997 // -- sp[0] : last argument 2997 // -- sp[0] : last argument
2998 // -- ... 2998 // -- ...
2999 // -- sp[(argc - 1) * 8] : first argument 2999 // -- sp[(argc - 1) * 8] : first argument
3000 // -- sp[argc * 8] : receiver 3000 // -- sp[argc * 8] : receiver
3001 // -- sp[(argc + 1) * 8] : accessor_holder
3001 // ----------------------------------- 3002 // -----------------------------------
3002 3003
3003 Register callee = x0; 3004 Register callee = x0;
3004 Register call_data = x4; 3005 Register call_data = x4;
3005 Register holder = x2; 3006 Register holder = x2;
3006 Register api_function_address = x1; 3007 Register api_function_address = x1;
3007 Register context = cp; 3008 Register context = cp;
3008 3009
3009 typedef FunctionCallbackArguments FCA; 3010 typedef FunctionCallbackArguments FCA;
3010 3011
3011 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 3012 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
3012 STATIC_ASSERT(FCA::kCalleeIndex == 5); 3013 STATIC_ASSERT(FCA::kCalleeIndex == 5);
3013 STATIC_ASSERT(FCA::kDataIndex == 4); 3014 STATIC_ASSERT(FCA::kDataIndex == 4);
3014 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 3015 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
3015 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 3016 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
3016 STATIC_ASSERT(FCA::kIsolateIndex == 1); 3017 STATIC_ASSERT(FCA::kIsolateIndex == 1);
3017 STATIC_ASSERT(FCA::kHolderIndex == 0); 3018 STATIC_ASSERT(FCA::kHolderIndex == 0);
3018 STATIC_ASSERT(FCA::kNewTargetIndex == 7); 3019 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
3019 STATIC_ASSERT(FCA::kArgsLength == 8); 3020 STATIC_ASSERT(FCA::kArgsLength == 8);
3020 3021
3021 // FunctionCallbackArguments 3022 // FunctionCallbackArguments
3022 3023
3023 // new target 3024 // new target
3024 __ PushRoot(Heap::kUndefinedValueRootIndex); 3025 __ PushRoot(Heap::kUndefinedValueRootIndex);
3025 3026
3026 // context, callee and call data. 3027 // context, callee and call data.
3027 __ Push(context, callee, call_data); 3028 __ Push(context, callee, call_data);
3028 3029
3029 if (!is_lazy()) { 3030 Register scratch = call_data;
3030 // Load context from callee 3031 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
3031 __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
3032 }
3033
3034 __ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
3035 Register isolate_reg = x5; 3032 Register isolate_reg = x5;
3036 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate())); 3033 __ Mov(isolate_reg, ExternalReference::isolate_address(masm->isolate()));
3037 3034
3038 // FunctionCallbackArguments: 3035 // FunctionCallbackArguments:
3039 // return value, return value default, isolate, holder. 3036 // return value, return value default, isolate, holder.
3040 __ Push(call_data, call_data, isolate_reg, holder); 3037 __ Push(scratch, scratch, isolate_reg, holder);
3038
3039 // Enter a new context
3040 if (is_lazy()) {
3041 // Load context from accessor_holder
3042 Register accessor_holder = context;
3043 __ Ldr(accessor_holder,
3044 MemOperand(__ StackPointer(),
3045 (FCA::kArgsLength + 1 + argc()) * kPointerSize));
3046 __ Ldr(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
3047 __ GetMapConstructor(scratch, scratch, context, callee);
3048 __ Ldr(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
3049 } else {
3050 // Load context from callee
3051 __ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
3052 }
3041 3053
3042 // Prepare arguments. 3054 // Prepare arguments.
3043 Register args = x6; 3055 Register args = x6;
3044 __ Mov(args, masm->StackPointer()); 3056 __ Mov(args, masm->StackPointer());
3045 3057
3046 // Allocate the v8::Arguments structure in the arguments' space, since it's 3058 // Allocate the v8::Arguments structure in the arguments' space, since it's
3047 // not controlled by GC. 3059 // not controlled by GC.
3048 const int kApiStackSpace = 3; 3060 const int kApiStackSpace = 3;
3049 3061
3050 // Allocate space for CallApiFunctionAndReturn can store some scratch 3062 // Allocate space for CallApiFunctionAndReturn can store some scratch
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 kStackUnwindSpace, NULL, spill_offset, 3173 kStackUnwindSpace, NULL, spill_offset,
3162 return_value_operand, NULL); 3174 return_value_operand, NULL);
3163 } 3175 }
3164 3176
3165 #undef __ 3177 #undef __
3166 3178
3167 } // namespace internal 3179 } // namespace internal
3168 } // namespace v8 3180 } // namespace v8
3169 3181
3170 #endif // V8_TARGET_ARCH_ARM64 3182 #endif // V8_TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698