summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/watchtower/megamorphic-long-proto-chain.js
blob: 675f29333f92b171b48e4ee9ab8ed89c2a98fb1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
setJitCompilerOption("ic.force-megamorphic", 1);

function objectWithHops(hops) {
    var o = Object.create(null);
    o.hops = hops;
    for (var i = 0; i < hops; i++) {
        o = Object.create(o);
    }
    return o;
}
function test() {
    var objs = [];
    for (var i = 0; i < 32; i++) {
        objs.push(objectWithHops(230 + i));
    }
    for (var i = 0; i < 130; i++) {
        var o = objs[i % objs.length];
        assertEq(o.hops, 230 + (i % objs.length));
        assertEq("hops" in o, true);
        assertEq(Object.hasOwnProperty.call(o, "hops"), false);
        assertEq(o.missing, undefined);
        assertEq("missing" in o, false);
        assertEq(Object.hasOwnProperty.call(o, "missing"), false);
    }
}
for (var i = 0; i < 10; i++) {
  test();
}