Expand description
Code units compiled at run time: eval, the Function constructors and
$262.evalScript publish into the heap, which frees a unit once no
bytecode record names it.
A unit is reached through the unit index of its bytecode records, so a
collection marks it while marking them: a live function, a running frame
(through its function), a suspended generator and a pending job all reach
one. A unit published but not yet instantiated has no record; it is
pinned until its compilation ends. The loop holds a running unit through
an Rc, so freeing a slot never invalidates the code it is executing;
by the time a slot is swept no frame names it and its count is one.
A live unit marks its atoms (CodeUnit::atoms); a freed one returns its
cache entries to the IcStore and its bytes to
the heap’s account.