Parents: #473, #480 Related: #666, #777, #779
Problem
Interpreter.stringMethod constructed a fresh StringCell before checking whether the requested method had a well-known Symbol protocol. Plain methods such as charCodeAt therefore duplicated an immutable receiver cell on every call.
The protocol and coercion values must remain distinct. ECMA-262 passes the original RequireObjectCoercible result O to custom @@split, @@match, @@search, and @@replace methods before ToString; a boxed String must stay boxed and an overriding conversion method must not run. When execution falls through to the ordinary String algorithm, the later ToString result may itself be an existing StringData cell and should be retained.
Flat Latin-1 receivers also paid an eager whole-string WTF-8 transcode before code-unit-only methods even though their bounded StringCell index reads physical code units directly.
Scope
- Determine whether a method has protocol dispatch before materializing any coerced receiver.
- Pass the original
Ounchanged to custom Symbol protocol methods. - Retain the exact StringData Value produced by the later ToString operation.
- Let
charAt,charCodeAt,at, andcodePointAtconsume the StringCell directly without an eager canonical snapshot. - Preserve replaceAll IsRegExp/global-flag/GetMethod ordering and every observable coercion boundary.
- Add fail-first allocation, boxed-receiver identity, overridden-coercion, flat Latin-1, and moving/TSan coverage.
No-workaround rules
- No disabled protocol dispatch, forced storage representation, cached mutable receiver, skipped coercion, special input result, or weakened observable ordering.
- No stacks, queues, jobs, Promise, Worker, or Map/Set iterator changes.
Acceptance
- Plain String methods do not allocate a duplicate protocol receiver.
- Protocol methods receive the original
O, including boxed String identity. - Ordinary methods retain the actual post-ToString StringData cell.
- Code-unit-only methods avoid eager flat Latin-1 transcoding.
- Focused normal/TSan units, relevant exact-parent Test262 accounting, threadfuzz, and the full unit gate pass without regressions.