Expand description
Shapes: the transition tree, dictionary mode and prototype validity cells.
A transition shape describes one property added on top of its parent; the
tree has one root per (prototype, kind). Lookup walks parent for eight
properties or fewer and otherwise uses a table built on first lookup.
Transition shapes are immutable and shared; reconfiguring a property or
changing the prototype replays the object’s keys from another root, so the
slots keep their positions.
Dictionary mode gives an object an unshared shape with its own hash table
and insertion-ordered entry list. It is entered on deletion, past
DICTIONARY_THRESHOLD properties, and always for the global object.
Every object used as a prototype has a PrototypeInfo: a lazily created
validity cell and the list of prototype objects that inherit from it. Any
change to a prototype object clears its cell and, through the dependents
lists, every cell downstream. A shape caches its prototype’s cell; the
prototype IC records (holder, slot, cell) and tests one boolean.
Structs§
- Dict
Entry - Dictionary
- The unshared table of a dictionary-mode object.
- Property
Flags - Prototype
Info - Per-prototype bookkeeping. The table holding it is weak in its key and in
dependents; the collector prunes dead objects after marking. - Shape
- Validity
Cell
Enums§
- Transitions
- A shape’s outgoing transitions: a vector for up to four entries, a map beyond. Entries are weak: the collector drops those whose child died.
Constants§
- DICTIONARY_
THRESHOLD - Adding a property beyond this count moves the object to dictionary mode.
- STATIC_
CELL - The always-valid cell of shapes without a prototype.
- TABLE_
THRESHOLD - Past this many properties a transition shape builds a lookup table.