Parents: #475, #460 Related: #528, #577, #581
Problem
Each bound Intl.Collator.prototype.compare call correctly coerces its two arguments, but then rebuilds instance configuration by allocating a fresh locale string cell, running CanonicalizeLocaleList again, boxing/re-reading the internal options object through generic property operations, and reconstructing CollatorOptions. The constructor already validated and normalized that immutable per-instance state.
Sorting attacker-controlled arrays multiplies this configuration work by the comparison count, adding allocation, GC, and lock pressure unrelated to collation itself. The representative matrix has no dedicated direct-compare or sort consumer row, so the scored boundary must be committed first.
Scope
- Add dependency-free steady direct-compare and bound-comparator sort rows across default, search, numeric, case-first, sensitivity, punctuation, collation, locale-extension, ASCII, accented, and Unicode inputs.
- Keep Collator and fixed input fixture construction outside the steady boundary. Normalize compare results to sign and hash every sorted string so zig-js and system JSC execute identical public work.
- Attribute exact-parent allocations/bytes, GC cells/collections, property/environment locks, timing, and process memory before changing the runtime.
- Reuse the constructor-normalized immutable locale/options state for bound compare calls without allocating or rerunning locale-list/option abstract operations.
- Preserve per-call left-to-right
ToStringcoercion and abrupt completion, bound-function identity, locale/extension resolution, all sensitivity/numeric/case/punctuation/collation behavior, moving roots, and shared-realm no-GIL safety.
Security and no-workaround rules
Strings, array length/order, comparison count, locale/options, accessors, and coercion side effects are attacker-controlled. The implementation must remove repeated instance-state work without caching comparison results or keys globally, recognizing benchmark source/names, skipping input coercion/comparisons, changing sort work, omitting supported locale behavior, weakening OOM/GC/watchdog accounting, or adding unbounded mutable state.
Acceptance
- Committed direct-compare and sort rows meet the timing protocol and have stable non-zero sign/content checksums identical to system JSC.
- Exact-parent evidence attributes and removes repeated locale/options allocation and generic instance-state work, without reducing scored comparisons or increasing collections/locks.
- Default/search/numeric/caseFirst/sensitivity/ignorePunctuation/collation/extension behavior, coercion/throws, and bound compare identity remain exact.
- Focused OOM, bounded-heap adversarial sort, moving nursery, shared-realm no-GIL, and suppression-free TSan coverage pass.
- The complete
test/intl402/Collatorsubtree, full Intl402, and full sharded units have no regressions.
Exclusions
No Promise, microtask, Worker, queue, job-lifecycle, stack, or user-owned documentation changes.