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 2820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 void CallApiCallbackStub::Generate(MacroAssembler* masm) { | 2831 void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
2832 // ----------- S t a t e ------------- | 2832 // ----------- S t a t e ------------- |
2833 // -- r2 : callee | 2833 // -- r2 : callee |
2834 // -- r6 : call_data | 2834 // -- r6 : call_data |
2835 // -- r4 : holder | 2835 // -- r4 : holder |
2836 // -- r3 : api_function_address | 2836 // -- r3 : api_function_address |
2837 // -- cp : context | 2837 // -- cp : context |
2838 // -- | 2838 // -- |
2839 // -- sp[0] : last argument | 2839 // -- sp[0] : last argument |
2840 // -- ... | 2840 // -- ... |
2841 // -- sp[(argc - 1)* 4] : first argument | 2841 // -- sp[(argc - 1) * 4] : first argument |
2842 // -- sp[argc * 4] : receiver | 2842 // -- sp[argc * 4] : receiver |
| 2843 // -- sp[(argc + 1) * 4] : accessor_holder |
2843 // ----------------------------------- | 2844 // ----------------------------------- |
2844 | 2845 |
2845 Register callee = r2; | 2846 Register callee = r2; |
2846 Register call_data = r6; | 2847 Register call_data = r6; |
2847 Register holder = r4; | 2848 Register holder = r4; |
2848 Register api_function_address = r3; | 2849 Register api_function_address = r3; |
2849 Register context = cp; | 2850 Register context = cp; |
2850 | 2851 |
2851 typedef FunctionCallbackArguments FCA; | 2852 typedef FunctionCallbackArguments FCA; |
2852 | 2853 |
2853 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 2854 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
2854 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 2855 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
2855 STATIC_ASSERT(FCA::kDataIndex == 4); | 2856 STATIC_ASSERT(FCA::kDataIndex == 4); |
2856 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 2857 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
2857 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 2858 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
2858 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 2859 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
2859 STATIC_ASSERT(FCA::kHolderIndex == 0); | 2860 STATIC_ASSERT(FCA::kHolderIndex == 0); |
2860 STATIC_ASSERT(FCA::kNewTargetIndex == 7); | 2861 STATIC_ASSERT(FCA::kNewTargetIndex == 7); |
2861 STATIC_ASSERT(FCA::kArgsLength == 8); | 2862 STATIC_ASSERT(FCA::kArgsLength == 8); |
2862 | 2863 |
2863 // new target | 2864 // new target |
2864 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2865 __ PushRoot(Heap::kUndefinedValueRootIndex); |
2865 | 2866 |
2866 // context save | 2867 // context save |
2867 __ push(context); | 2868 __ push(context); |
2868 if (!is_lazy()) { | |
2869 // load context from callee | |
2870 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); | |
2871 } | |
2872 | 2869 |
2873 // callee | 2870 // callee |
2874 __ push(callee); | 2871 __ push(callee); |
2875 | 2872 |
2876 // call data | 2873 // call data |
2877 __ push(call_data); | 2874 __ push(call_data); |
2878 | 2875 |
| 2876 // Enter a new context |
2879 Register scratch = call_data; | 2877 Register scratch = call_data; |
| 2878 if (is_lazy()) { |
| 2879 // Load context from accessor_holder |
| 2880 Register accessor_holder = context; |
| 2881 __ LoadP(accessor_holder, MemOperand(sp, (argc() + 1 + 4) * kPointerSize)); |
| 2882 __ LoadP(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset)); |
| 2883 __ GetMapConstructor(scratch, scratch, context, callee); |
| 2884 __ LoadP(context, FieldMemOperand(scratch, JSFunction::kContextOffset)); |
| 2885 } else { |
| 2886 // Load context from callee |
| 2887 __ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
| 2888 } |
| 2889 |
2880 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 2890 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
2881 // return value | 2891 // return value |
2882 __ push(scratch); | 2892 __ push(scratch); |
2883 // return value default | 2893 // return value default |
2884 __ push(scratch); | 2894 __ push(scratch); |
2885 // isolate | 2895 // isolate |
2886 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); | 2896 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); |
2887 __ push(scratch); | 2897 __ push(scratch); |
2888 // holder | 2898 // holder |
2889 __ push(holder); | 2899 __ push(holder); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 3044 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
3035 kStackUnwindSpace, NULL, return_value_operand, NULL); | 3045 kStackUnwindSpace, NULL, return_value_operand, NULL); |
3036 } | 3046 } |
3037 | 3047 |
3038 #undef __ | 3048 #undef __ |
3039 | 3049 |
3040 } // namespace internal | 3050 } // namespace internal |
3041 } // namespace v8 | 3051 } // namespace v8 |
3042 | 3052 |
3043 #endif // V8_TARGET_ARCH_S390 | 3053 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |