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

Unified Diff: test/mjsunit/compiler/compare-objeq-elim.js

Issue 162903005: Restore of compare-objeq-elim test accidentally removed in r19229. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/compare-objeq-elim.js
diff --git a/test/mjsunit/compiler/compare-map-elim.js b/test/mjsunit/compiler/compare-objeq-elim.js
similarity index 69%
copy from test/mjsunit/compiler/compare-map-elim.js
copy to test/mjsunit/compiler/compare-objeq-elim.js
index 288d4811a6811691366841f7693495f6c785da9e..4492df45c32a5a7c0dbc25f8bb28470ff8eafcf0 100644
--- a/test/mjsunit/compiler/compare-map-elim.js
+++ b/test/mjsunit/compiler/compare-objeq-elim.js
@@ -27,25 +27,59 @@
// Flags: --allow-natives-syntax --check-elimination
-a = {
- f: function() { this.y = 3; }
-};
-b = {
- f: function() { this.y = 4; }
-};
-
-function x(z) {
- return z.f();
+function A(x, y) {
+ this.x = x;
+ this.y = y;
}
-x(a);
-x(b);
-x(a);
-x(b);
-x(a);
-x(b);
+function B(x, y) {
+ this.x = x;
+ this.y = y;
+}
+
+function F1(a, b) {
+ if (a == b) return a.x;
+ else return b.x;
+}
+
+function F2(a, b) {
+ if (a == b) return a.x;
+ else return b.x;
+}
+
+function F3(a, b) {
+ var f = a.y;
+ if (a == b) return a.x;
+ else return b.x;
+}
+
+function F4(a, b) {
+ var f = b.y;
+ if (a == b) return a.x;
+ else return b.x;
+}
+
+%NeverOptimizeFunction(test);
+
+function test(f, a, b) {
+ f(a, a);
+ f(a, b);
+ f(b, a);
+ f(b, c);
+ f(b, b);
+ f(c, c);
+
+ %OptimizeFunctionOnNextCall(f)
+
+ assertEquals(a.x, f(a, a));
+ assertEquals(b.x, f(b, b));
+}
-%OptimizeFunctionOnNextCall(x)
+var a = new A(3, 5);
+var b = new B(2, 6);
+var c = new A(1, 7);
-x(a);
-x(b);
+test(F1, a, c);
+test(F2, a, b);
+test(F3, a, b);
+test(F4, a, b);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698