summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/shifted-elements6.js
blob: 671e493254fe65f2770815c2a1812eb6ae017f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Test incremental GC slices and shifted elements.
function f() {
    var arr = [];
    for (var i = 0; i < 1000; i++)
        arr.push({x: i});
    var arr2 = [];
    for (var i = 0; i < 1000; i++) {
        gcslice(900);
        var o = arr.shift();
        assertEq(o.x, i);
        arr2.push(o);
    }
    gc();
    for (var i = 0; i < 1000; i++)
        assertEq(arr2[i].x, i);
}
f();