mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
With while-loop versions, `while (pos < end && s.charCodeAt(pos) === 32) pos++` took a version whose guard could never hold. The counter scan records only typed-array accesses, so the string read fell back to the statically ranged check. For a counter held in an int32 slot, that check asks for a length above 2^31 - 2. The loop paid for the guard and ran its checked copy. The counter scan now records `s.charCodeAt(i)` and `s.charAt(i)` of a string like typed-array reads. Their guard compares the counter's bound with the string's length, as for a typed array. Corpus 7302 adds while loops over counters below a string's length.