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

Unified Diff: runtime/vm/intrinsifier_ia32.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.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intrinsifier_ia32.cc
===================================================================
--- runtime/vm/intrinsifier_ia32.cc (revision 12015)
+++ runtime/vm/intrinsifier_ia32.cc (working copy)
@@ -1169,6 +1169,22 @@
}
+bool Intrinsifier::Double_toInt(Assembler* assembler) {
+ __ movl(EAX, Address(ESP, +1 * kWordSize));
+ __ movsd(XMM0, FieldAddress(EAX, Double::value_offset()));
+ __ cvttsd2si(EAX, XMM0);
+ // Overflow is signalled with minint.
+ Label fall_through;
+ // Check for overflow and that it fits into Smi.
+ __ cmpl(EAX, Immediate(0xC0000000));
+ __ j(NEGATIVE, &fall_through, Assembler::kNearJump);
+ __ SmiTag(EAX);
+ __ ret();
+ __ Bind(&fall_through);
+ return false;
+}
+
+
// Argument type is not known
bool Intrinsifier::Math_sqrt(Assembler* assembler) {
Label fall_through, is_smi, double_op;
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/intrinsifier_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698