Problem
Lexer.lexString borrows unescaped literals, but the first escape switches to an arena-backed ArrayListUnmanaged. Repeated append growth plus toOwnedSlice makes decoded allocation count and retained capacity depend on escape/source layout. Large escape-heavy sources therefore pay avoidable allocator traffic inside the cold parse boundary.
Scope
- Add 1K/2K/4K escaped-string benchmark rows with exact decoded-value checks and keep the ordinary-string control.
- Decode valid string escapes through a bounded first pass that computes the exact byte length and a second pass that fills one allocation.
- Preserve ECMAScript escape consumption, line continuations, Annex B octal flags, malformed escape diagnostics, lone-surrogate WTF-8, source positions, and unescaped source borrowing.
- Keep lexer state failure-atomic when the exact allocation fails.
No-workaround rules
- No worst-case over-allocation, hidden scratch copy, delayed validation, dropped source locations, weakened malformed-escape rejection, or special-case benchmark path.
Acceptance
- Escaped literals make exactly one decoded-byte allocation and no resize/transfer allocation; unescaped literals still allocate zero bytes.
- Unit tests cover every escape family, surrogate pairs/lone surrogates, line terminators/continuations, legacy octal, malformed escapes, and deterministic OOM state.
- Focused frontend, lexer, TSan, full unit, and exact affected test262 comparisons pass.
- Exact-parent evidence records wall, instructions/cycles/energy availability, allocation requests/bytes, peak RSS, checksums, and growth for 1K/2K/4K rows without hiding source construction or decoding outside the timed parse boundary.