Chromium Code Reviews| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // +Infinity), with the tagged value in a1 and the double value in f0. | 158 // +Infinity), with the tagged value in a1 and the double value in f0. |
| 159 __ LoadRoot(a1, root_index); | 159 __ LoadRoot(a1, root_index); |
| 160 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); | 160 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
| 161 __ mov(a3, a0); | 161 __ mov(a3, a0); |
| 162 | 162 |
| 163 Label done_loop, loop; | 163 Label done_loop, loop; |
| 164 __ bind(&loop); | 164 __ bind(&loop); |
| 165 { | 165 { |
| 166 // Check if all parameters done. | 166 // Check if all parameters done. |
| 167 __ Dsubu(a0, a0, Operand(1)); | 167 __ Dsubu(a0, a0, Operand(1)); |
| 168 __ Branch(USE_DELAY_SLOT, &done_loop, lt, a0, Operand(zero_reg)); | 168 __ Branch(&done_loop, lt, a0, Operand(zero_reg)); |
| 169 | 169 |
| 170 // Load the next parameter tagged value into a2. | 170 // Load the next parameter tagged value into a2. |
| 171 __ dsll(at, a0, kPointerSizeLog2); // In delay slot | 171 __ Dlsa(at, sp, a0, kPointerSizeLog2); |
| 172 __ Daddu(at, at, sp); | |
| 173 __ ld(a2, MemOperand(at)); | 172 __ ld(a2, MemOperand(at)); |
| 174 | 173 |
| 175 // Load the double value of the parameter into f2, maybe converting the | 174 // Load the double value of the parameter into f2, maybe converting the |
| 176 // parameter to a number first using the ToNumberStub if necessary. | 175 // parameter to a number first using the ToNumberStub if necessary. |
| 177 Label convert, convert_smi, convert_number, done_convert; | 176 Label convert, convert_smi, convert_number, done_convert; |
| 178 __ bind(&convert); | 177 __ bind(&convert); |
| 179 __ JumpIfSmi(a2, &convert_smi); | 178 __ JumpIfSmi(a2, &convert_smi); |
| 180 __ ld(t0, FieldMemOperand(a2, HeapObject::kMapOffset)); | 179 __ ld(a4, FieldMemOperand(a2, HeapObject::kMapOffset)); |
| 181 __ JumpIfRoot(t0, Heap::kHeapNumberMapRootIndex, &convert_number); | 180 __ JumpIfRoot(a4, Heap::kHeapNumberMapRootIndex, &convert_number); |
| 182 { | 181 { |
| 183 // Parameter is not a Number, use the ToNumberStub to convert it. | 182 // Parameter is not a Number, use the ToNumberStub to convert it. |
| 184 FrameScope scope(masm, StackFrame::INTERNAL); | 183 FrameScope scope(masm, StackFrame::INTERNAL); |
| 185 __ SmiTag(a0); | 184 __ SmiTag(a0); |
| 186 __ SmiTag(a3); | 185 __ SmiTag(a3); |
| 187 __ Push(a0, a1, a3); | 186 __ Push(a0, a1, a3); |
| 188 __ mov(a0, a2); | 187 __ mov(a0, a2); |
| 189 ToNumberStub stub(masm->isolate()); | 188 ToNumberStub stub(masm->isolate()); |
| 190 __ CallStub(&stub); | 189 __ CallStub(&stub); |
| 191 __ mov(a2, v0); | 190 __ mov(a2, v0); |
| 192 __ Pop(a0, a1, a3); | 191 __ Pop(a0, a1, a3); |
| 193 { | 192 { |
| 194 // Restore the double accumulator value (f0). | 193 // Restore the double accumulator value (f0). |
| 195 Label restore_smi, done_restore; | 194 Label restore_smi, done_restore; |
| 196 __ JumpIfSmi(a1, &restore_smi); | 195 __ JumpIfSmi(a1, &restore_smi); |
| 197 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); | 196 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
| 198 __ jmp(&done_restore); | 197 __ jmp(&done_restore); |
| 199 __ bind(&restore_smi); | 198 __ bind(&restore_smi); |
| 200 __ SmiToDoubleFPURegister(a1, f0, t0); | 199 __ SmiToDoubleFPURegister(a1, f0, a4); |
| 201 __ bind(&done_restore); | 200 __ bind(&done_restore); |
| 202 } | 201 } |
| 203 __ SmiUntag(a3); | 202 __ SmiUntag(a3); |
| 204 __ SmiUntag(a0); | 203 __ SmiUntag(a0); |
| 205 } | 204 } |
| 206 __ jmp(&convert); | 205 __ jmp(&convert); |
| 207 __ bind(&convert_number); | 206 __ bind(&convert_number); |
| 208 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); | 207 __ ldc1(f2, FieldMemOperand(a2, HeapNumber::kValueOffset)); |
| 209 __ jmp(&done_convert); | 208 __ jmp(&done_convert); |
| 210 __ bind(&convert_smi); | 209 __ bind(&convert_smi); |
| 211 __ SmiToDoubleFPURegister(a2, f2, t0); | 210 __ SmiToDoubleFPURegister(a2, f2, a4); |
| 212 __ bind(&done_convert); | 211 __ bind(&done_convert); |
| 213 | 212 |
| 214 // Perform the actual comparison with the accumulator value on the left hand | 213 // Perform the actual comparison with the accumulator value on the left hand |
| 215 // side (d1) and the next parameter value on the right hand side (d2). | 214 // side (d1) and the next parameter value on the right hand side (d2). |
| 216 Label compare_equal, compare_nan, compare_swap; | 215 Label compare_equal, compare_nan, compare_swap; |
| 217 __ BranchF(&compare_equal, &compare_nan, eq, f0, f2); | 216 __ BranchF(&compare_equal, &compare_nan, eq, f0, f2); |
| 218 __ BranchF(&compare_swap, nullptr, cc, f0, f2); | 217 __ BranchF(&compare_swap, nullptr, cc, f0, f2); |
| 219 __ Branch(&loop); | 218 __ Branch(&loop); |
| 220 | 219 |
| 221 // Left and right hand side are equal, check for -0 vs. +0. | 220 // Left and right hand side are equal, check for -0 vs. +0. |
| 222 __ bind(&compare_equal); | 221 __ bind(&compare_equal); |
| 223 __ FmoveHigh(t0, reg); | 222 __ FmoveHigh(a4, reg); |
|
Benedikt Meurer
2016/01/29 05:14:22
In this case it is sufficient to know that the val
balazs.kilvady
2016/01/29 11:09:21
I have tryed that solution and that was fine for m
| |
| 224 __ Branch(&loop, ne, t0, Operand(0x80000000)); | 223 // Make a4 unsigned. |
| 224 __ dsll32(a4, a4, 0); | |
| 225 __ Branch(&loop, ne, a4, Operand(0x8000000000000000)); | |
| 225 | 226 |
| 226 // Result is on the right hand side. | 227 // Result is on the right hand side. |
| 227 __ bind(&compare_swap); | 228 __ bind(&compare_swap); |
| 228 __ mov_d(f0, f2); | 229 __ mov_d(f0, f2); |
| 229 __ mov(a1, a2); | 230 __ mov(a1, a2); |
| 230 __ jmp(&loop); | 231 __ jmp(&loop); |
| 231 | 232 |
| 232 // At least one side is NaN, which means that the result will be NaN too. | 233 // At least one side is NaN, which means that the result will be NaN too. |
| 233 __ bind(&compare_nan); | 234 __ bind(&compare_nan); |
| 234 __ LoadRoot(a1, Heap::kNanValueRootIndex); | 235 __ LoadRoot(a1, Heap::kNanValueRootIndex); |
| 235 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); | 236 __ ldc1(f0, FieldMemOperand(a1, HeapNumber::kValueOffset)); |
| 236 __ jmp(&loop); | 237 __ jmp(&loop); |
| 237 } | 238 } |
| 238 | 239 |
| 239 __ bind(&done_loop); | 240 __ bind(&done_loop); |
| 240 __ dsll(a3, a3, kPointerSizeLog2); | 241 __ Dlsa(sp, sp, a3, kPointerSizeLog2); |
| 241 __ Daddu(sp, sp, a3); | |
| 242 __ mov(v0, a1); | 242 __ mov(v0, a1); |
| 243 __ DropAndRet(1); | 243 __ DropAndRet(1); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // static | 246 // static |
| 247 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { | 247 void Builtins::Generate_NumberConstructor(MacroAssembler* masm) { |
| 248 // ----------- S t a t e ------------- | 248 // ----------- S t a t e ------------- |
| 249 // -- a0 : number of arguments | 249 // -- a0 : number of arguments |
| 250 // -- a1 : constructor function | 250 // -- a1 : constructor function |
| 251 // -- ra : return address | 251 // -- ra : return address |
| (...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2770 } | 2770 } |
| 2771 } | 2771 } |
| 2772 | 2772 |
| 2773 | 2773 |
| 2774 #undef __ | 2774 #undef __ |
| 2775 | 2775 |
| 2776 } // namespace internal | 2776 } // namespace internal |
| 2777 } // namespace v8 | 2777 } // namespace v8 |
| 2778 | 2778 |
| 2779 #endif // V8_TARGET_ARCH_MIPS64 | 2779 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |