ReviewOS

zig-utils/zig-js

Runtime: remove synthetic constructor lookup fallback

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

Parent: #498 Related: #1060, #475

The remaining kind-based constructor fallback fabricates constructor after the actual prototype chain reports a miss.

Executed probe: eight factories (plain Object, Array, Map, Set, Date, RegExp, Error, and Function) each receive an otherwise-empty null-rooted prototype. Node reports value.constructor === undefined for all eight. The saved before binary reports false for all eight in both tree and required-bytecode modes.

Acceptance:

  • Remove the remaining constructor fallback and its unused kind-to-global helper.
  • Preserve actual own/inherited constructor descriptors, undefined values, getters, and Proxy behavior.
  • Pin missing/deleted/shadowed constructors, live prototype mutations, presence-vs-undefined, and ordinary constructor identity across builtin kinds against Node.
  • Repair any actual intrinsic prototype wiring gaps exposed by removal; do not retain a synthetic property workaround.
  • Normal/unsuppressed TSan and targeted before/after Test262 checks pass.
9 days ago

Fixed in 54c70f5.

The remaining synthetic constructor fallback and unused kind-to-global helper are removed. Ordinary Get now follows only actual own/prototype descriptors. Five Node-confirmed matrices retain standard builtin identities, live mutations, absent-vs-present-undefined, accessor receiver identity, and Proxy behavior. All eight original reproduction assertions now match Node in both tree and required-bytecode modes.

Validation:

  • Focused constructor-read tests: 3/3.
  • Broader constructor suite: 63/63 under unsuppressed TSan, including realm, GC, no-GIL, embedding, and Wasm fixtures.
  • Property-slot presence fixture passes within that suite; quickening inventory passes.
  • Saved before/after corpus transcripts are byte-identical: Object 3,411 pass, Array 3,081, Function 509, Map 204, Set 383, Error 93, RegExp prototype 487, and the RegExp ctor filename-filter 35. All have zero failures and zero flips.
  • Date remains 592 pass / 2 existing toISOString failures, at identical paths and with identical reasons. No new failures were introduced; those failures are separate follow-up work.

The full RegExp Unicode sweep was stopped after sampling showed expensive string generation. Its partial output is preserved and unscored. The RegExp constructor/prototype operations above were executed completely on both binaries.

Sign in to comment on this issue.