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