mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-29 07:04:09 +08:00
The read-only bag accessors made each tracked-field read site a nested ternary with two accessor calls, and each method probe evaluated the bag twice. Large JavaScript programs have a branch per class and property (and per-class key tables copy the computed fallback), so three.js grew from 703 MB to 946 MB of IR and its in-process compile ran out of the 2 GB worker heap in CI. Move the absent-bag handling into shared helpers instead: %dyn.class.readPropertiesOrEmpty is rebuilt in finalize like %dyn.class.readProperties but returns a fresh, unstored empty object for an instance without a bag, and %dyn.class.bagHas/bagHasComputed test a key on a possibly undefined bag. Every read site is one call again, and the three.js IR is back to 719 MB (2.16 GB peak RSS, main 2.15 GB).