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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
10 | 10 |
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 __ comisd(XMM0, XMM0); | 1559 __ comisd(XMM0, XMM0); |
1560 __ j(PARITY_EVEN, &is_true, Assembler::kNearJump); // NaN -> true; | 1560 __ j(PARITY_EVEN, &is_true, Assembler::kNearJump); // NaN -> true; |
1561 __ LoadObject(EAX, Bool::False()); | 1561 __ LoadObject(EAX, Bool::False()); |
1562 __ ret(); | 1562 __ ret(); |
1563 __ Bind(&is_true); | 1563 __ Bind(&is_true); |
1564 __ LoadObject(EAX, Bool::True()); | 1564 __ LoadObject(EAX, Bool::True()); |
1565 __ ret(); | 1565 __ ret(); |
1566 } | 1566 } |
1567 | 1567 |
1568 | 1568 |
| 1569 void Intrinsifier::Double_getIsInfinite(Assembler* assembler) { |
| 1570 Label not_inf; |
| 1571 __ movl(EAX, Address(ESP, +1 * kWordSize)); |
| 1572 __ movl(EBX, FieldAddress(EAX, Double::value_offset())); |
| 1573 |
| 1574 // If the low word isn't zero, then it isn't infinity. |
| 1575 __ cmpl(EBX, Immediate(0)); |
| 1576 __ j(NOT_EQUAL, ¬_inf, Assembler::kNearJump); |
| 1577 // Check the high word. |
| 1578 __ movl(EBX, FieldAddress(EAX, Double::value_offset() + kWordSize)); |
| 1579 // Mask off sign bit. |
| 1580 __ andl(EBX, Immediate(0x7FFFFFFF)); |
| 1581 // Compare with +infinity. |
| 1582 __ cmpl(EBX, Immediate(0x7FF00000)); |
| 1583 __ j(NOT_EQUAL, ¬_inf, Assembler::kNearJump); |
| 1584 __ LoadObject(EAX, Bool::True()); |
| 1585 __ ret(); |
| 1586 |
| 1587 __ Bind(¬_inf); |
| 1588 __ LoadObject(EAX, Bool::False()); |
| 1589 __ ret(); |
| 1590 } |
| 1591 |
| 1592 |
1569 void Intrinsifier::Double_getIsNegative(Assembler* assembler) { | 1593 void Intrinsifier::Double_getIsNegative(Assembler* assembler) { |
1570 Label is_false, is_true, is_zero; | 1594 Label is_false, is_true, is_zero; |
1571 __ movl(EAX, Address(ESP, +1 * kWordSize)); | 1595 __ movl(EAX, Address(ESP, +1 * kWordSize)); |
1572 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); | 1596 __ movsd(XMM0, FieldAddress(EAX, Double::value_offset())); |
1573 __ xorpd(XMM1, XMM1); // 0.0 -> XMM1. | 1597 __ xorpd(XMM1, XMM1); // 0.0 -> XMM1. |
1574 __ comisd(XMM0, XMM1); | 1598 __ comisd(XMM0, XMM1); |
1575 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false. | 1599 __ j(PARITY_EVEN, &is_false, Assembler::kNearJump); // NaN -> false. |
1576 __ j(EQUAL, &is_zero, Assembler::kNearJump); // Check for negative zero. | 1600 __ j(EQUAL, &is_zero, Assembler::kNearJump); // Check for negative zero. |
1577 __ j(ABOVE_EQUAL, &is_false, Assembler::kNearJump); // >= 0 -> false. | 1601 __ j(ABOVE_EQUAL, &is_false, Assembler::kNearJump); // >= 0 -> false. |
1578 __ Bind(&is_true); | 1602 __ Bind(&is_true); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 __ Bind(&true_label); | 2178 __ Bind(&true_label); |
2155 __ LoadObject(EAX, Bool::True()); | 2179 __ LoadObject(EAX, Bool::True()); |
2156 __ ret(); | 2180 __ ret(); |
2157 } | 2181 } |
2158 | 2182 |
2159 #undef __ | 2183 #undef __ |
2160 | 2184 |
2161 } // namespace dart | 2185 } // namespace dart |
2162 | 2186 |
2163 #endif // defined TARGET_ARCH_IA32 | 2187 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |