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

Unified Diff: test/mjsunit/compiler/dead-string-char-from-code.js

Issue 149413010: A64: Synchronize with r16024. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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-string-char-code-at2.js ('k') | test/mjsunit/count-based-osr.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/dead-string-char-from-code.js
diff --git a/test/mjsunit/compiler/dead-code6.js b/test/mjsunit/compiler/dead-string-char-from-code.js
similarity index 61%
copy from test/mjsunit/compiler/dead-code6.js
copy to test/mjsunit/compiler/dead-string-char-from-code.js
index ec9b8433ddd72187b3f9dab70baf2399fac0cdb2..1de5d9e44b1fc2a257a06c5e7c7febbe268b40a0 100644
--- a/test/mjsunit/compiler/dead-code6.js
+++ b/test/mjsunit/compiler/dead-string-char-from-code.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -26,48 +26,51 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax
-// Test some dead code elimination scenarios
-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 dead1(a, b) {
+ var x = %_StringCharFromCode(a);
+ return a; // x is dead code
}
-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;
+function dead2(a, b) {
+ var x = %_StringCharFromCode(a);
+ var y = %_StringCharFromCode(b);
+ return a; // x and y are both dead
}
function dead3(a, b) {
- a == 2 ? (a * b) : (b * a); // dead
- return a;
+ a = a ? 11 : 12;
+ b = b ? 13 : 14;
+ var x = %_StringCharFromCode(a);
+ var y = %_StringCharFromCode(b);
+ return a; // x and y are both dead
}
-assertTrue(dead1(33, 32) == 33);
-assertTrue(dead1(33, 32) == 33);
-%OptimizeFunctionOnNextCall(dead1);
-assertTrue(dead1(33, 32) == 33);
+function test() {
+ assertEquals(33, dead1(33, 32));
+ assertEquals(33, dead2(33, 32));
+ assertEquals(11, dead3(33, 32));
-assertTrue(dead2(34, 11) == 34);
-assertTrue(dead2(34, 11) == 34);
-%OptimizeFunctionOnNextCall(dead2);
-assertTrue(dead2(34, 11) == 34);
+ assertEquals(31, dead1(31, 30));
+ assertEquals(31, dead2(31, 30));
+ assertEquals(11, dead3(31, 32));
+
+ assertEquals(0, dead1(0, 30));
+ assertEquals(0, dead2(0, 30));
+ assertEquals(12, dead3(0, 32));
+
+ assertEquals(true, dead1(true, 0));
+ assertEquals(true, dead2(true, 0));
+ assertEquals(11, dead3(true, 0));
-assertTrue(dead3(35, 12) == 35);
-assertTrue(dead3(35, 12) == 35);
+ assertEquals("true", dead1("true", 0));
+ assertEquals("true", dead2("true", 0));
+ assertEquals(11, dead3("true", 0));
+}
+
+test();
+test();
+%OptimizeFunctionOnNextCall(dead1);
+%OptimizeFunctionOnNextCall(dead2);
%OptimizeFunctionOnNextCall(dead3);
-assertTrue(dead3(35, 12) == 35);
+test();
« no previous file with comments | « test/mjsunit/compiler/dead-string-char-code-at2.js ('k') | test/mjsunit/count-based-osr.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698