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

Unified Diff: test/mjsunit/compiler/dead-code6.js

Issue 14676011: Improve dead code elimination by transitively marking live code and removing all dead code. Replace… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename CanBeEliminated -> CannotBeEliminated, implement IsDeletable() for HPhi. Created 7 years, 7 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 | « test/mjsunit/compiler/dead-code5.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/dead-code6.js
diff --git a/test/mjsunit/regress/regress-1563.js b/test/mjsunit/compiler/dead-code6.js
similarity index 65%
copy from test/mjsunit/regress/regress-1563.js
copy to test/mjsunit/compiler/dead-code6.js
index 884b12595a6d7bc41c4bcad94c014b9379241811..ec9b8433ddd72187b3f9dab70baf2399fac0cdb2 100644
--- a/test/mjsunit/regress/regress-1563.js
+++ b/test/mjsunit/compiler/dead-code6.js
@@ -26,19 +26,48 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
+// Test some dead code elimination scenarios
-obj = new Uint8ClampedArray(10);
+function dead1(x, y) {
+ var a = x | 0, b = y | 0;
+ a * b;
+ a << b;
+ a >> b;
+ a >>> b;
+ a | b;
+ a & b;
+ a ^ b;
+ return x;
+}
+
+function dead2(x, y) {
+ var a = x | 0, b = y | 0;
+ (a | 0) * b;
+ (a | 0) << b;
+ (a | 0) >> b;
+ (a | 0) >>> b;
+ (a | 0) | b;
+ (a | 0) & b;
+ (a | 0) ^ b;
+ return x;
+}
-// Test that undefined gets properly clamped in Crankshafted pixel array
-// assignments.
-function set_pixel(obj, arg) {
- obj[0] = arg;
+function dead3(a, b) {
+ a == 2 ? (a * b) : (b * a); // dead
+ return a;
}
-set_pixel(obj, 1.5);
-set_pixel(obj, NaN);
-%OptimizeFunctionOnNextCall(set_pixel);
-set_pixel(obj, undefined);
-set_pixel(obj, undefined);
+assertTrue(dead1(33, 32) == 33);
+assertTrue(dead1(33, 32) == 33);
+%OptimizeFunctionOnNextCall(dead1);
+assertTrue(dead1(33, 32) == 33);
+
+assertTrue(dead2(34, 11) == 34);
+assertTrue(dead2(34, 11) == 34);
+%OptimizeFunctionOnNextCall(dead2);
+assertTrue(dead2(34, 11) == 34);
-assertEquals(0, obj[0]);
+assertTrue(dead3(35, 12) == 35);
+assertTrue(dead3(35, 12) == 35);
+%OptimizeFunctionOnNextCall(dead3);
+assertTrue(dead3(35, 12) == 35);
« no previous file with comments | « test/mjsunit/compiler/dead-code5.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698