| Index: test/mjsunit/compare-known-objects-slow.js
|
| diff --git a/test/mjsunit/compiler/inline-arity-mismatch.js b/test/mjsunit/compare-known-objects-slow.js
|
| similarity index 60%
|
| copy from test/mjsunit/compiler/inline-arity-mismatch.js
|
| copy to test/mjsunit/compare-known-objects-slow.js
|
| index 4a61fa3a62c36f8f53b12cde023f52bdb6e1abc7..afa198fcb352ea7f186a285146a61fd1ab70d51b 100644
|
| --- a/test/mjsunit/compiler/inline-arity-mismatch.js
|
| +++ b/test/mjsunit/compare-known-objects-slow.js
|
| @@ -27,36 +27,43 @@
|
|
|
| // Flags: --allow-natives-syntax
|
|
|
| -// Test inlining at call sites with mismatched arity.
|
| +// Test CompareIC stubs for normal and strict equality comparison of known
|
| +// objects in slow mode. These objects share the same map even though they
|
| +// might have completely different properties.
|
|
|
| -function f(a) {
|
| - return a.x;
|
| +function eq(a, b) {
|
| + return a == b;
|
| }
|
|
|
| -function g(a, b) {
|
| - return a.x;
|
| +function eq_strict(a, b) {
|
| + return a === b;
|
| }
|
|
|
| -function h1(a, b) {
|
| - return f(a, a) * g(b);
|
| -}
|
| -
|
| -function h2(a, b) {
|
| - return f(a, a) * g(b);
|
| +function test(a, b) {
|
| + // Check CompareIC for equality of known objects.
|
| + assertTrue(eq(a, a));
|
| + assertTrue(eq(b, b));
|
| + assertFalse(eq(a, b));
|
| + // Check CompareIC for strict equality of known objects.
|
| + assertTrue(eq_strict(a, a));
|
| + assertTrue(eq_strict(b, b));
|
| + assertFalse(eq_strict(a, b));
|
| }
|
|
|
| +// Prepare two objects in slow mode that have the same map.
|
| +var obj1 = %OptimizeObjectForAddingMultipleProperties({}, 1);
|
| +var obj2 = %OptimizeObjectForAddingMultipleProperties({}, 1);
|
|
|
| -var o = {x: 2};
|
| +// Test original objects.
|
| +assertTrue(%HaveSameMap(obj1, obj2));
|
| +test(obj1, obj2);
|
|
|
| -assertEquals(4, h1(o, o));
|
| -assertEquals(4, h1(o, o));
|
| -assertEquals(4, h2(o, o));
|
| -assertEquals(4, h2(o, o));
|
| -%OptimizeFunctionOnNextCall(h1);
|
| -%OptimizeFunctionOnNextCall(h2);
|
| -assertEquals(4, h1(o, o));
|
| -assertEquals(4, h2(o, o));
|
| +// Test after adding property to first object.
|
| +obj1.x = 1;
|
| +assertTrue(%HaveSameMap(obj1, obj2));
|
| +test(obj1, obj2);
|
|
|
| -var u = {y:0, x:1};
|
| -assertEquals(2, h1(u, o));
|
| -assertEquals(2, h2(o, u));
|
| +// Test after adding property to second object.
|
| +obj2.y = 2;
|
| +assertTrue(%HaveSameMap(obj1, obj2));
|
| +test(obj1, obj2);
|
|
|