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