Parents: #473, #465 Related: #668, #672, #674, #692
Problem
Value.toString is the byte-returning ECMAScript ToString boundary used by Interpreter.toStringV. Its string branch currently returns Value.asStr(), which is the StringCell physical image. Under flat Latin-1 storage, direct strings and object-to-primitive results can therefore reach parsers, formatters, Web APIs, and embedding helpers as raw one-byte code units instead of canonical WTF-8.
Scope
- Make the byte-returning ToString boundary return canonical WTF-8 for existing string values.
- Preserve Symbol rejection, ToPrimitive hint/order, abrupt completion, primitive formatting, and current canonical-storage zero-copy behavior.
- Propagate flat-storage conversion OOM through the existing
EvalError/allocator channels. - Keep
toStringValueas the representation-aware value-retaining path for consumers that operate directly on UTF-16 code units. - Add direct-string and object-to-primitive flat-storage witnesses plus fail-first allocation coverage.
No-workaround rules
- No global eager canonicalization, disabled flat storage, forced UTF-16 representation, lossy repair, retry, alternate coercion path, or swallowed OOM.
- No stacks, queues, jobs, Promise, microtask, Worker-lifecycle, or Map/Set iterator changes.
Acceptance
Value.toStringandInterpreter.toStringVreturn canonical WTF-8 for all StringData representations.- Direct and object-produced strings preserve exact ToString ordering/results under canonical and flat Latin-1 storage.
- Flat conversion OOM is explicit and the disabled representation remains allocation-free.
- Focused Debug/forced-flat/ReleaseSafe/TSan and full units pass with exact Test262 accounting.