ReviewOS

zig-utils/zig-js

VM: quicken direct prototype indexed data reads

#1054
Closed chris opened this 9 days ago ·
9 days ago

Parent: #498 Related: #1048, #1049, #1051, #1053, #493

Measured problem

The executed holey-Array VM witness confirms that a direct prototype indexed data value (for example Array.prototype[1] = 9; [1,,3][1]) is returned correctly while the dense and sparse indexed-read counters remain unchanged. The read falls through to the full generic prototype walk.

Scope

  • Add an exact one-hop prototype indexed-data read for primitive Number and canonical String keys.
  • Take coherent receiver/prototype indexed snapshots across dense, sparse named-data, and accessor representations.
  • Preserve receiver own-property precedence, getters, Proxies/revocation, deeper prototype chains, observable key coercion, restriction ownership, and no-GIL synchronization.
  • Add a dedicated hit counter and update the source-derived quickening inventory and generated architecture page.

Acceptance

  • The pre-change zero-hit witness records positive prototype-index hits with identical Node results.
  • Dense and sparse direct-prototype data work for Number and canonical String keys in isolated/shared modes.
  • Receiver own dense/sparse/accessor state takes precedence.
  • Prototype accessors, Proxies, deeper chains, and object/Symbol/non-canonical keys stay generic.
  • Receiver/prototype restriction ownership and unsuppressed TSan coverage pass.
  • Quickening inventory, benchmark-validator, docs-manifest, and offline-link gates pass.
9 days ago

Implemented and pushed in 10bb4e3.

Primitive Number and canonical String reads from a direct Array prototype now use coherent indexed snapshots across named and dense storage when the receiver has no exact own property. Receiver-owned data still wins. Accessors, Proxies, exotics, deeper prototype chains, observable/non-canonical keys, and restriction failures continue through ordinary [[Get]].

Measured evidence:

  • The pre-change inherited-hole witness recorded zero indexed fast-path hits; the completed isolated/shared matrix records direct dense and sparse prototype hits.
  • The 10-case behavior matrix matches Node exactly.
  • Focused behavior and receiver/prototype restriction tests pass 3/3 in normal and 3/3 in unsuppressed TSan builds.
  • Neighboring holey-array and canonical String tests pass 2/2 each.
  • Quickening inventory: 17 guarded families, 5 unsupported families, and 42 observability counters.
  • Aggregate benchmark validators: 19/19.
  • Documentation: 51 pages generated and all 378 offline links resolve.

The test262 corpus is unavailable in this checkout, so no conformance-flip claim is made.

Sign in to comment on this issue.