Reviewers: Toon Verwaest,

Message:
PTAL

Description:
Restore of compare-objeq-elim test accidentally removed in r19299.

Please review this at https://codereview.chromium.org/162903005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+52, -18 lines):
  A + test/mjsunit/compiler/compare-objeq-elim.js


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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to