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/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 __ mov(a3, a1); | 120 __ mov(a3, a1); |
121 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 121 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
122 ArrayConstructorStub stub(masm->isolate()); | 122 ArrayConstructorStub stub(masm->isolate()); |
123 __ TailCallStub(&stub); | 123 __ TailCallStub(&stub); |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 // static | 127 // static |
128 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { | 128 void Builtins::Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind) { |
129 // ----------- S t a t e ------------- | 129 // ----------- S t a t e ------------- |
130 // -- a0 : number of arguments | 130 // -- a0 : number of arguments |
131 // -- a1 : function | 131 // -- a1 : function |
132 // -- cp : context | 132 // -- cp : context |
133 // -- ra : return address | 133 // -- ra : return address |
134 // -- sp[(argc - n) * 8] : arg[n] (zero-based) | 134 // -- sp[(argc - n - 1) * 8] : arg[n] (zero-based) |
135 // -- sp[(argc + 1) * 8] : receiver | 135 // -- sp[argc * 8] : receiver |
136 // ----------------------------------- | 136 // ----------------------------------- |
137 Heap::RootListIndex const root_index = | 137 Heap::RootListIndex const root_index = |
138 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex | 138 (kind == MathMaxMinKind::kMin) ? Heap::kInfinityValueRootIndex |
139 : Heap::kMinusInfinityValueRootIndex; | 139 : Heap::kMinusInfinityValueRootIndex; |
140 | 140 |
141 // Load the accumulator with the default return value (either -Infinity or | 141 // Load the accumulator with the default return value (either -Infinity or |
142 // +Infinity), with the tagged value in t1 and the double value in f0. | 142 // +Infinity), with the tagged value in t1 and the double value in f0. |
143 __ LoadRoot(t1, root_index); | 143 __ LoadRoot(t1, root_index); |
144 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); | 144 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); |
145 __ Addu(a3, a0, 1); | |
146 | 145 |
147 Label done_loop, loop; | 146 Label done_loop, loop; |
| 147 __ mov(a3, a0); |
148 __ bind(&loop); | 148 __ bind(&loop); |
149 { | 149 { |
150 // Check if all parameters done. | 150 // Check if all parameters done. |
151 __ Dsubu(a0, a0, Operand(1)); | 151 __ Dsubu(a3, a3, Operand(1)); |
152 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); | 152 __ Branch(&done_loop, lt, a3, Operand(zero_reg)); |
153 | 153 |
154 // Load the next parameter tagged value into a2. | 154 // Load the next parameter tagged value into a2. |
155 __ Dlsa(at, sp, a0, kPointerSizeLog2); | 155 __ Dlsa(at, sp, a3, kPointerSizeLog2); |
156 __ ld(a2, MemOperand(at)); | 156 __ ld(a2, MemOperand(at)); |
157 | 157 |
158 // Load the double value of the parameter into f2, maybe converting the | 158 // Load the double value of the parameter into f2, maybe converting the |
159 // parameter to a number first using the ToNumber builtin if necessary. | 159 // parameter to a number first using the ToNumber builtin if necessary. |
160 Label convert, convert_smi, convert_number, done_convert; | 160 Label convert, convert_smi, convert_number, done_convert; |
161 __ bind(&convert); | 161 __ bind(&convert); |
162 __ JumpIfSmi(a2, &convert_smi); | 162 __ JumpIfSmi(a2, &convert_smi); |
163 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); | 163 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); |
164 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number); | 164 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number); |
165 { | 165 { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 __ jmp(&loop); | 217 __ jmp(&loop); |
218 | 218 |
219 // At least one side is NaN, which means that the result will be NaN too. | 219 // At least one side is NaN, which means that the result will be NaN too. |
220 __ bind(&compare_nan); | 220 __ bind(&compare_nan); |
221 __ LoadRoot(t1, Heap::kNanValueRootIndex); | 221 __ LoadRoot(t1, Heap::kNanValueRootIndex); |
222 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); | 222 __ ldc1(f0, FieldMemOperand(t1, HeapNumber::kValueOffset)); |
223 __ jmp(&loop); | 223 __ jmp(&loop); |
224 } | 224 } |
225 | 225 |
226 __ bind(&done_loop); | 226 __ bind(&done_loop); |
227 __ Dlsa(sp, sp, a3, kPointerSizeLog2); | 227 // Drop all slots, including the receiver. |
| 228 __ Daddu(a0, a0, Operand(1)); |
| 229 __ Dlsa(sp, sp, a0, kPointerSizeLog2); |
228 __ Ret(USE_DELAY_SLOT); | 230 __ Ret(USE_DELAY_SLOT); |
229 __ mov(v0, t1); // In delay slot. | 231 __ mov(v0, t1); // In delay slot. |
230 } | 232 } |
231 | 233 |
232 // static | 234 // static |
233 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { | 235 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
234 // ----------- S t a t e ------------- | 236 // ----------- S t a t e ------------- |
235 // -- a0 : number of arguments | 237 // -- a0 : number of arguments |
236 // -- a1 : constructor function | 238 // -- a1 : constructor function |
237 // -- ra : return address | 239 // -- ra : return address |
(...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2996 } | 2998 } |
2997 } | 2999 } |
2998 | 3000 |
2999 | 3001 |
3000 #undef __ | 3002 #undef __ |
3001 | 3003 |
3002 } // namespace internal | 3004 } // namespace internal |
3003 } // namespace v8 | 3005 } // namespace v8 |
3004 | 3006 |
3005 #endif // V8_TARGET_ARCH_MIPS64 | 3007 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |