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

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: 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 | « no previous file | src/arm64/code-stubs-arm64.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 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 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 void CallApiCallbackStub::Generate(MacroAssembler* masm) { 2693 void CallApiCallbackStub::Generate(MacroAssembler* masm) {
2694 // ----------- S t a t e ------------- 2694 // ----------- S t a t e -------------
2695 // -- r0 : callee 2695 // -- r0 : callee
2696 // -- r4 : call_data 2696 // -- r4 : call_data
2697 // -- r2 : holder 2697 // -- r2 : holder
2698 // -- r1 : api_function_address 2698 // -- r1 : api_function_address
2699 // -- cp : context 2699 // -- cp : context
2700 // -- 2700 // --
2701 // -- sp[0] : last argument 2701 // -- sp[0] : last argument
2702 // -- ... 2702 // -- ...
2703 // -- sp[(argc - 1)* 4] : first argument 2703 // -- sp[(argc - 1) * 4] : first argument
2704 // -- sp[argc * 4] : receiver 2704 // -- sp[argc * 4] : receiver
2705 // -- sp[(argc + 1) * 4] : accessor_holder
2705 // ----------------------------------- 2706 // -----------------------------------
2706 2707
2707 Register callee = r0; 2708 Register callee = r0;
2708 Register call_data = r4; 2709 Register call_data = r4;
2709 Register holder = r2; 2710 Register holder = r2;
2710 Register api_function_address = r1; 2711 Register api_function_address = r1;
2711 Register context = cp; 2712 Register context = cp;
2712 2713
2713 typedef FunctionCallbackArguments FCA; 2714 typedef FunctionCallbackArguments FCA;
2714 2715
2715 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 2716 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
2716 STATIC_ASSERT(FCA::kCalleeIndex == 5); 2717 STATIC_ASSERT(FCA::kCalleeIndex == 5);
2717 STATIC_ASSERT(FCA::kDataIndex == 4); 2718 STATIC_ASSERT(FCA::kDataIndex == 4);
2718 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 2719 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
2719 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 2720 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
2720 STATIC_ASSERT(FCA::kIsolateIndex == 1); 2721 STATIC_ASSERT(FCA::kIsolateIndex == 1);
2721 STATIC_ASSERT(FCA::kHolderIndex == 0); 2722 STATIC_ASSERT(FCA::kHolderIndex == 0);
2722 STATIC_ASSERT(FCA::kNewTargetIndex == 7); 2723 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
2723 STATIC_ASSERT(FCA::kArgsLength == 8); 2724 STATIC_ASSERT(FCA::kArgsLength == 8);
2724 2725
2725 // new target 2726 // new target
2726 __ PushRoot(Heap::kUndefinedValueRootIndex); 2727 __ PushRoot(Heap::kUndefinedValueRootIndex);
2727 2728
2728 // context save 2729 // context save
2729 __ push(context); 2730 __ push(context);
2730 if (!is_lazy()) {
2731 // load context from callee
2732 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2733 }
2734 2731
2735 // callee 2732 // callee
2736 __ push(callee); 2733 __ push(callee);
2737 2734
2738 // call data 2735 // call data
2739 __ push(call_data); 2736 __ push(call_data);
2740 2737
2741 Register scratch = call_data; 2738 Register scratch = call_data;
2742 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2739 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2743 // return value 2740 // return value
2744 __ push(scratch); 2741 __ push(scratch);
2745 // return value default 2742 // return value default
2746 __ push(scratch); 2743 __ push(scratch);
2747 // isolate 2744 // isolate
2748 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 2745 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
2749 __ push(scratch); 2746 __ push(scratch);
2750 // holder 2747 // holder
2751 __ push(holder); 2748 __ push(holder);
2752 2749
2750 // enter a new context
2751 if (is_lazy()) {
2752 // load context from accessor_holder
2753 Register accessor_holder = context;
2754 __ ldr(accessor_holder,
2755 MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize));
2756 __ ldr(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
2757 __ GetMapConstructor(scratch, scratch, context, callee);
2758 __ ldr(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
2759 } else {
2760 // load context from callee
2761 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2762 }
2763
2753 // Prepare arguments. 2764 // Prepare arguments.
2754 __ mov(scratch, sp); 2765 __ mov(scratch, sp);
2755 2766
2756 // Allocate the v8::Arguments structure in the arguments' space since 2767 // Allocate the v8::Arguments structure in the arguments' space since
2757 // it's not controlled by GC. 2768 // it's not controlled by GC.
2758 const int kApiStackSpace = 3; 2769 const int kApiStackSpace = 3;
2759 2770
2760 FrameScope frame_scope(masm, StackFrame::MANUAL); 2771 FrameScope frame_scope(masm, StackFrame::MANUAL);
2761 __ EnterExitFrame(false, kApiStackSpace); 2772 __ EnterExitFrame(false, kApiStackSpace);
2762 2773
(...skipping 17 matching lines...) Expand all
2780 MemOperand context_restore_operand( 2791 MemOperand context_restore_operand(
2781 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 2792 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
2782 // Stores return the first js argument 2793 // Stores return the first js argument
2783 int return_value_offset = 0; 2794 int return_value_offset = 0;
2784 if (is_store()) { 2795 if (is_store()) {
2785 return_value_offset = 2 + FCA::kArgsLength; 2796 return_value_offset = 2 + FCA::kArgsLength;
2786 } else { 2797 } else {
2787 return_value_offset = 2 + FCA::kReturnValueOffset; 2798 return_value_offset = 2 + FCA::kReturnValueOffset;
2788 } 2799 }
2789 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 2800 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
2790 int stack_space = 0; 2801 const int stack_space = argc() + FCA::kArgsLength + 2;
2791 MemOperand length_operand = MemOperand(sp, 3 * kPointerSize); 2802 MemOperand* stack_space_operand = nullptr;
2792 MemOperand* stack_space_operand = &length_operand;
2793 stack_space = argc() + FCA::kArgsLength + 1;
2794 stack_space_operand = NULL;
2795 2803
2796 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 2804 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
2797 stack_space_operand, return_value_operand, 2805 stack_space_operand, return_value_operand,
2798 &context_restore_operand); 2806 &context_restore_operand);
2799 } 2807 }
2800 2808
2801 2809
2802 void CallApiGetterStub::Generate(MacroAssembler* masm) { 2810 void CallApiGetterStub::Generate(MacroAssembler* masm) {
2803 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property 2811 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
2804 // name below the exit frame to make GC aware of them. 2812 // name below the exit frame to make GC aware of them.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2859 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 2867 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
2860 kStackUnwindSpace, NULL, return_value_operand, NULL); 2868 kStackUnwindSpace, NULL, return_value_operand, NULL);
2861 } 2869 }
2862 2870
2863 #undef __ 2871 #undef __
2864 2872
2865 } // namespace internal 2873 } // namespace internal
2866 } // namespace v8 2874 } // namespace v8
2867 2875
2868 #endif // V8_TARGET_ARCH_ARM 2876 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698