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

Unified Diff: test/mjsunit/compiler/load-elimination-params.js

Issue 95193002: Fix load elimination: can only .Equals() GVN-able instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Don't enable load elimination; do in other CL Created 7 years, 1 month 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-load-elimination.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/load-elimination-params.js
diff --git a/test/mjsunit/compiler/load-elimination-osr.js b/test/mjsunit/compiler/load-elimination-params.js
similarity index 67%
copy from test/mjsunit/compiler/load-elimination-osr.js
copy to test/mjsunit/compiler/load-elimination-params.js
index a57fe173ee7be04313ca7ea2c18229e23fa16375..13a4a8596d6061226b631816ca2e9fff461a015a 100644
--- a/test/mjsunit/compiler/load-elimination-osr.js
+++ b/test/mjsunit/compiler/load-elimination-params.js
@@ -27,39 +27,45 @@
// Flags: --allow-natives-syntax --load-elimination
-// Test global load elimination in the presence of OSR compilation.
+// Test local load elimination of redundant loads and stores.
-function It(x, y) { }
-
-function foo_osr(x, limit) {
- var o = new It();
- o.x = x;
- o.y = x;
- for (var i = 0; i < limit; i++) {
- o.y += o.x; // Load of x cannot be hoisted due to OSR.
- }
+function B(x, y) {
+ this.x = x;
+ this.y = y;
+ return this;
+}
- return o.y;
+function test_params1(a, b) {
+ var i = a.x;
+ var j = a.x;
+ var k = b.x;
+ var l = b.x;
+ return i + j + k + l;
}
-assertEquals(22, foo_osr(11, 1));
-assertEquals(24, foo_osr(12, 1));
-assertEquals(1300013, foo_osr(13, 100000));
+assertEquals(14, test_params1(new B(3, 4), new B(4, 5)));
+assertEquals(110, test_params1(new B(11, 7), new B(44, 8)));
+%OptimizeFunctionOnNextCall(test_params1);
-function foo_hot(x, limit) {
- var o = new It();
- o.x = x;
- o.y = x;
- for (var i = 0; i < limit; i++) {
- o.y += o.x; // Load of x can be hoisted without OSR.
- }
+assertEquals(6, test_params1(new B(1, 7), new B(2, 8)));
- return o.y;
+function test_params2(a, b) {
+ var o = new B(a + 1, b);
+ o.x = a;
+ var i = o.x;
+ o.x = a;
+ var j = o.x;
+ o.x = b;
+ var k = o.x;
+ o.x = b;
+ var l = o.x;
+ return i + j + k + l;
}
-assertEquals(22, foo_hot(11, 1));
-assertEquals(24, foo_hot(12, 1));
-%OptimizeFunctionOnNextCall(foo_hot);
-assertEquals(32, foo_hot(16, 1));
-assertEquals(1300013, foo_hot(13, 100000));
+assertEquals(14, test_params2(3, 4));
+assertEquals(110, test_params2(11, 44));
+
+%OptimizeFunctionOnNextCall(test_params2);
+
+assertEquals(6, test_params2(1, 2));
« no previous file with comments | « src/hydrogen-load-elimination.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698