ReviewOS

zig-utils/zig-js

Primitive Get: resolve indexed misses through canonical lookup

#1060
Closed chris opened this 8 days ago ·
8 days ago

Parent: #498 Related: #1059, #473

Primitive String indexed misses return undefined before prototype lookup. The separate primitive getter also omits Array exotic storage. A legacy constructor fallback fabricates a constructor after its prototype property has been deleted, including on explicit primitive wrappers.

Executed eight-assertion probe: Node returns eight true values. The saved before binary returns false,true,false,false,false,true,false,false in both tree and required-bytecode modes. Six assertions fail: inherited String index data, inherited Array storage, empty-String access through a TypedArray ancestor, and missing constructors on Number primitives/wrappers.

Acceptance:

  • Preserve own String length/UTF-16 character fast reads, then route a boxed miss through the canonical property algorithm with the original primitive receiver.
  • Remove the duplicated primitive prototype walker and its constructor fallback; wrappers must not fabricate absent constructor properties.
  • Pin named data/accessors, Array/arguments/String/TypedArray ancestors, receiver identity, noncanonical keys, Proxy boundaries, and GC/root ownership against Node.
  • Focused normal/unsuppressed TSan and targeted before/after String/primitive corpus checks pass.
8 days ago

Fixed in 15263232.

Primitive Get retains direct own String length/UTF-16 character reads, then roots the original receiver and temporary box and delegates to the canonical property algorithm. The duplicate primitive prototype walker and its constructor fallback are removed; primitive wrappers no longer fabricate deleted constructor properties. The existing property-slot result also propagates absent-vs-present-undefined correctly.

Evidence:

  • The before probe had six failures among eight Node assertions in both tree and required-bytecode modes. All eight now match Node in both modes.
  • Five semantic matrices pin Array/arguments/String/TypedArray ancestors, accessor/Proxy receiver identity, noncanonical names, and absent constructors.
  • Engine fixtures cover forced GC in a getter, recovery after a throwing getter, and an ephemeral Symbol receiver across GC, in isolated/shared required-bytecode contexts.
  • Broader primitive suite: 23/23. Final focused tests: 4/4 normally and 4/4 under unsuppressed TSan. Immutable String index fixture: 2/2.
  • Test262 before/after: String 1,223, Number 340, Boolean 51, Symbol 98, BigInt 77. All 1,789 pass on both sides, with zero failures, zero flips, and byte-identical outputs.
  • Quickening inventory gate passes.

Sign in to comment on this issue.