Related evidence/matrix: #460
Problem
Every Date.prototype.set* call currently copies the complete supplied
argument list into context-arena storage before applying the setter. Repeated
setter calls therefore retain proportional backing until context teardown even
though each specification algorithm consumes at most four values.
The same loop coerces arguments beyond the method's specification arity. For
example, setUTCFullYear(year, month, date, extra) invokes extra.valueOf();
ECMA-262 only converts year, month, and date, so an ignored extra argument
must not run user code or throw.
Current exact witness:
let calls = 0;
const extra = { valueOf() { calls++; throw new Error("coerced"); } };
const date = new Date(0);
date.setUTCFullYear(1970, 0, 1, extra); // currently throws in zig-js
if (calls !== 0 || date.getTime() !== 0) throw new Error("wrong");Scope
- Replace per-call arena argument copies with bounded native storage selected by the exact setter algorithm arity.
- Coerce only specification-consumed arguments, once each and left-to-right.
- Preserve the required ordering where
[[DateValue]]is read beforeToNumber, including callbacks that mutate the receiver and invalid-Date behavior. - Cover omitted optionals, extra arguments, abrupt completion, negative zero, rollover, and every local/UTC setter family.
- Add deterministic 1K/2K/4K setter-churn witnesses with exact checksums plus an ordinary no-setter allocation control.
- Publish exact-parent CPU, allocation, peak-RSS, and retained-RSS evidence.
Acceptance
- Extra arguments past each setter's ECMA-262 arity are not observed.
- Required arguments are coerced exactly once in specification order, and abrupt completion leaves later conversions/unobservable stores undone.
- Setter churn performs no per-call argument-buffer allocation and does not retain memory proportional to call count.
- 1K/2K/4K exact checksums establish the expected growth curve without a benchmark-specific engine path.
- Focused Date test262, unit, OOM, moving/full GC, no-GIL, and TSan gates pass with zero regressions.
- Seven balanced exact-parent pairs report CPU/allocation/peak/retained effects and include an ordinary control.
No-workaround rules
No skipped in-arity coercion, cached callback result, disabled GC, unbounded scratch buffer, hard count limit, swallowed abrupt completion/OOM, strong retention of transient arguments, source/workload recognition, or benchmark-only fast path.