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

Side by Side Diff: src/s390/code-stubs-s390.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/ppc/code-stubs-ppc.cc ('k') | src/x64/code-stubs-x64.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_S390 5 #if V8_TARGET_ARCH_S390
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 void CallApiCallbackStub::Generate(MacroAssembler* masm) { 2764 void CallApiCallbackStub::Generate(MacroAssembler* masm) {
2765 // ----------- S t a t e ------------- 2765 // ----------- S t a t e -------------
2766 // -- r2 : callee 2766 // -- r2 : callee
2767 // -- r6 : call_data 2767 // -- r6 : call_data
2768 // -- r4 : holder 2768 // -- r4 : holder
2769 // -- r3 : api_function_address 2769 // -- r3 : api_function_address
2770 // -- cp : context 2770 // -- cp : context
2771 // -- 2771 // --
2772 // -- sp[0] : last argument 2772 // -- sp[0] : last argument
2773 // -- ... 2773 // -- ...
2774 // -- sp[(argc - 1)* 4] : first argument 2774 // -- sp[(argc - 1) * 4] : first argument
2775 // -- sp[argc * 4] : receiver 2775 // -- sp[argc * 4] : receiver
2776 // -- sp[(argc + 1) * 4] : accessor_holder
2776 // ----------------------------------- 2777 // -----------------------------------
2777 2778
2778 Register callee = r2; 2779 Register callee = r2;
2779 Register call_data = r6; 2780 Register call_data = r6;
2780 Register holder = r4; 2781 Register holder = r4;
2781 Register api_function_address = r3; 2782 Register api_function_address = r3;
2782 Register context = cp; 2783 Register context = cp;
2783 2784
2784 typedef FunctionCallbackArguments FCA; 2785 typedef FunctionCallbackArguments FCA;
2785 2786
2786 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 2787 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
2787 STATIC_ASSERT(FCA::kCalleeIndex == 5); 2788 STATIC_ASSERT(FCA::kCalleeIndex == 5);
2788 STATIC_ASSERT(FCA::kDataIndex == 4); 2789 STATIC_ASSERT(FCA::kDataIndex == 4);
2789 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 2790 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
2790 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 2791 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
2791 STATIC_ASSERT(FCA::kIsolateIndex == 1); 2792 STATIC_ASSERT(FCA::kIsolateIndex == 1);
2792 STATIC_ASSERT(FCA::kHolderIndex == 0); 2793 STATIC_ASSERT(FCA::kHolderIndex == 0);
2793 STATIC_ASSERT(FCA::kNewTargetIndex == 7); 2794 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
2794 STATIC_ASSERT(FCA::kArgsLength == 8); 2795 STATIC_ASSERT(FCA::kArgsLength == 8);
2795 2796
2796 // new target 2797 // new target
2797 __ PushRoot(Heap::kUndefinedValueRootIndex); 2798 __ PushRoot(Heap::kUndefinedValueRootIndex);
2798 2799
2799 // context save 2800 // context save
2800 __ push(context); 2801 __ push(context);
2801 if (!is_lazy()) {
2802 // load context from callee
2803 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2804 }
2805 2802
2806 // callee 2803 // callee
2807 __ push(callee); 2804 __ push(callee);
2808 2805
2809 // call data 2806 // call data
2810 __ push(call_data); 2807 __ push(call_data);
2811 2808
2812 Register scratch = call_data; 2809 Register scratch = call_data;
2813 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2810 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2814 // return value 2811 // return value
2815 __ push(scratch); 2812 __ push(scratch);
2816 // return value default 2813 // return value default
2817 __ push(scratch); 2814 __ push(scratch);
2818 // isolate 2815 // isolate
2819 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 2816 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
2820 __ push(scratch); 2817 __ push(scratch);
2821 // holder 2818 // holder
2822 __ push(holder); 2819 __ push(holder);
2823 2820
2821 // Enter a new context
2822 if (is_lazy()) {
2823 // Load context from accessor_holder
2824 Register accessor_holder = context;
2825 __ LoadP(accessor_holder,
2826 MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize));
2827 __ LoadP(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
2828 __ GetMapConstructor(scratch, scratch, context, callee);
2829 __ LoadP(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
2830 } else {
2831 // Load context from callee
2832 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2833 }
2834
2824 // Prepare arguments. 2835 // Prepare arguments.
2825 __ LoadRR(scratch, sp); 2836 __ LoadRR(scratch, sp);
2826 2837
2827 // Allocate the v8::Arguments structure in the arguments' space since 2838 // Allocate the v8::Arguments structure in the arguments' space since
2828 // it's not controlled by GC. 2839 // it's not controlled by GC.
2829 // S390 LINUX ABI: 2840 // S390 LINUX ABI:
2830 // 2841 //
2831 // Create 4 extra slots on stack: 2842 // Create 4 extra slots on stack:
2832 // [0] space for DirectCEntryStub's LR save 2843 // [0] space for DirectCEntryStub's LR save
2833 // [1-3] FunctionCallbackInfo 2844 // [1-3] FunctionCallbackInfo
(...skipping 24 matching lines...) Expand all
2858 MemOperand context_restore_operand( 2869 MemOperand context_restore_operand(
2859 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 2870 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
2860 // Stores return the first js argument 2871 // Stores return the first js argument
2861 int return_value_offset = 0; 2872 int return_value_offset = 0;
2862 if (is_store()) { 2873 if (is_store()) {
2863 return_value_offset = 2 + FCA::kArgsLength; 2874 return_value_offset = 2 + FCA::kArgsLength;
2864 } else { 2875 } else {
2865 return_value_offset = 2 + FCA::kReturnValueOffset; 2876 return_value_offset = 2 + FCA::kReturnValueOffset;
2866 } 2877 }
2867 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 2878 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
2868 int stack_space = 0; 2879 const int stack_space = argc() + FCA::kArgsLength + 2;
2869 MemOperand length_operand = 2880 MemOperand* stack_space_operand = nullptr;
2870 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize);
2871 MemOperand* stack_space_operand = &length_operand;
2872 stack_space = argc() + FCA::kArgsLength + 1;
2873 stack_space_operand = NULL;
2874 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 2881 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
2875 stack_space_operand, return_value_operand, 2882 stack_space_operand, return_value_operand,
2876 &context_restore_operand); 2883 &context_restore_operand);
2877 } 2884 }
2878 2885
2879 void CallApiGetterStub::Generate(MacroAssembler* masm) { 2886 void CallApiGetterStub::Generate(MacroAssembler* masm) {
2880 int arg0Slot = 0; 2887 int arg0Slot = 0;
2881 int accessorInfoSlot = 0; 2888 int accessorInfoSlot = 0;
2882 int apiStackSpace = 0; 2889 int apiStackSpace = 0;
2883 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property 2890 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2967 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 2974 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
2968 kStackUnwindSpace, NULL, return_value_operand, NULL); 2975 kStackUnwindSpace, NULL, return_value_operand, NULL);
2969 } 2976 }
2970 2977
2971 #undef __ 2978 #undef __
2972 2979
2973 } // namespace internal 2980 } // namespace internal
2974 } // namespace v8 2981 } // namespace v8
2975 2982
2976 #endif // V8_TARGET_ARCH_S390 2983 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/ppc/code-stubs-ppc.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698