Debian Codegraph @

js/src/jit-test/tests/arrays/grow-large-array.js

raw
1 // |jit-test| allow-oom
2
3 // Exercise growing a very large array.
4
5 const growBy = 100000;
6 const startSize = 1 * 1024 * 1024;
7 const endSize = 32 * 1024 * 1024;
8
9 const array = new Array();
10 array.fill(1);
11 const extra = new Array(growBy);
12 extra.fill(1);
13 while (array.length < endSize) {
14 array.push(...extra);
15 }