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/compiler/dead-string-char-code-at2.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
Index: test/mjsunit/compiler/dead-string-char-code-at2.js
diff --git a/test/mjsunit/compiler/dead-code6.js b/test/mjsunit/compiler/dead-string-char-code-at2.js
similarity index 60%
copy from test/mjsunit/compiler/dead-code6.js
copy to test/mjsunit/compiler/dead-string-char-code-at2.js
index ec9b8433ddd72187b3f9dab70baf2399fac0cdb2..9f01541c90f8af6f0f6cdca730da9aaafd2a72e5 100644
--- a/test/mjsunit/compiler/dead-code6.js
+++ b/test/mjsunit/compiler/dead-string-char-code-at2.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,56 @@
// 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;
+var S1 = "string1";
+var S2 = "@@string2";
+
+function dead1(a, b) {
+ var x = %_StringCharCodeAt(a, 4);
+ 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 = %_StringCharCodeAt(a, 3);
+ var y = %_StringCharCodeAt(b, 1);
+ 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 = %_StringCharCodeAt(a, 2);
+ var y = %_StringCharCodeAt(b, 0);
+ 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() {
+ var S3 = S1 + S2;
-assertTrue(dead2(34, 11) == 34);
-assertTrue(dead2(34, 11) == 34);
-%OptimizeFunctionOnNextCall(dead2);
-assertTrue(dead2(34, 11) == 34);
+ assertEquals(S1, dead1(S1, S2));
+ assertEquals(S1, dead2(S1, S2));
+ assertEquals("11", dead3(S1, S2));
+
+ assertEquals(S2, dead1(S2, 677));
+ assertEquals(S2, dead2(S2, S3));
+ assertEquals("11", dead3(S2, S3));
+
+ assertEquals(S3, dead1(S3, 399));
+ assertEquals(S3, dead2(S3, "false"));
+ assertEquals("12", dead3(0, 32));
-assertTrue(dead3(35, 12) == 35);
-assertTrue(dead3(35, 12) == 35);
+ assertEquals(S3, dead1(S3, 0));
+ assertEquals(S3, dead2(S3, S1));
+ assertEquals("11", dead3(S3, 0));
+
+ assertEquals("true", dead1("true", 0));
+ assertEquals("true", dead2("true", S3));
+ 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-at.js ('k') | test/mjsunit/compiler/dead-string-char-from-code.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698