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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 __ vmovrrd(R0, R1, D0); // R1:R0 <- D0, so sign bit is in bit 31 of R1. | 1301 __ vmovrrd(R0, R1, D0); // R1:R0 <- D0, so sign bit is in bit 31 of R1. |
1302 __ mov(R1, ShifterOperand(R1, LSR, 31)); | 1302 __ mov(R1, ShifterOperand(R1, LSR, 31)); |
1303 __ tst(R1, ShifterOperand(1)); | 1303 __ tst(R1, ShifterOperand(1)); |
1304 __ b(&is_true, NE); // Sign bit set. | 1304 __ b(&is_true, NE); // Sign bit set. |
1305 __ b(&is_false); | 1305 __ b(&is_false); |
1306 return true; | 1306 return true; |
1307 } | 1307 } |
1308 | 1308 |
1309 | 1309 |
1310 bool Intrinsifier::Double_toInt(Assembler* assembler) { | 1310 bool Intrinsifier::Double_toInt(Assembler* assembler) { |
1311 Label fall_through; | |
1312 | |
1311 __ ldr(R0, Address(SP, 0 * kWordSize)); | 1313 __ ldr(R0, Address(SP, 0 * kWordSize)); |
1312 __ LoadDFromOffset(D0, R0, Double::value_offset() - kHeapObjectTag); | 1314 __ LoadDFromOffset(D0, R0, Double::value_offset() - kHeapObjectTag); |
1315 | |
1316 // Explicit NaN check, since ARM gives an FPU exception if you try to | |
1317 // convert NaN to an int. | |
1318 __ vcmpd(D0, D0); | |
1319 __ vmstat(); | |
1320 __ b(&fall_through, VS); | |
1321 | |
1313 __ vcvtid(S0, D0); | 1322 __ vcvtid(S0, D0); |
Ivan Posva
2013/06/06 22:03:55
Should we update the simulator to throw an excepti
| |
1314 __ vmovrs(R0, S0); | 1323 __ vmovrs(R0, S0); |
1315 // Overflow is signaled with minint. | 1324 // Overflow is signaled with minint. |
1316 Label fall_through; | |
1317 // Check for overflow and that it fits into Smi. | 1325 // Check for overflow and that it fits into Smi. |
1318 __ CompareImmediate(R0, 0xC0000000); | 1326 __ CompareImmediate(R0, 0xC0000000); |
1319 __ b(&fall_through, MI); | 1327 __ b(&fall_through, MI); |
1320 __ SmiTag(R0); | 1328 __ SmiTag(R0); |
1321 __ Ret(); | 1329 __ Ret(); |
1322 __ Bind(&fall_through); | 1330 __ Bind(&fall_through); |
1323 return false; | 1331 return false; |
1324 } | 1332 } |
1325 | 1333 |
1326 | 1334 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1679 __ Bind(&ok); | 1687 __ Bind(&ok); |
1680 __ Ret(); | 1688 __ Ret(); |
1681 | 1689 |
1682 __ Bind(&fall_through); | 1690 __ Bind(&fall_through); |
1683 return false; | 1691 return false; |
1684 } | 1692 } |
1685 | 1693 |
1686 } // namespace dart | 1694 } // namespace dart |
1687 | 1695 |
1688 #endif // defined TARGET_ARCH_ARM | 1696 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |