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/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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // +Infinity), with the tagged value in a1 and the double value in f0. | 159 // +Infinity), with the tagged value in a1 and the double value in f0. |
160 __ LoadRoot(a1, root_index); | 160 __ LoadRoot(a1, root_index); |
161 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); | 161 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
162 __ mov(a3, a0); | 162 __ mov(a3, a0); |
163 | 163 |
164 Label done_loop, loop; | 164 Label done_loop, loop; |
165 __ bind(&loop); | 165 __ bind(&loop); |
166 { | 166 { |
167 // Check if all parameters done. | 167 // Check if all parameters done. |
168 __ Subu(a0, a0, Operand(1)); | 168 __ Subu(a0, a0, Operand(1)); |
169 __ Branch(USE_DELAY_SLOT, &done_loop, lt, a0, Operand(zero_reg)); | 169 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); |
170 | 170 |
171 // Load the next parameter tagged value into a2. | 171 // Load the next parameter tagged value into a2. |
172 __ sll(at, a0, kPointerSizeLog2); // In delay slot | 172 __ Lsa(at, sp, a0, kPointerSizeLog2); |
173 __ Addu(at, at, sp); | |
174 __ lw(a2, MemOperand(at)); | 173 __ lw(a2, MemOperand(at)); |
175 | 174 |
176 // Load the double value of the parameter into f2, maybe converting the | 175 // Load the double value of the parameter into f2, maybe converting the |
177 // parameter to a number first using the ToNumberStub if necessary. | 176 // parameter to a number first using the ToNumberStub if necessary. |
178 Label convert, convert_smi, convert_number, done_convert; | 177 Label convert, convert_smi, convert_number, done_convert; |
179 __ bind(&convert); | 178 __ bind(&convert); |
180 __ JumpIfSmi(a2, &convert_smi); | 179 __ JumpIfSmi(a2, &convert_smi); |
181 __ lw(t0, FieldMemOperand(a2, HeapObject::kMapOffset)); | 180 __ lw(t0, FieldMemOperand(a2, HeapObject::kMapOffset)); |
182 __ JumpIfRoot(t0, Heap::kHeapNumberMapRootIndex, &convert_number); | 181 __ JumpIfRoot(t0, Heap::kHeapNumberMapRootIndex, &convert_number); |
183 { | 182 { |
(...skipping 22 matching lines...) Expand all Loading... |
206 } | 205 } |
207 __ jmp(&convert); | 206 __ jmp(&convert); |
208 __ bind(&convert_number); | 207 __ bind(&convert_number); |
209 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); | 208 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); |
210 __ jmp(&done_convert); | 209 __ jmp(&done_convert); |
211 __ bind(&convert_smi); | 210 __ bind(&convert_smi); |
212 __ SmiToDoubleFPURegister(a2, f2, t0); | 211 __ SmiToDoubleFPURegister(a2, f2, t0); |
213 __ bind(&done_convert); | 212 __ bind(&done_convert); |
214 | 213 |
215 // Perform the actual comparison with the accumulator value on the left hand | 214 // Perform the actual comparison with the accumulator value on the left hand |
216 // side (d1) and the next parameter value on the right hand side (d2). | 215 // side (f0) and the next parameter value on the right hand side (f2). |
217 Label compare_equal, compare_nan, compare_swap; | 216 Label compare_equal, compare_nan, compare_swap; |
218 __ BranchF(&compare_equal, &compare_nan, eq, f0, f2); | 217 __ BranchF(&compare_equal, &compare_nan, eq, f0, f2); |
219 __ BranchF(&compare_swap, nullptr, cc, f0, f2); | 218 __ BranchF(&compare_swap, nullptr, cc, f0, f2); |
220 __ Branch(&loop); | 219 __ Branch(&loop); |
221 | 220 |
222 // Left and right hand side are equal, check for -0 vs. +0. | 221 // Left and right hand side are equal, check for -0 vs. +0. |
223 __ bind(&compare_equal); | 222 __ bind(&compare_equal); |
224 __ FmoveHigh(t0, reg); | 223 __ FmoveHigh(t0, reg); |
225 __ Branch(&loop, ne, t0, Operand(0x80000000)); | 224 __ Branch(&loop, ne, t0, Operand(0x80000000)); |
226 | 225 |
227 // Result is on the right hand side. | 226 // Result is on the right hand side. |
228 __ bind(&compare_swap); | 227 __ bind(&compare_swap); |
229 __ mov_d(f0, f2); | 228 __ mov_d(f0, f2); |
230 __ mov(a1, a2); | 229 __ mov(a1, a2); |
231 __ jmp(&loop); | 230 __ jmp(&loop); |
232 | 231 |
233 // At least one side is NaN, which means that the result will be NaN too. | 232 // At least one side is NaN, which means that the result will be NaN too. |
234 __ bind(&compare_nan); | 233 __ bind(&compare_nan); |
235 __ LoadRoot(a1, Heap::kNanValueRootIndex); | 234 __ LoadRoot(a1, Heap::kNanValueRootIndex); |
236 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); | 235 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
237 __ jmp(&loop); | 236 __ jmp(&loop); |
238 } | 237 } |
239 | 238 |
240 __ bind(&done_loop); | 239 __ bind(&done_loop); |
241 __ sll(a3, a3, kPointerSizeLog2); | 240 __ Lsa(sp, sp, a3, kPointerSizeLog2); |
242 __ addu(sp, sp, a3); | |
243 __ mov(v0, a1); | 241 __ mov(v0, a1); |
244 __ DropAndRet(1); | 242 __ DropAndRet(1); |
245 } | 243 } |
246 | 244 |
247 // static | 245 // static |
248 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { | 246 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
249 // ----------- S t a t e ------------- | 247 // ----------- S t a t e ------------- |
250 // -- a0 : number of arguments | 248 // -- a0 : number of arguments |
251 // -- a1 : constructor function | 249 // -- a1 : constructor function |
252 // -- ra : return address | 250 // -- ra : return address |
(...skipping 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 } | 2776 } |
2779 } | 2777 } |
2780 | 2778 |
2781 | 2779 |
2782 #undef __ | 2780 #undef __ |
2783 | 2781 |
2784 } // namespace internal | 2782 } // namespace internal |
2785 } // namespace v8 | 2783 } // namespace v8 |
2786 | 2784 |
2787 #endif // V8_TARGET_ARCH_MIPS | 2785 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |