• Michael Lippautz's avatar
    [api, global-handles] Add TracedGlobal · 76c93685
    Michael Lippautz authored
    TracedGlobal integrates with the use case of EmbedderHeapTracer and replaces
    regular weak Global or Persistent nodes for such cases. This allows to simplify
    the case for regular weak handles in a sense that they follow regular weak
    semantics (if the underlying object is otherwise unreachable the weak handle
    will be reset).
    
    TracedGlobal requires slightly different semantics in the sense that it can be
    required to keep them alive on Scavenge garbage collections because there's a
    transitive path that is only known when using the EmbedderHeapTracer.
    TracedGlobal accomodates that use case.
    
    TracedGlobal follows move semantics and can thus be used in regular std
    containers without wrapping data structure.
    
    The internal state uses 20% less memory and allows for only iterating those
    nodes when necessary. The design trades the virtual call when iterating
    interesting persistents in the GC prologue with calling out through the
    EmbedderHeapTracer for each node which is also a virtual call. There is one less
    iteration over the set of handles required though and the design is robust
    against recursive GCs that mutate the embedder state during the prologue
    callback.
    
    Bug: chromium:923361
    Change-Id: Idbacfbe4723cd12af9de21058a4792e51dc4df74
    Reviewed-on: https://chromium-review.googlesource.com/c/1425523
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#59183}
    76c93685
heap-utils.h 2.26 KB