OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 void CallApiCallbackStub::Generate(MacroAssembler* masm) { | 2876 void CallApiCallbackStub::Generate(MacroAssembler* masm) { |
2877 // ----------- S t a t e ------------- | 2877 // ----------- S t a t e ------------- |
2878 // -- a0 : callee | 2878 // -- a0 : callee |
2879 // -- a4 : call_data | 2879 // -- a4 : call_data |
2880 // -- a2 : holder | 2880 // -- a2 : holder |
2881 // -- a1 : api_function_address | 2881 // -- a1 : api_function_address |
2882 // -- cp : context | 2882 // -- cp : context |
2883 // -- | 2883 // -- |
2884 // -- sp[0] : last argument | 2884 // -- sp[0] : last argument |
2885 // -- ... | 2885 // -- ... |
2886 // -- sp[(argc - 1) * 8] : first argument | 2886 // -- sp[(argc - 1)* 8] : first argument |
2887 // -- sp[argc * 8] : receiver | 2887 // -- sp[argc * 8] : receiver |
2888 // -- sp[(argc + 1) * 8] : accessor_holder | |
2889 // ----------------------------------- | 2888 // ----------------------------------- |
2890 | 2889 |
2891 Register callee = a0; | 2890 Register callee = a0; |
2892 Register call_data = a4; | 2891 Register call_data = a4; |
2893 Register holder = a2; | 2892 Register holder = a2; |
2894 Register api_function_address = a1; | 2893 Register api_function_address = a1; |
2895 Register context = cp; | 2894 Register context = cp; |
2896 | 2895 |
2897 typedef FunctionCallbackArguments FCA; | 2896 typedef FunctionCallbackArguments FCA; |
2898 | 2897 |
2899 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 2898 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
2900 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 2899 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
2901 STATIC_ASSERT(FCA::kDataIndex == 4); | 2900 STATIC_ASSERT(FCA::kDataIndex == 4); |
2902 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 2901 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
2903 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 2902 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
2904 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 2903 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
2905 STATIC_ASSERT(FCA::kHolderIndex == 0); | 2904 STATIC_ASSERT(FCA::kHolderIndex == 0); |
2906 STATIC_ASSERT(FCA::kNewTargetIndex == 7); | 2905 STATIC_ASSERT(FCA::kNewTargetIndex == 7); |
2907 STATIC_ASSERT(FCA::kArgsLength == 8); | 2906 STATIC_ASSERT(FCA::kArgsLength == 8); |
2908 | 2907 |
2909 // new target | 2908 // new target |
2910 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2909 __ PushRoot(Heap::kUndefinedValueRootIndex); |
2911 | 2910 |
2912 // Save context, callee and call data. | 2911 // Save context, callee and call data. |
2913 __ Push(context, callee, call_data); | 2912 __ Push(context, callee, call_data); |
| 2913 if (!is_lazy()) { |
| 2914 // Load context from callee. |
| 2915 __ Ld(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
| 2916 } |
2914 | 2917 |
2915 Register scratch = call_data; | 2918 Register scratch = call_data; |
2916 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 2919 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
2917 // Push return value and default return value. | 2920 // Push return value and default return value. |
2918 __ Push(scratch, scratch); | 2921 __ Push(scratch, scratch); |
2919 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); | 2922 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); |
2920 // Push isolate and holder. | 2923 // Push isolate and holder. |
2921 __ Push(scratch, holder); | 2924 __ Push(scratch, holder); |
2922 | 2925 |
2923 // Enter a new context | |
2924 if (is_lazy()) { | |
2925 // Load context from accessor_holder | |
2926 Register accessor_holder = context; | |
2927 __ Ld(accessor_holder, | |
2928 MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize)); | |
2929 __ Ld(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset)); | |
2930 __ GetMapConstructor(scratch, scratch, context, callee); | |
2931 __ Ld(context, FieldMemOperand(scratch, JSFunction::kContextOffset)); | |
2932 } else { | |
2933 // Load context from callee. | |
2934 __ Ld(context, FieldMemOperand(callee, JSFunction::kContextOffset)); | |
2935 } | |
2936 | |
2937 // Prepare arguments. | 2926 // Prepare arguments. |
2938 __ mov(scratch, sp); | 2927 __ mov(scratch, sp); |
2939 | 2928 |
2940 // Allocate the v8::Arguments structure in the arguments' space since | 2929 // Allocate the v8::Arguments structure in the arguments' space since |
2941 // it's not controlled by GC. | 2930 // it's not controlled by GC. |
2942 const int kApiStackSpace = 3; | 2931 const int kApiStackSpace = 3; |
2943 | 2932 |
2944 FrameScope frame_scope(masm, StackFrame::MANUAL); | 2933 FrameScope frame_scope(masm, StackFrame::MANUAL); |
2945 __ EnterExitFrame(false, kApiStackSpace); | 2934 __ EnterExitFrame(false, kApiStackSpace); |
2946 | 2935 |
(...skipping 20 matching lines...) Expand all Loading... |
2967 MemOperand context_restore_operand( | 2956 MemOperand context_restore_operand( |
2968 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); | 2957 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); |
2969 // Stores return the first js argument. | 2958 // Stores return the first js argument. |
2970 int return_value_offset = 0; | 2959 int return_value_offset = 0; |
2971 if (is_store()) { | 2960 if (is_store()) { |
2972 return_value_offset = 2 + FCA::kArgsLength; | 2961 return_value_offset = 2 + FCA::kArgsLength; |
2973 } else { | 2962 } else { |
2974 return_value_offset = 2 + FCA::kReturnValueOffset; | 2963 return_value_offset = 2 + FCA::kReturnValueOffset; |
2975 } | 2964 } |
2976 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); | 2965 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); |
2977 const int stack_space = argc() + FCA::kArgsLength + 2; | 2966 int stack_space = 0; |
| 2967 int32_t stack_space_offset = 3 * kPointerSize; |
| 2968 stack_space = argc() + FCA::kArgsLength + 1; |
2978 // TODO(adamk): Why are we clobbering this immediately? | 2969 // TODO(adamk): Why are we clobbering this immediately? |
2979 const int32_t stack_space_offset = kInvalidStackOffset; | 2970 stack_space_offset = kInvalidStackOffset; |
2980 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, | 2971 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, |
2981 stack_space_offset, return_value_operand, | 2972 stack_space_offset, return_value_operand, |
2982 &context_restore_operand); | 2973 &context_restore_operand); |
2983 } | 2974 } |
2984 | 2975 |
2985 | 2976 |
2986 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 2977 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
2987 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property | 2978 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
2988 // name below the exit frame to make GC aware of them. | 2979 // name below the exit frame to make GC aware of them. |
2989 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); | 2980 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3054 kStackUnwindSpace, kInvalidStackOffset, | 3045 kStackUnwindSpace, kInvalidStackOffset, |
3055 return_value_operand, NULL); | 3046 return_value_operand, NULL); |
3056 } | 3047 } |
3057 | 3048 |
3058 #undef __ | 3049 #undef __ |
3059 | 3050 |
3060 } // namespace internal | 3051 } // namespace internal |
3061 } // namespace v8 | 3052 } // namespace v8 |
3062 | 3053 |
3063 #endif // V8_TARGET_ARCH_MIPS64 | 3054 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |