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

Unified Diff: runtime/vm/intermediate_language_arm.cc

Issue 18295007: Fixes bug in double to int conversion on arm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/flow_graph_compiler_arm.cc ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_arm.cc
===================================================================
--- runtime/vm/intermediate_language_arm.cc (revision 24950)
+++ runtime/vm/intermediate_language_arm.cc (working copy)
@@ -3029,10 +3029,18 @@
ASSERT(result == R0);
ASSERT(result != value_obj);
__ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag);
+
+ Label do_call, done;
+ // First check for NaN. Checking for minint after the conversion doesn't work
+ // on ARM because vcvtid gives 0 for NaN.
+ __ vcmpd(DTMP, DTMP);
+ __ vmstat();
+ __ b(&do_call, VS);
+
__ vcvtid(STMP, DTMP);
__ vmovrs(result, STMP);
// Overflow is signaled with minint.
- Label do_call, done;
+
// Check for overflow and that it fits into Smi.
__ CompareImmediate(result, 0xC0000000);
__ b(&do_call, MI);
@@ -3071,6 +3079,12 @@
Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptDoubleToSmi);
Register result = locs()->out().reg();
DRegister value = locs()->in(0).fpu_reg();
+ // First check for NaN. Checking for minint after the conversion doesn't work
+ // on ARM because vcvtid gives 0 for NaN.
+ __ vcmpd(value, value);
+ __ vmstat();
+ __ b(deopt, VS);
+
__ vcvtid(STMP, value);
__ vmovrs(result, STMP);
// Check for overflow and that it fits into Smi.
« no previous file with comments | « runtime/vm/flow_graph_compiler_arm.cc ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698