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