Parent: #475 Related: #460, #461, #480, #493
Problem
Date.prototype.toDateString, toTimeString, and toString currently enter one shared branch that formats both date and time halves before selecting the result. The selected half is then copied into a StringCell, while full toString concatenates a third arena buffer. toUTCString also allocates a temporary year string before its final output. In precise-GC contexts, an arena-formatted final buffer is copied again into realm-owned managed-string storage, so repeated conversions retain avoidable high-water backing until Context teardown.
Scope
- Format
toDateString,toTimeString,toString,toUTCString, and Annex BtoGMTStringdirectly into exactly one result byte buffer. - Render the year through bounded native storage so ordinary and extended years do not require a temporary allocation.
- In precise-GC realms, allocate the result from the exact realm-owned backing allocator and transfer it into the managed
StringCell; preserve arena ownership for standalone/non-GC interpreters. - Keep invalid-date behavior, UTC/local method routing, exact punctuation/padding, negative and six-digit years, and GC movement semantics unchanged.
- Add deterministic 1K/2K/4K conversion rows that exercise every affected method and an unrelated Date getter control. Preserve cross-engine checksum equality by scoring only specification-stable UTC/date/time prefixes while still constructing every complete result.
No-workaround rules
- No cached output, shared mutable formatting buffer, hard-coded benchmark result, skipped conversion, locale/time-zone omission, or benchmark-only engine path.
- No borrowed pointer may outlive native storage; OOM must leave ownership exact and leak-free.
Acceptance
- Each successful affected conversion owns one final byte buffer and one managed string cell, with no retained intermediate arena buffer in precise-GC mode.
- Existing Date test262 remains regression-free; focused invalid, extended-year, alias, OOM, moving-GC, no-GIL, and TSan witnesses pass.
- Exact-parent 1K/2K/4K instruction/wall evidence, 4K retained-RSS evidence, and allocation attribution are checked in under
docs/.data/with exact checksums. - The unrelated Date getter control remains neutral and all public claims identify exact parent/candidate revisions.