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

Side by Side Diff: src/arm/code-stubs-arm.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
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | src/ic/x64/handler-compiler-x64.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 8
9 #include "src/api-arguments.h" 9 #include "src/api-arguments.h"
10 #include "src/assembler-inl.h" 10 #include "src/assembler-inl.h"
(...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 void CallApiCallbackStub::Generate(MacroAssembler* masm) { 2755 void CallApiCallbackStub::Generate(MacroAssembler* masm) {
2756 // ----------- S t a t e ------------- 2756 // ----------- S t a t e -------------
2757 // -- r0 : callee 2757 // -- r0 : callee
2758 // -- r4 : call_data 2758 // -- r4 : call_data
2759 // -- r2 : holder 2759 // -- r2 : holder
2760 // -- r1 : api_function_address 2760 // -- r1 : api_function_address
2761 // -- cp : context 2761 // -- cp : context
2762 // -- 2762 // --
2763 // -- sp[0] : last argument 2763 // -- sp[0] : last argument
2764 // -- ... 2764 // -- ...
2765 // -- sp[(argc - 1)* 4] : first argument 2765 // -- sp[(argc - 1) * 4] : first argument
2766 // -- sp[argc * 4] : receiver 2766 // -- sp[argc * 4] : receiver
2767 // -- sp[(argc + 1) * 4] : accessor_holder
2767 // ----------------------------------- 2768 // -----------------------------------
2768 2769
2769 Register callee = r0; 2770 Register callee = r0;
2770 Register call_data = r4; 2771 Register call_data = r4;
2771 Register holder = r2; 2772 Register holder = r2;
2772 Register api_function_address = r1; 2773 Register api_function_address = r1;
2773 Register context = cp; 2774 Register context = cp;
2774 2775
2775 typedef FunctionCallbackArguments FCA; 2776 typedef FunctionCallbackArguments FCA;
2776 2777
2777 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 2778 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
2778 STATIC_ASSERT(FCA::kCalleeIndex == 5); 2779 STATIC_ASSERT(FCA::kCalleeIndex == 5);
2779 STATIC_ASSERT(FCA::kDataIndex == 4); 2780 STATIC_ASSERT(FCA::kDataIndex == 4);
2780 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 2781 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
2781 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 2782 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
2782 STATIC_ASSERT(FCA::kIsolateIndex == 1); 2783 STATIC_ASSERT(FCA::kIsolateIndex == 1);
2783 STATIC_ASSERT(FCA::kHolderIndex == 0); 2784 STATIC_ASSERT(FCA::kHolderIndex == 0);
2784 STATIC_ASSERT(FCA::kNewTargetIndex == 7); 2785 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
2785 STATIC_ASSERT(FCA::kArgsLength == 8); 2786 STATIC_ASSERT(FCA::kArgsLength == 8);
2786 2787
2787 // new target 2788 // new target
2788 __ PushRoot(Heap::kUndefinedValueRootIndex); 2789 __ PushRoot(Heap::kUndefinedValueRootIndex);
2789 2790
2790 // context save 2791 // context save
2791 __ push(context); 2792 __ push(context);
2792 if (!is_lazy()) {
2793 // load context from callee
2794 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2795 }
2796 2793
2797 // callee 2794 // callee
2798 __ push(callee); 2795 __ push(callee);
2799 2796
2800 // call data 2797 // call data
2801 __ push(call_data); 2798 __ push(call_data);
2802 2799
2803 Register scratch = call_data; 2800 Register scratch = call_data;
2804 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2801 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2805 // return value 2802 // return value
2806 __ push(scratch); 2803 __ push(scratch);
2807 // return value default 2804 // return value default
2808 __ push(scratch); 2805 __ push(scratch);
2809 // isolate 2806 // isolate
2810 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 2807 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
2811 __ push(scratch); 2808 __ push(scratch);
2812 // holder 2809 // holder
2813 __ push(holder); 2810 __ push(holder);
2814 2811
2812 // enter a new context
2813 if (is_lazy()) {
2814 // load context from accessor_holder
2815 Register accessor_holder = context;
2816 __ ldr(accessor_holder,
2817 MemOperand(sp, (FCA::kArgsLength + 1 argc()) * kPointerSize));
2818 __ ldr(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
2819 __ GetMapConstructor(scratch, scratch, context, callee);
2820 __ ldr(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
2821 } else {
2822 // load context from callee
2823 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2824 }
2825
2815 // Prepare arguments. 2826 // Prepare arguments.
2816 __ mov(scratch, sp); 2827 __ mov(scratch, sp);
2817 2828
2818 // Allocate the v8::Arguments structure in the arguments' space since 2829 // Allocate the v8::Arguments structure in the arguments' space since
2819 // it's not controlled by GC. 2830 // it's not controlled by GC.
2820 const int kApiStackSpace = 3; 2831 const int kApiStackSpace = 3;
2821 2832
2822 FrameScope frame_scope(masm, StackFrame::MANUAL); 2833 FrameScope frame_scope(masm, StackFrame::MANUAL);
2823 __ EnterExitFrame(false, kApiStackSpace); 2834 __ EnterExitFrame(false, kApiStackSpace);
2824 2835
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2921 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 2932 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
2922 kStackUnwindSpace, NULL, return_value_operand, NULL); 2933 kStackUnwindSpace, NULL, return_value_operand, NULL);
2923 } 2934 }
2924 2935
2925 #undef __ 2936 #undef __
2926 2937
2927 } // namespace internal 2938 } // namespace internal
2928 } // namespace v8 2939 } // namespace v8
2929 2940
2930 #endif // V8_TARGET_ARCH_ARM 2941 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | src/ic/x64/handler-compiler-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698