Files
scriptc/tests/corpus/2673-sparse-array-js.js
Jimmy Miller 522e841fd8 Add sparse array support
Represent array holes independently from element storage with an optional runtime presence bitmap. Preserve hole state through length changes, deletion, slicing, concatenation, sorting, copying methods, iteration, serialization, and reference-counted cleanup while retaining packed-array fast paths.

Extend frontend lowering and IR validation for sparse literals, Array length construction, property-presence checks, delete, length assignment, and sparse appends. Add dense-array analysis so proven packed reads can use dedicated unchecked-presence runtime entry points in both native backends.

Add differential corpus coverage, runtime lifecycle tests, IR analysis tests, and compile fences for JavaScript fill loops that cannot prove complete initialization. Update affected binary-size expectations and align structuredClone transfer diagnostics with Node wording.
2026-08-03 15:34:20 -04:00

9 lines
231 B
JavaScript

function build(length) {
var result = Array(length);
for (var i = 0; i < length; i++) result[i] = i * 2;
return result;
}
const packed = build(4);
console.log(packed.length, packed.join(","), Object.keys(packed).join(","));