Skip to main content

Module shape_graph

Module shape_graph 

Source
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.
ShapeTransitionTable
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.