Defect
JSON.parse(text, reviver) records primitive source metadata in one flat list. Every InternalizeJSONProperty callback scans that full list backward to find (holder, key, unchanged value), so a flat array/object with n primitives performs Θ(n²) metadata comparisons before invoking the required callbacks.
A production ReleaseFast growth witness on a flat numeric array measured 16k → 32k → 64k elements at 0.23s → 0.76s → 2.98s (approximately 4x at the larger doubling). Results and context.source checksums remained correct.
Implementation
- Replace the global reverse scan with invocation-local source metadata indexed first by parsed holder and then by property key.
- Keep only the last primitive source for duplicate object keys, matching JSON overwrite semantics.
- Retain the unchanged-value check so reviver-visible mutations suppress
context.sourceexactly as required. - Do not attach metadata to shared engine objects or introduce process-global state.
Acceptance
- Deterministic tests cover arrays, numeric-key object ordering, duplicate keys, escaped keys,
-0/0, NaN-inapplicability, and reviver mutation. - A growth witness demonstrates near-linear source lookup work/time rather than quadratic scanning.
- Focused normal + TSan gates and JSON.parse test262 pass with zero regressions.
- Exact-parent evidence records representative/adversarial impact without unsupported wall-time claims.