mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
The dense path of an element read that may be undefined (the `%arr.idxOr` reads behind `a[i]` as `T | undefined`, the store `a[x] = a[y]!`, and the element reads of the lowered array methods) tested the index against the capacity, then against the hole-free prefix (`filled`), and only above the prefix against the length and the slot's state. `filled` is at most the length and the capacity (scr_array.h), so an index below it needs no other test: the read now tests `filled` first and takes the value path on that test alone. Above the prefix it tests the capacity, the length and the state as before. A double index first branches to the runtime lookup when it is not an exact integer, then takes the same tests on its i64 value, which a 32-bit target compares before truncating it.