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 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2937 // -- a0 : callee | 2937 // -- a0 : callee |
2938 // -- t0 : call_data | 2938 // -- t0 : call_data |
2939 // -- a2 : holder | 2939 // -- a2 : holder |
2940 // -- a1 : api_function_address | 2940 // -- a1 : api_function_address |
2941 // -- cp : context | 2941 // -- cp : context |
2942 // -- | 2942 // -- |
2943 // -- sp[0] : last argument | 2943 // -- sp[0] : last argument |
2944 // -- ... | 2944 // -- ... |
2945 // -- sp[(argc - 1)* 4] : first argument | 2945 // -- sp[(argc - 1)* 4] : first argument |
2946 // -- sp[argc * 4] : receiver | 2946 // -- sp[argc * 4] : receiver |
| 2947 // -- sp[(argc + 1)* 4] : accessor_holder |
2947 // ----------------------------------- | 2948 // ----------------------------------- |
2948 | 2949 |
2949 Register callee = a0; | 2950 Register callee = a0; |
2950 Register call_data = t0; | 2951 Register call_data = t0; |
2951 Register holder = a2; | 2952 Register holder = a2; |
2952 Register api_function_address = a1; | 2953 Register api_function_address = a1; |
2953 Register context = cp; | 2954 Register context = cp; |
2954 | 2955 |
2955 typedef FunctionCallbackArguments FCA; | 2956 typedef FunctionCallbackArguments FCA; |
2956 | 2957 |
2957 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 2958 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
2958 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 2959 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
2959 STATIC_ASSERT(FCA::kDataIndex == 4); | 2960 STATIC_ASSERT(FCA::kDataIndex == 4); |
2960 STATIC_ASSERT(FCA::kReturnValueOffset == 3); | 2961 STATIC_ASSERT(FCA::kReturnValueOffset == 3); |
2961 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); | 2962 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); |
2962 STATIC_ASSERT(FCA::kIsolateIndex == 1); | 2963 STATIC_ASSERT(FCA::kIsolateIndex == 1); |
2963 STATIC_ASSERT(FCA::kHolderIndex == 0); | 2964 STATIC_ASSERT(FCA::kHolderIndex == 0); |
2964 STATIC_ASSERT(FCA::kNewTargetIndex == 7); | 2965 STATIC_ASSERT(FCA::kNewTargetIndex == 7); |
2965 STATIC_ASSERT(FCA::kArgsLength == 8); | 2966 STATIC_ASSERT(FCA::kArgsLength == 8); |
2966 | 2967 |
2967 // new target | 2968 // new target |
2968 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2969 __ PushRoot(Heap::kUndefinedValueRootIndex); |
2969 | 2970 |
2970 // Save context, callee and call data. | 2971 // Save context, callee and call data. |
2971 __ Push(context, callee, call_data); | 2972 __ Push(context, callee, call_data); |
2972 if (!is_lazy()) { | |
2973 // Load context from callee. | |
2974 __ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset)); | |
2975 } | |
2976 | 2973 |
2977 Register scratch = call_data; | 2974 Register scratch = call_data; |
2978 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 2975 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
2979 // Push return value and default return value. | 2976 // Push return value and default return value. |
2980 __ Push(scratch, scratch); | 2977 __ Push(scratch, scratch); |
2981 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); | 2978 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); |
2982 // Push isolate and holder. | 2979 // Push isolate and holder. |
2983 __ Push(scratch, holder); | 2980 __ Push(scratch, holder); |
2984 | 2981 |
| 2982 // Enter a new context |
| 2983 if (is_lazy()) { |
| 2984 // Load context from accessor_holder |
| 2985 Register accessor_holder = context; |
| 2986 __ lw(accessor_holder, |
| 2987 MemOperand(sp, (FCA::kArgsLength + 1 + argc()) * kPointerSize)); |
| 2988 __ lw(scratch, FieldMemOperand(accessor_holder, HeapObject::kMapOffset)); |
| 2989 __ GetMapConstructor(scratch, scratch, context, callee); |
| 2990 __ lw(context, FieldMemOperand(scratch, JSFunction::kContextOffset)); |
| 2991 } else { |
| 2992 // Load context from callee. |
| 2993 __ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset)); |
| 2994 } |
| 2995 |
2985 // Prepare arguments. | 2996 // Prepare arguments. |
2986 __ mov(scratch, sp); | 2997 __ mov(scratch, sp); |
2987 | 2998 |
2988 // Allocate the v8::Arguments structure in the arguments' space since | 2999 // Allocate the v8::Arguments structure in the arguments' space since |
2989 // it's not controlled by GC. | 3000 // it's not controlled by GC. |
2990 const int kApiStackSpace = 3; | 3001 const int kApiStackSpace = 3; |
2991 | 3002 |
2992 FrameScope frame_scope(masm, StackFrame::MANUAL); | 3003 FrameScope frame_scope(masm, StackFrame::MANUAL); |
2993 __ EnterExitFrame(false, kApiStackSpace); | 3004 __ EnterExitFrame(false, kApiStackSpace); |
2994 | 3005 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 kStackUnwindSpace, kInvalidStackOffset, | 3111 kStackUnwindSpace, kInvalidStackOffset, |
3101 return_value_operand, NULL); | 3112 return_value_operand, NULL); |
3102 } | 3113 } |
3103 | 3114 |
3104 #undef __ | 3115 #undef __ |
3105 | 3116 |
3106 } // namespace internal | 3117 } // namespace internal |
3107 } // namespace v8 | 3118 } // namespace v8 |
3108 | 3119 |
3109 #endif // V8_TARGET_ARCH_MIPS | 3120 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |