mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
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.
9 lines
231 B
JavaScript
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(","));
|