Parents: #473, #493 Related: #480
Problem
Object.prototype.toString accepts a String-valued Symbol.toStringTag and builds "[object " + tag + "]". The current implementation reads the tag through physical asStr() bytes and concatenates them as though they were canonical WTF-8.
With physical flat-Latin-1 storage enabled, a non-ASCII tag contributes raw one-byte code units to a canonical StringCell constructor. That can misencode the result or trip the invalid-WTF-8 integrity assertion. Calling asWtf8 first would restore correctness but add a temporary conversion allocation before the already-required final output allocation.
Scope
- Compose prefix, String Value content, and suffix directly into one exact owned canonical WTF-8 buffer.
- Borrow/copy canonical storage directly and encode physical flat Latin-1 into its final destination.
- Preserve getter/proxy ordering, String-only tag acceptance, UTF-16/lone-surrogate content, realm behavior, maximum-string checks, and OOM propagation.
- Provide a reusable internal affix composer for adjacent output boundaries without exposing physical storage.
- Cover ordinary, primitive-wrapper, Proxy, cross-realm, ASCII, Latin-1, BMP, astral, and lone-surrogate tags.
No-workaround rules
- No representation forcing, replacement characters, hidden temporary transcode, validation weakening, Test262 exclusion, or double-allocation flat path.
- No stacks, queues, jobs, Promise, Worker, or Map/Set iterator changes.
Acceptance
- Exact
Object.prototype.toStringoutput for every supported String representation and observable receiver form. - One exact backing-buffer allocation for the composed bytes; no flat conversion scratch.
- OOM and maximum-length failures propagate without invalid partial StringCells.
- Focused canonical/flat units, relevant nonzero Test262 accounting, and the full unit gate pass with zero regressions.