Expand description
Shape graph for HashMap hidden classes.
A “shape” describes the ordered property layout of a HashMap, enabling O(1) index-based property access instead of hash-based lookup. This is the same concept as V8’s “hidden classes” or “maps”.
Shapes form a transition tree: adding a property transitions to a child shape. Multiple HashMaps with the same property insertion order share the same shape, enabling inline caching.
Structs§
- Shape
- A shape describes the ordered property layout of a HashMap.
- ShapeId
- Unique identifier for a shape in the transition graph.
- Shape
Transition Table - Manages shape creation and transitions.
Functions§
- drain_
shape_ transitions - Drain all pending shape transition events.
- hash_
property_ name - Hash a property name string to a u32 for shape transition keys.
- shape_
for_ hashmap_ keys - Compute a ShapeId for a HashMap with the given key hashes (in insertion order).
- shape_
property_ index - Look up the slot index of a property in a shape.
- shape_
transition - Transition a shape by adding a new property.