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