Files
scriptc/tests
Chris Tateandblurname 2f88f35281 Freeze records that other references still hold
Object.freeze of a record that another reference may still hold stopped at
compile time with SC2020 ("possibly-aliased value"), and freezing a record
held in an untyped value threw SC2020 at run time. Node freezes the object
itself: every later write through any reference throws a TypeError in
strict mode code and leaves the object unchanged in sloppy-mode code.

- A record a program may freeze keeps a frozen bit in its reference count
  word. A shape is freezable when a typed Object.freeze names it, or, in a
  program that freezes untyped values, when a value of it can be held as a
  live untyped reference. Only those shapes change: their release ignores
  the bit, and every write to them, keyed writes and deletes included,
  checks it first.
- Object.freeze of a record held in an untyped value sets the bit and
  freezes the record's checked view, so Object.isFrozen, Object.isSealed
  and Object.isExtensible through that value answer for the frozen record.
  A typed Object.isFrozen of a record reads the bit.
- Programs that never freeze a record compile to the same IR and LLVM.

Corpus 7404 covers typed and untyped freezes, a recursive freeze through
unknown, keyed writes and deletes, optional-field deletes, Object.assign,
tuples, and frozen records that are released or collected as cycles, in
strict mode code. 7405 covers the same writes in sloppy-mode code. Both
match Node.

Refs #1374

Co-authored-by: blurname <50226652+blurname@users.noreply.github.com>
2026-10-23 01:56:34 -05:00
..
…
2026-10-20 17:56:44 -05:00