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

Unified Diff: test/mjsunit/constant-folding.js

Issue 92008: Small changes to improve test coverage in codegen-ia32.cc. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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
Index: test/mjsunit/constant-folding.js
===================================================================
--- test/mjsunit/constant-folding.js (revision 1760)
+++ test/mjsunit/constant-folding.js (working copy)
@@ -192,5 +192,41 @@
}
+// Some tests of shifts that get into the corners in terms of coverage.
+// We generate different code for the case where the operand is a constant.
+function ShiftTest() {
+ var x = 123;
+ assertEquals(x, x >> 0);
+ assertEquals(x, x << 0);
+ assertEquals(x, x >>> 0);
+ assertEquals(61, x >> 1);
+ assertEquals(246, x << 1);
+ assertEquals(61, x >>> 1);
+ x = -123;
+ assertEquals(x, x >> 0);
+ assertEquals(x, x << 0);
+ assertEquals(0x10000 * 0x10000 + x, x >>> 0);
+ assertEquals(-62, x >> 1);
+ assertEquals(-246, x << 1);
+ assertEquals(0x10000 * 0x8000 - 62, x >>> 1);
+ // Answer is non-Smi so the subtraction is not folded in the code
+ // generator.
+ assertEquals(-0x40000001, -0x3fffffff - 2);
+
+ x = 123;
+ assertEquals(0, x & 0);
+
+ // Answer is non-smi and lhs of << is a temporary heap number that we can
+ // overwrite.
+ x = 123.0001;
+ assertEquals(1073741824, (x * x) << 30);
+ x = 123;
+ // Answer is non-smi and lhs of << is a temporary heap number that we think
+ // we can overwrite (but we can't because it's a Smi).
+ assertEquals(1073741824, (x * x) << 30);
+}
+
+
test();
BoolTest();
+ShiftTest();
« src/codegen-ia32.cc ('K') | « src/codegen-ia32.cc ('k') | test/mjsunit/keyed-ic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698