Parent: #496 Related: #493, #460, #461
Problem
Lexer.lexString eagerly appends every byte of every quoted JavaScript string literal into arena-owned ArrayList storage, even when the literal has no escape and its exact value is already a stable slice of the Context-owned source. Wide JSON-like object literals, generated tables, bundles, and modules therefore pay avoidable allocation, copying, growth, and retained parse-arena bytes proportional to their unescaped string payload.
Scope
- Add parser-only growth rows for ordinary and escaped quoted-string programs with frozen source construction, checksums, warmup, and timed parse boundary.
- Return an exact zero-copy source slice for unescaped literals.
- Lazily materialize decoded storage at the first escape and copy raw spans in batches rather than appending every byte.
- Preserve quote removal, escape decoding, line continuations, JSON-superset U+2028/U+2029, legacy-octal flags, WTF-8 behavior, diagnostics, source locations, and source lifetime.
Security and correctness
- No borrowed slice may outlive the owned source backing used by the AST/compiled artifact.
- Malformed and unterminated literals must retain exact failure classification/location.
- Escaped decoding must remain OOM-propagating and failure-atomic.
- Do not special-case benchmark text, intern attacker-controlled literals globally, omit source ownership, or weaken validation.
Acceptance
- Benchmark source and structural checks land before the runtime change.
- Fail-on-first-allocation proves an unescaped literal tokenizes without allocation; escaped literals still allocate and decode exactly.
- 1K/2K/4K ordinary rows show bounded near-linear work and materially lower allocation/instruction cost versus the exact parent; escaped control remains semantically exact.
- Lexer/parser/frontend suites, forced execution paths, OOM diagnostics, full units, and affected test262 string/source parsing pass with no regressions.