Index: test/mjsunit/field-type-tracking.js |
diff --git a/test/mjsunit/field-type-tracking.js b/test/mjsunit/field-type-tracking.js |
index 8da4ed56857378065eaaf1b87108ca470c9ac49d..b4901f34c34e706877316b65242dcfbaf75192d4 100644 |
--- a/test/mjsunit/field-type-tracking.js |
+++ b/test/mjsunit/field-type-tracking.js |
@@ -147,3 +147,21 @@ |
baz(f3, {a: -1}); |
assertUnoptimized(baz); |
})(); |
+ |
+(function() { |
+ function Foo(x) { this.x = x; this.a = x; } |
+ function Bar(x) { this.x = x; this.b = x; } |
+ function readA(o) { return o.x.a; } |
+ var f = new Foo({a:1}); |
+ var b = new Bar({a:2}); |
+ assertEquals(readA(f), 1); |
+ assertEquals(readA(b), 2); |
+ assertEquals(readA(f), 1); |
+ assertEquals(readA(b), 2); |
+ %OptimizeFunctionOnNextCall(readA); |
+ assertEquals(readA(f), 1); |
+ assertEquals(readA(b), 2); |
+ assertOptimized(readA); |
+ f.a.y = 0; |
+ assertUnoptimized(readA); |
+})(); |