summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testHoleInDenseArray.js
blob: 29523262c252a6f83484ae159815903a4a92a4bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var s;

function f(i) {
    if (i > 4) /* side exit when arr[i] changes from bool to undefined (via a hole) */
        assertEq(s, undefined);
    else
        assertEq(s, false);
    return 1;
}

/* trailing 'true' ensures array has capacity >= 10 */
var arr = [ false, false, false, false, false, , , , , , true ];

for (var i = 0; i < 10; ++i) {
    (s = arr[i]) + f(i);
}