Parent: #493 Related: #460, #471, #478, #480, #529
Problem
Shape.lookupState and Shape.lookup walk the immutable parent chain linearly. That is compact and effective for ordinary shallow objects, while inline caches remove repeated lookup at stable source sites. Generic or computed access to an object with N attacker-controlled named properties cannot use one stable inline-cache key, however: each HasProperty or Get walks O(N) shape operations. A length-N Array generic over a plain array-like with N numeric named properties therefore performs O(N²) shape-name comparisons.
The deterministic #529 diagnostic rows expose the independent curve: 1K, 2K, and 4K generic array-like traversal grows far faster than linearly even after temporary decimal-key allocation is removed. This issue owns the lookup complexity; #529 remains the separate temporary-key lifetime fix.
Scope
- Add an immutable or versioned exact name-to-latest-operation index for deep Shapes, preserving transition sharing, stable slots, deletion tombstones, re-add semantics, and prepared literal shapes.
- Keep shallow objects compact and fast; activate or consult indexed state only when exact attribution justifies it.
- Make every lookup collision-safe and deterministic in semantics under attacker-controlled property names.
- Prove publication ordering and lifetime for no-GIL readers, concurrent transitions, deletion compaction, moving GC, and Context teardown.
- Bound index construction, rebuild, and retained memory in terms of live/historical shape state.
No-workaround rules
- No cap on object property count or Array logical length, numeric-key special case presented as a general shape fix, semantic key cache, linear fallback on hash collisions, globally shared mutable cache, predictable collision-vulnerable table, GIL, or bypass of attributes/prototypes/Proxy behavior.
- Do not replace the shape chain with per-object maps or sacrifice transition convergence without exact evidence proving the full object-model tradeoff.
Acceptance
- Exact-parent 1K/2K/4K computed Has/Get and generic array-like rows demonstrate approximately linear work using instruction and shape-lookup counters, with frozen results.
- Shallow literal, monomorphic property, transition-hit/miss, deletion/re-add, sparse numeric, and dense Array controls do not regress materially.
- Collision corpus, adversarial names, deep delete/re-add history, deterministic OOM/fault injection, and bounded-heap/RSS tests pass.
- Shared transition publication scales monotonically at 1/2/4/8 lanes; no-GIL, threadfuzz, moving/parallel GC, lifecycle, and suppression-free TSan pass.
- Full units and affected test262 Object/Array/Proxy subtrees pass with nonzero denominators.
Security boundary
Property names and shape depth are attacker-controlled. Lookup must remain exact under collision and concurrent publication while CPU and retained memory stay bounded by documented shape state.