Parents: #473, #480
Related: #675, #777
Problem
With production flat Latin-1 StringCell storage enabled, JSON.stringify currently calls Value.asWtf8 for every string value. Eligible strings are first transcoded into temporary arena storage and then copied again into the authoritative JSON output buffer. The property-key writer already writes canonical storage directly, and structured clone already has a representation-aware final-buffer writer.
Scope
- Add a representation-aware JSON string writer for String Values.
- Borrow ASCII and canonical WTF-8 storage directly.
- Encode physical flat Latin-1 directly into the authoritative output buffer while applying QuoteJSONString escapes.
- Preserve lone-surrogate escaping, control/quote/backslash escapes, astral and BMP content, replacer/toJSON ordering, omission rollback, output limits, and OOM atomicity.
- Prove a capacity-prepared flat-string write succeeds with an allocator that fails its first allocation.
No-workaround rules
- No permanent canonical shadow copy, eager global canonicalization, lossy replacement, invalid-byte acceptance, alternate JSON semantics, hidden second pass, or benchmark/input special case.
- No stack, queue, job, Promise, Worker, or Map/Set iterator implementation changes.
Acceptance
Parents: #473, #480
Related: #675, #777
Problem
With production flat Latin-1 StringCell storage enabled,
JSON.stringifycurrently callsValue.asWtf8for every string value. Eligible strings are first transcoded into temporary arena storage and then copied again into the authoritative JSON output buffer. The property-key writer already writes canonical storage directly, and structured clone already has a representation-aware final-buffer writer.Scope
No-workaround rules
Acceptance