| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 __ jmp(&double_op); | 1151 __ jmp(&double_op); |
| 1152 | 1152 |
| 1153 __ Bind(&alloc_failed); | 1153 __ Bind(&alloc_failed); |
| 1154 __ ffree(0); | 1154 __ ffree(0); |
| 1155 __ fincstp(); | 1155 __ fincstp(); |
| 1156 | 1156 |
| 1157 __ Bind(&fall_through); | 1157 __ Bind(&fall_through); |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 | 1160 |
| 1161 bool Intrinsifier::Double_toInt(Assembler* assembler) { |
| 1162 __ movq(RAX, Address(RSP, +1 * kWordSize)); |
| 1163 __ movsd(XMM0, FieldAddress(RAX, Double::value_offset())); |
| 1164 __ cvttsd2siq(RAX, XMM0); |
| 1165 // Overflow is signalled with minint. |
| 1166 Label fall_through; |
| 1167 // Check for overflow and that it fits into Smi. |
| 1168 __ cmpq(RAX, Immediate(0xC000000000000000)); |
| 1169 __ j(NEGATIVE, &fall_through, Assembler::kNearJump); |
| 1170 __ SmiTag(RAX); |
| 1171 __ ret(); |
| 1172 __ Bind(&fall_through); |
| 1173 return false; |
| 1174 } |
| 1175 |
| 1176 |
| 1161 bool Intrinsifier::Math_sqrt(Assembler* assembler) { | 1177 bool Intrinsifier::Math_sqrt(Assembler* assembler) { |
| 1162 Label fall_through, is_smi, double_op; | 1178 Label fall_through, is_smi, double_op; |
| 1163 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); | 1179 TestLastArgumentIsDouble(assembler, &is_smi, &fall_through); |
| 1164 // Argument is double and is in RAX. | 1180 // Argument is double and is in RAX. |
| 1165 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); | 1181 __ movsd(XMM1, FieldAddress(RAX, Double::value_offset())); |
| 1166 __ Bind(&double_op); | 1182 __ Bind(&double_op); |
| 1167 __ sqrtsd(XMM0, XMM1); | 1183 __ sqrtsd(XMM0, XMM1); |
| 1168 const Class& double_class = Class::Handle( | 1184 const Class& double_class = Class::Handle( |
| 1169 Isolate::Current()->object_store()->double_class()); | 1185 Isolate::Current()->object_store()->double_class()); |
| 1170 AssemblerMacros::TryAllocate(assembler, | 1186 AssemblerMacros::TryAllocate(assembler, |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 __ LoadObject(RAX, bool_true); | 1378 __ LoadObject(RAX, bool_true); |
| 1363 __ ret(); | 1379 __ ret(); |
| 1364 return true; | 1380 return true; |
| 1365 } | 1381 } |
| 1366 | 1382 |
| 1367 #undef __ | 1383 #undef __ |
| 1368 | 1384 |
| 1369 } // namespace dart | 1385 } // namespace dart |
| 1370 | 1386 |
| 1371 #endif // defined TARGET_ARCH_X64 | 1387 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |