Parent: #496 Related: #538, #539, #540
Problem
An escaped private name currently materializes its decoded identifier in lexEscapedIdentName, then nextRaw uses allocPrint to allocate a second #-prefixed token. The parser retains both arena buffers even though only the complete private-name token remains reachable. Generated classes with many escaped private fields therefore pay two owned buffers per key.
Scope
- Extend the existing escaped-private-class parser workload to 1K/2K/4K rows with exact per-member decoded-key validation.
- Let the escaped-identifier decoder seed the final owned spelling with
#for private names, eliminating the intermediate decoded-only buffer andallocPrintcopy. - Keep ordinary private names as complete source-backed slices and ordinary identifiers unchanged.
- Preserve Unicode IdentifierStart/IdentifierPart validation,
\\uXXXX/\\u{X}decoding, escaped-keyword behavior, token positions/ranges, private-name identity, and deterministic OOM propagation.
No-workaround rules
- No source rewriting, worst-case allocation, hash-only identity, interning cache, benchmark-specific spelling, dropped
#, relaxed Unicode validation, or deferred syntax errors.
Acceptance
- Benchmark-first 1K/2K/4K rows validate every exact decoded private key and establish allocation growth before lexer changes.
- Each escaped private token owns one complete
#-prefixed decoded buffer; no decoded-only intermediate survives. Ordinary private names remain source-backed with zero decoded-byte allocation. - Tests cover multiple escapes, raw Unicode,
\\uXXXX/\\u{X}, invalid start/continue scalars, exact offsets, allocation counts/bytes, and deterministic OOM. - Lexer/parser/frontend, TSan, full units, forced private-name execution, and exact private-name/class test262 comparisons pass without regressions.
- Exact-parent evidence records wall, hardware counters, allocation requests/bytes, RSS, checksums, and 1K/2K/4K growth without moving lexing/parsing outside the timed boundary.