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

Unified Diff: test/mjsunit/compiler/dead-code.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 | « src/hydrogen-instructions.cc ('k') | test/mjsunit/compiler/dead-code2.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/dead-code.js
diff --git a/test/mjsunit/keyed-storage-extend.js b/test/mjsunit/compiler/dead-code.js
similarity index 62%
copy from test/mjsunit/keyed-storage-extend.js
copy to test/mjsunit/compiler/dead-code.js
index d7e157b84654063ba39a4f6795bf045ae0c92284..8b5bd2cf90e9b12a42995d5369181186f85cbac0 100644
--- a/test/mjsunit/keyed-storage-extend.js
+++ b/test/mjsunit/compiler/dead-code.js
@@ -25,31 +25,55 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-function F() { }
-
-function GrowNamed(o) {
- o.a = 1;
- o.b = 2;
- o.c = 3;
- o.d = 4;
- o.e = 5;
- o.f = 6;
+function dead1(a, b) {
+ var x = a + b;
+ return a; // x is dead
}
-function GrowKeyed(o) {
- var names = ['a','b','c','d','e','f'];
- var i = 0;
- o[names[i++]] = i;
- o[names[i++]] = i;
- o[names[i++]] = i;
- o[names[i++]] = i;
- o[names[i++]] = i;
- o[names[i++]] = i;
+function dead2(a, b) {
+ var x = a | 0;
+ var y = b | 0;
+ return a; // x and y are both dead
}
-GrowNamed(new F());
-GrowNamed(new F());
-GrowNamed(new F());
-GrowKeyed(new F());
-GrowKeyed(new F());
-GrowKeyed(new F());
+function dead3(a, b) {
+ var z;
+ if(a == 2) z = a;
+ else z = b;
+ return a; // z is dead
+}
+
+function dead4(a) {
+ var z = 3;
+ for (i = 0; i < 3; i++) {
+ z++;
+ }
+ return a; // z is dead
+}
+
+function dead5(a) {
+ var z = 3;
+ for (i = 0; i < 3; i++) {
+ z++;
+ }
+ var w = z + a;
+ return a; // z is dead
+}
+
+assertTrue(dead1(33, 32) == 33);
+assertTrue(dead2(33, 32) == 33);
+assertTrue(dead3(33, 32) == 33);
+assertTrue(dead4(33) == 33);
+assertTrue(dead5(33) == 33);
+
+assertTrue(dead1(34, 7) == 34);
+assertTrue(dead2(34, 7) == 34);
+assertTrue(dead3(34, 7) == 34);
+assertTrue(dead4(34) == 34);
+assertTrue(dead5(34) == 34);
+
+assertTrue(dead1(3.4, 0.1) == 3.4);
+assertTrue(dead2(3.4, 0.1) == 3.4);
+assertTrue(dead3(3.4, 0.1) == 3.4);
+assertTrue(dead4(3.4) == 3.4);
+assertTrue(dead5(3.4) == 3.4);
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | test/mjsunit/compiler/dead-code2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698