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