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

Unified Diff: test/mjsunit/math-round.js

Issue 7514040: tighten invariants of HValue::InferRange (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: another wee presubmit thing, sigh Created 9 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
« test/mjsunit/math-floor.js ('K') | « test/mjsunit/math-floor.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/math-round.js
diff --git a/test/mjsunit/math-round.js b/test/mjsunit/math-round.js
index 1366557f6b8b3bbccf9b4d4a2156442706dba405..9fba720d4603e3a6c2edd69ddb88c2a9d3e8f996 100644
--- a/test/mjsunit/math-round.js
+++ b/test/mjsunit/math-round.js
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2010, 2011 the V8 project authors. All rights reserved.
Kevin Millikin (Chromium) 2011/08/02 10:24:14 We just update the copyright date to 2011, not a r
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -44,6 +44,22 @@ testRound(Infinity, Infinity);
testRound(-Infinity, -Infinity);
testRound(NaN, NaN);
+// Ensure that a negative zero coming from Math.round is properly
+// handled by other ops that take unboxed doubles. See cr7514040.
+function roundsum(i,n) {
+ var ret = Math.round(n);
+ while (--i > 0) {
+ ret += Math.round(n);
+ }
+ return ret;
+}
+assertEquals(-0, roundsum(1000,-0));
+%OptimizeFunctionOnNextCall(roundsum);
+// It seems that %OptimizeFunctionOnNextCall doesn't always work! Here
+// we push iterations up to a large number to ensure that we try to
+// unbox doubles as much as possible.
+assertEquals(-0, roundsum(1000000,-0));
+
testRound(1, 0.5);
testRound(1, 0.7);
testRound(1, 1);
« test/mjsunit/math-floor.js ('K') | « test/mjsunit/math-floor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698