• Samuel Groß's avatar
    [sandbox] Introduce ExternalPointerTable::Freelist · 7e4ee686
    Samuel Groß authored
    This struct represents the freelist of an ExternalPointerTable and
    contains both the size and the head of the freelist. It is encoded and
    stored as a single Atomic64 field (freelist_) inside the
    ExternalPointerTable class. This ensures that the freelist head and size
    are always synchronized.
    
    Previously, the freelist size was encoded in freelist entries in the top
    bits. This only works as long as the maximum table size is relatively
    small however, as it requires both the freelist size and the index of
    the next entry on the list to fit into 24 bits. To allow for bigger
    maximum table sizes in the future, this CL moves the freelist size
    directly into the table as part of the freelist_ field.
    
    Bug: v8:10391
    Change-Id: Id09c9b28d09d79b704ac47e6566029cfb209ecd1
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3891256
    Commit-Queue: Samuel Groß <saelo@chromium.org>
    Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83193}
    7e4ee686