Parent: #473 Related: #666, #676, #677
Problem
The owned RegExp construction/state layer still consumes or stores physical bytes from toStringV at seven StringData boundaries:
- explicit and regexp-like flags in the RegExp constructor;
- pattern and flags in
RegExp.prototype.compile; - generic source and flags in
RegExp.prototype.toString; - the legacy
RegExp.input/RegExp.$_setter.
With physical flat Latin-1 storage active, a non-ASCII pattern can fail compilation, generic toString can emit invalid canonical StringData, and legacy input can be republished from physical bytes. Flags are ASCII by grammar, but their coerced StringData still enters the owned flag scanner and state constructor and must use the same semantic boundary.
Scope
- Route these seven construction/state coercions through the representation-aware WTF-8 helper.
- Preserve exact Get and ToString order/count, constructor identity fast paths, flag validation, compile rollback, lastIndex reset, generic toString ordering, legacy brand checks, exception identity, ASCII borrowing, and OOM propagation.
- Cover non-ASCII compile/toString/legacy input plus exact constructor coercion counts under canonical and physical flat-Latin-1 storage.
No-workaround rules
- No flat-storage disablement, eager global canonicalization, replacement characters, duplicate coercion, alternate regex engine, hidden retry, or Test262 exclusion.
- No stack, queue, job, Promise, Worker, or Map/Set iterator changes.
- RegExp symbol protocols and String replace/match/split dispatch are follow-up scope, not bundled here.
Acceptance
- Every owned RegExp construction/state StringData reader consumes canonical semantic WTF-8.
- Non-ASCII compile patterns, generic toString source, and legacy input preserve exact text.
- Constructor/compile hooks run once and in specification order; failed compile rolls state back.
- The witness passes with canonical storage and with
flat_storage_activeenabled, then the switch is restored and not landed. - Relevant nonzero Test262 accounting, focused Debug/ReleaseSafe/TSan, and full units pass with exact flips reported.