summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/mutable-proto-teleporting.js
blob: a52faf1c582687b470a3165baede1ef2730ca3f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// The teleporting optimization should work correctly
// when we modify an object's proto.

var A = {x: 1};
var B = Object.create(A);

var C = {};
C.__proto__ = B;

function f() {
    for (var i=0; i<25; i++) {
        assertEq(C.x, (i <= 20) ? 1 : 3);
        if (i === 20) {
            B.x = 3;
        }
    }
}
f();