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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intrinsifier_ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_x64.cc
===================================================================
--- runtime/vm/intrinsifier_x64.cc (revision 12015)
+++ runtime/vm/intrinsifier_x64.cc (working copy)
@@ -1158,6 +1158,22 @@
}
+bool Intrinsifier::Double_toInt(Assembler* assembler) {
+ __ movq(RAX, Address(RSP, +1 * kWordSize));
+ __ movsd(XMM0, FieldAddress(RAX, Double::value_offset()));
+ __ cvttsd2siq(RAX, XMM0);
+ // Overflow is signalled with minint.
+ Label fall_through;
+ // Check for overflow and that it fits into Smi.
+ __ cmpq(RAX, Immediate(0xC000000000000000));
+ __ j(NEGATIVE, &fall_through, Assembler::kNearJump);
+ __ SmiTag(RAX);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
bool Intrinsifier::Math_sqrt(Assembler* assembler) {
Label fall_through, is_smi, double_op;
TestLastArgumentIsDouble(assembler, &is_smi, &fall_through);
« 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