Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: runtime/vm/intrinsifier_x64.cc

Issue 10914142: Intrinsify Double.toInt. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698