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

Unified Diff: test/mjsunit/math-floor-negative.js

Issue 10636057: Port r11517 (not deopt Math.floor on negative input) to x64, sse2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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 | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/math-floor-negative.js
diff --git a/test/mjsunit/regress/regress-2110.js b/test/mjsunit/math-floor-negative.js
similarity index 70%
copy from test/mjsunit/regress/regress-2110.js
copy to test/mjsunit/math-floor-negative.js
index d7f78d26a7b4d16c4217d2b0ac136e52e4542eb1..4cabff577eafc1f7eb435f0e4b5ae3db27d1e0ae 100644
--- a/test/mjsunit/regress/regress-2110.js
+++ b/test/mjsunit/math-floor-negative.js
@@ -25,29 +25,35 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --noenable_sse4_1 --allow-natives-syntax
-var uint8 = new Uint8Array(1);
-
-function test() {
- uint8[0] = 0x800000aa;
- assertEquals(0xaa, uint8[0]);
+function test1() {
+ // Trigger overflow when converting/truncating double to integer.
+ // Divide by 10 to avoid overflow when smi-tagging at the end.
+ return Math.floor(-100000000000.5) / 10;
}
-test();
-test();
-test();
-%OptimizeFunctionOnNextCall(test);
-test();
-
-var uint32 = new Uint32Array(1);
-
function test2() {
- uint32[0] = 0x80123456789abcde;
- assertEquals(0x789ac000, uint32[0]);
+ // Trigger no overflow.
+ return Math.floor(-100.2);
}
+function test3() {
+ // Trigger overflow when compensating by subtracting after compare.
+ // Divide by 10 to avoid overflow when smi-tagging at the end.
+ return Math.floor(-2147483648.1) / 10;
+}
+
+test1();
+test1();
+%OptimizeFunctionOnNextCall(test1);
test2();
test2();
%OptimizeFunctionOnNextCall(test2);
-test2();
+test3();
+test3();
+%OptimizeFunctionOnNextCall(test3);
+
+assertEquals(-10000000000.1, test1());
+assertEquals(-101, test2());
+assertEquals(-214748364.9, test3());
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698