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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 3527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3538 // Bit 0 contains the sign of the double in input_reg. | 3538 // Bit 0 contains the sign of the double in input_reg. |
3539 // If input was positive, we are ok and return 0, otherwise | 3539 // If input was positive, we are ok and return 0, otherwise |
3540 // jump to conversion_failed. | 3540 // jump to conversion_failed. |
3541 andl(result_reg, Immediate(1)); | 3541 andl(result_reg, Immediate(1)); |
3542 j(not_zero, conversion_failed, dst); | 3542 j(not_zero, conversion_failed, dst); |
3543 bind(&done); | 3543 bind(&done); |
3544 } | 3544 } |
3545 } | 3545 } |
3546 | 3546 |
3547 | 3547 |
3548 void MacroAssembler::TaggedToI(Register result_reg, | |
3549 Register input_reg, | |
3550 XMMRegister temp, | |
3551 MinusZeroMode minus_zero_mode, | |
3552 Label* lost_precision, | |
3553 Label::Distance dst) { | |
3554 Label done; | |
3555 DCHECK(!temp.is(xmm0)); | |
3556 | |
3557 // Heap number map check. | |
3558 CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | |
3559 Heap::kHeapNumberMapRootIndex); | |
3560 j(not_equal, lost_precision, dst); | |
3561 | |
3562 movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | |
3563 cvttsd2si(result_reg, xmm0); | |
3564 Cvtlsi2sd(temp, result_reg); | |
3565 ucomisd(xmm0, temp); | |
3566 RecordComment("Deferred TaggedToI: lost precision"); | |
3567 j(not_equal, lost_precision, dst); | |
3568 RecordComment("Deferred TaggedToI: NaN"); | |
3569 j(parity_even, lost_precision, dst); // NaN. | |
3570 if (minus_zero_mode == FAIL_ON_MINUS_ZERO) { | |
3571 testl(result_reg, result_reg); | |
3572 j(not_zero, &done, Label::kNear); | |
3573 movmskpd(result_reg, xmm0); | |
3574 andl(result_reg, Immediate(1)); | |
3575 j(not_zero, lost_precision, dst); | |
3576 } | |
3577 bind(&done); | |
3578 } | |
3579 | |
3580 | |
3581 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3548 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3582 Register descriptors) { | 3549 Register descriptors) { |
3583 movp(descriptors, FieldOperand(map, Map::kDescriptorsOffset)); | 3550 movp(descriptors, FieldOperand(map, Map::kDescriptorsOffset)); |
3584 } | 3551 } |
3585 | 3552 |
3586 | 3553 |
3587 void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) { | 3554 void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) { |
3588 movl(dst, FieldOperand(map, Map::kBitField3Offset)); | 3555 movl(dst, FieldOperand(map, Map::kBitField3Offset)); |
3589 DecodeField<Map::NumberOfOwnDescriptorsBits>(dst); | 3556 DecodeField<Map::NumberOfOwnDescriptorsBits>(dst); |
3590 } | 3557 } |
(...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5369 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5336 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
5370 movl(rax, dividend); | 5337 movl(rax, dividend); |
5371 shrl(rax, Immediate(31)); | 5338 shrl(rax, Immediate(31)); |
5372 addl(rdx, rax); | 5339 addl(rdx, rax); |
5373 } | 5340 } |
5374 | 5341 |
5375 | 5342 |
5376 } } // namespace v8::internal | 5343 } } // namespace v8::internal |
5377 | 5344 |
5378 #endif // V8_TARGET_ARCH_X64 | 5345 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |