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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 SlowTruncateToI(result_reg, esp, 0); | 339 SlowTruncateToI(result_reg, esp, 0); |
340 add(esp, Immediate(kDoubleSize)); | 340 add(esp, Immediate(kDoubleSize)); |
341 } else { | 341 } else { |
342 SlowTruncateToI(result_reg, input_reg); | 342 SlowTruncateToI(result_reg, input_reg); |
343 } | 343 } |
344 } | 344 } |
345 bind(&done); | 345 bind(&done); |
346 } | 346 } |
347 | 347 |
348 | 348 |
349 void MacroAssembler::TaggedToI(Register result_reg, | |
350 Register input_reg, | |
351 XMMRegister temp, | |
352 MinusZeroMode minus_zero_mode, | |
353 Label* lost_precision) { | |
354 Label done; | |
355 DCHECK(!temp.is(xmm0)); | |
356 | |
357 cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | |
358 isolate()->factory()->heap_number_map()); | |
359 j(not_equal, lost_precision, Label::kNear); | |
360 | |
361 DCHECK(!temp.is(no_xmm_reg)); | |
362 | |
363 movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | |
364 cvttsd2si(result_reg, Operand(xmm0)); | |
365 Cvtsi2sd(temp, Operand(result_reg)); | |
366 ucomisd(xmm0, temp); | |
367 RecordComment("Deferred TaggedToI: lost precision"); | |
368 j(not_equal, lost_precision, Label::kNear); | |
369 RecordComment("Deferred TaggedToI: NaN"); | |
370 j(parity_even, lost_precision, Label::kNear); | |
371 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | |
372 test(result_reg, Operand(result_reg)); | |
373 j(not_zero, &done, Label::kNear); | |
374 movmskpd(result_reg, xmm0); | |
375 and_(result_reg, 1); | |
376 RecordComment("Deferred TaggedToI: minus zero"); | |
377 j(not_zero, lost_precision, Label::kNear); | |
378 } | |
379 bind(&done); | |
380 } | |
381 | |
382 | |
383 void MacroAssembler::LoadUint32(XMMRegister dst, | 349 void MacroAssembler::LoadUint32(XMMRegister dst, |
384 Register src) { | 350 Register src) { |
385 Label done; | 351 Label done; |
386 cmp(src, Immediate(0)); | 352 cmp(src, Immediate(0)); |
387 ExternalReference uint32_bias = | 353 ExternalReference uint32_bias = |
388 ExternalReference::address_of_uint32_bias(); | 354 ExternalReference::address_of_uint32_bias(); |
389 Cvtsi2sd(dst, src); | 355 Cvtsi2sd(dst, src); |
390 j(not_sign, &done, Label::kNear); | 356 j(not_sign, &done, Label::kNear); |
391 addsd(dst, Operand::StaticVariable(uint32_bias)); | 357 addsd(dst, Operand::StaticVariable(uint32_bias)); |
392 bind(&done); | 358 bind(&done); |
(...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3428 if (mag.shift > 0) sar(edx, mag.shift); | 3394 if (mag.shift > 0) sar(edx, mag.shift); |
3429 mov(eax, dividend); | 3395 mov(eax, dividend); |
3430 shr(eax, 31); | 3396 shr(eax, 31); |
3431 add(edx, eax); | 3397 add(edx, eax); |
3432 } | 3398 } |
3433 | 3399 |
3434 | 3400 |
3435 } } // namespace v8::internal | 3401 } } // namespace v8::internal |
3436 | 3402 |
3437 #endif // V8_TARGET_ARCH_IA32 | 3403 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |