OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
9 | 9 |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 __ comisd(XMM0, XMM0); | 1427 __ comisd(XMM0, XMM0); |
1428 __ j(PARITY_EVEN, &is_true, Assembler::kNearJump); // NaN -> true; | 1428 __ j(PARITY_EVEN, &is_true, Assembler::kNearJump); // NaN -> true; |
1429 __ LoadObject(RAX, Bool::False()); | 1429 __ LoadObject(RAX, Bool::False()); |
1430 __ ret(); | 1430 __ ret(); |
1431 __ Bind(&is_true); | 1431 __ Bind(&is_true); |
1432 __ LoadObject(RAX, Bool::True()); | 1432 __ LoadObject(RAX, Bool::True()); |
1433 __ ret(); | 1433 __ ret(); |
1434 } | 1434 } |
1435 | 1435 |
1436 | 1436 |
| 1437 void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { |
| 1438 Label is_inf, done; |
| 1439 __ movq(RAX, Address(RSP, +1 * kWordSize)); |
| 1440 __ movq(RAX, FieldAddress(RAX, Double::value_offset())); |
| 1441 // Mask off the sign. |
| 1442 __ AndImmediate(RAX, Immediate(0x7FFFFFFFFFFFFFFFLL)); |
| 1443 // Compare with +infinity. |
| 1444 __ CompareImmediate(RAX, Immediate(0x7FF0000000000000LL)); |
| 1445 __ j(EQUAL, &is_inf, Assembler::kNearJump); |
| 1446 __ LoadObject(RAX, Bool::False()); |
| 1447 __ jmp(&done); |
| 1448 |
| 1449 __ Bind(&is_inf); |
| 1450 __ LoadObject(RAX, Bool::True()); |
| 1451 |
| 1452 __ Bind(&done); |
| 1453 __ ret(); |
| 1454 } |
| 1455 |
| 1456 |
1437 void Intrinsifier::Double_getIsNegative(Assembler* assembler) { | 1457 void Intrinsifier::Double_getIsNegative(Assembler* assembler) { |
1438 Label is_false, is_true, is_zero; | 1458 Label is_false, is_true, is_zero; |
1439 __ movq(RAX, Address(RSP, +1 * kWordSize)); | 1459 __ movq(RAX, Address(RSP, +1 * kWordSize)); |
1440 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); | 1460 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); |
1441 __ xorpd(XMM1, XMM1); // 0.0 -> XMM1. | 1461 __ xorpd(XMM1, XMM1); // 0.0 -> XMM1. |
1442 __ comisd(XMM0, XMM1); | 1462 __ comisd(XMM0, XMM1); |
1443 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false. | 1463 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false. |
1444 __ j(EQUAL, &is_zero, Assembler::kNearJump); // Check for negative zero. | 1464 __ j(EQUAL, &is_zero, Assembler::kNearJump); // Check for negative zero. |
1445 __ j(ABOVE_EQUAL, &is_false, Assembler::kNearJump); // >= 0 -> false. | 1465 __ j(ABOVE_EQUAL, &is_false, Assembler::kNearJump); // >= 0 -> false. |
1446 __ Bind(&is_true); | 1466 __ Bind(&is_true); |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 __ Bind(&true_label); | 2144 __ Bind(&true_label); |
2125 __ LoadObject(RAX, Bool::True()); | 2145 __ LoadObject(RAX, Bool::True()); |
2126 __ ret(); | 2146 __ ret(); |
2127 } | 2147 } |
2128 | 2148 |
2129 #undef __ | 2149 #undef __ |
2130 | 2150 |
2131 } // namespace dart | 2151 } // namespace dart |
2132 | 2152 |
2133 #endif // defined TARGET_ARCH_X64 | 2153 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |