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

Side by Side Diff: src/ppc/code-stubs-ppc.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/objects.cc ('k') | src/s390/code-stubs-s390.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_PPC 5 #if V8_TARGET_ARCH_PPC
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 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 // -- r3 : callee 2834 // -- r3 : callee
2835 // -- r7 : call_data 2835 // -- r7 : call_data
2836 // -- r5 : holder 2836 // -- r5 : holder
2837 // -- r4 : api_function_address 2837 // -- r4 : api_function_address
2838 // -- cp : context 2838 // -- cp : context
2839 // -- 2839 // --
2840 // -- sp[0] : last argument 2840 // -- sp[0] : last argument
2841 // -- ... 2841 // -- ...
2842 // -- sp[(argc - 1)* 4] : first argument 2842 // -- sp[(argc - 1)* 4] : first argument
2843 // -- sp[argc * 4] : receiver 2843 // -- sp[argc * 4] : receiver
2844 // -- sp[(argc + 1)* 4] : accessor_holder
2844 // ----------------------------------- 2845 // -----------------------------------
2845 2846
2846 Register callee = r3; 2847 Register callee = r3;
2847 Register call_data = r7; 2848 Register call_data = r7;
2848 Register holder = r5; 2849 Register holder = r5;
2849 Register api_function_address = r4; 2850 Register api_function_address = r4;
2850 Register context = cp; 2851 Register context = cp;
2851 2852
2852 typedef FunctionCallbackArguments FCA; 2853 typedef FunctionCallbackArguments FCA;
2853 2854
2854 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 2855 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
2855 STATIC_ASSERT(FCA::kCalleeIndex == 5); 2856 STATIC_ASSERT(FCA::kCalleeIndex == 5);
2856 STATIC_ASSERT(FCA::kDataIndex == 4); 2857 STATIC_ASSERT(FCA::kDataIndex == 4);
2857 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 2858 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
2858 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 2859 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
2859 STATIC_ASSERT(FCA::kIsolateIndex == 1); 2860 STATIC_ASSERT(FCA::kIsolateIndex == 1);
2860 STATIC_ASSERT(FCA::kHolderIndex == 0); 2861 STATIC_ASSERT(FCA::kHolderIndex == 0);
2861 STATIC_ASSERT(FCA::kNewTargetIndex == 7); 2862 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
2862 STATIC_ASSERT(FCA::kArgsLength == 8); 2863 STATIC_ASSERT(FCA::kArgsLength == 8);
2863 2864
2864 // new target 2865 // new target
2865 __ PushRoot(Heap::kUndefinedValueRootIndex); 2866 __ PushRoot(Heap::kUndefinedValueRootIndex);
2866 2867
2867 // context save 2868 // context save
2868 __ push(context); 2869 __ push(context);
2869 if (!is_lazy()) {
2870 // load context from callee
2871 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2872 }
2873 2870
2874 // callee 2871 // callee
2875 __ push(callee); 2872 __ push(callee);
2876 2873
2877 // call data 2874 // call data
2878 __ push(call_data); 2875 __ push(call_data);
2879 2876
2880 Register scratch = call_data; 2877 Register scratch = call_data;
2881 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); 2878 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
2882 // return value 2879 // return value
2883 __ push(scratch); 2880 __ push(scratch);
2884 // return value default 2881 // return value default
2885 __ push(scratch); 2882 __ push(scratch);
2886 // isolate 2883 // isolate
2887 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 2884 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
2888 __ push(scratch); 2885 __ push(scratch);
2889 // holder 2886 // holder
2890 __ push(holder); 2887 __ push(holder);
2891 2888
2889 // Enter a new context
2890 if (is_lazy()) {
2891 // Load context from accessor_holder
2892 Register accessor_holder = context;
2893 __ LoadP(accessor_holder,
2894 MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize));
2895 __ LoadP(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset));
2896 __ GetMapConstructor(scratch, scratch, context, callee);
2897 __ LoadP(context, FieldMemOperand(scratch, JSFunction::kContextOffset));
2898 } else {
2899 // Load context from callee
2900 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
2901 }
2902
2892 // Prepare arguments. 2903 // Prepare arguments.
2893 __ mr(scratch, sp); 2904 __ mr(scratch, sp);
2894 2905
2895 // Allocate the v8::Arguments structure in the arguments' space since 2906 // Allocate the v8::Arguments structure in the arguments' space since
2896 // it's not controlled by GC. 2907 // it's not controlled by GC.
2897 // PPC LINUX ABI: 2908 // PPC LINUX ABI:
2898 // 2909 //
2899 // Create 4 extra slots on stack: 2910 // Create 4 extra slots on stack:
2900 // [0] space for DirectCEntryStub's LR save 2911 // [0] space for DirectCEntryStub's LR save
2901 // [1-3] FunctionCallbackInfo 2912 // [1-3] FunctionCallbackInfo
(...skipping 24 matching lines...) Expand all
2926 MemOperand context_restore_operand( 2937 MemOperand context_restore_operand(
2927 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 2938 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
2928 // Stores return the first js argument 2939 // Stores return the first js argument
2929 int return_value_offset = 0; 2940 int return_value_offset = 0;
2930 if (is_store()) { 2941 if (is_store()) {
2931 return_value_offset = 2 + FCA::kArgsLength; 2942 return_value_offset = 2 + FCA::kArgsLength;
2932 } else { 2943 } else {
2933 return_value_offset = 2 + FCA::kReturnValueOffset; 2944 return_value_offset = 2 + FCA::kReturnValueOffset;
2934 } 2945 }
2935 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 2946 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
2936 int stack_space = 0; 2947 const int stack_space = argc() + FCA::kArgsLength + 2;
2937 MemOperand length_operand = 2948 MemOperand* stack_space_operand = nullptr;
2938 MemOperand(sp, kFunctionCallbackInfoOffset + 2 * kPointerSize);
2939 MemOperand* stack_space_operand = &length_operand;
2940 stack_space = argc() + FCA::kArgsLength + 1;
2941 stack_space_operand = NULL;
2942 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 2949 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
2943 stack_space_operand, return_value_operand, 2950 stack_space_operand, return_value_operand,
2944 &context_restore_operand); 2951 &context_restore_operand);
2945 } 2952 }
2946 2953
2947 2954
2948 void CallApiGetterStub::Generate(MacroAssembler* masm) { 2955 void CallApiGetterStub::Generate(MacroAssembler* masm) {
2949 int arg0Slot = 0; 2956 int arg0Slot = 0;
2950 int accessorInfoSlot = 0; 2957 int accessorInfoSlot = 0;
2951 int apiStackSpace = 0; 2958 int apiStackSpace = 0;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3035 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); 3042 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
3036 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 3043 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
3037 kStackUnwindSpace, NULL, return_value_operand, NULL); 3044 kStackUnwindSpace, NULL, return_value_operand, NULL);
3038 } 3045 }
3039 3046
3040 #undef __ 3047 #undef __
3041 } // namespace internal 3048 } // namespace internal
3042 } // namespace v8 3049 } // namespace v8
3043 3050
3044 #endif // V8_TARGET_ARCH_PPC 3051 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/s390/code-stubs-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698