Problem
JsonParser.parseString currently appends every unescaped source byte into an arena ArrayList, converts that buffer to an owned slice, and then its caller copies the bytes again into a runtime string or property key. Ordinary JSON strings and keys without escapes therefore pay an avoidable temporary allocation, byte-at-a-time growth work, and two copies.
This is on the representative JSON parse hot path and amplifies allocator contention in shared realms.
Required outcome
- Return a validated source slice directly when a JSON string contains no escapes, without changing ownership of the final runtime value or property key.
- Keep exact WTF-8, lone-surrogate, control-character, escape, source-text reviver, duplicate-key, and
__proto__semantics. - Preserve failure atomicity: invalid controls/escapes and allocator failure must not publish partial strings or properties.
- Add deterministic allocation/work witnesses for unescaped values and keys plus escaped/Unicode correctness coverage.
- Run full JSON.parse test262, normal/TSan unit gates, and exact-parent representative JSON base/anti-specialization timing and RSS evidence.
Relationships
Child of #473. Contributes to #493, #460, and shared allocator pressure under #478.