summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/sparse-and-dense-elements.js
blob: 2c18c98f93a09e8fe1f593f0368fa67cc6d9bd7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function f(o) {
    for (var i = 0; i < 40; i++) {
        if ((i > 10 && (i % 2) === 0) || i > 30) {
            Object.defineProperty(o, i, {value: i, enumerable: false,
                                         writable: true, configurable: true});
        } else {
            o[i] = i;
        }
    }
    for (var i = 0; i < 15; i++) {
        var sum = 0;
        for (var j = 0; j < 40; j++) {
            o[j]++;
            sum += o[j];
        }
        assertEq(sum, 820 + i * 40);
    }
}
f({});
f([]);