• Pierre Langlois's avatar
    [heap] Relax accesses to a page's live byte count. · da2300f6
    Pierre Langlois authored
    Each page has a `live_byte_count_` field in its header and it is always accessed
    with atomic operations. However, apart from one corner case, this field is only
    accessed by the main thread so let's remove the atomicity by default.
    
    To summarise, this changes the MarkingState accessors in the following way:
    
    - IncrementalMarkingState:
    
    Accesses of live_byte_count_ are now non-atomic. Concurrent marking uses local
    maps of live bytes per page so we have exclusive access to the field when using
    this.
    
    - MajorAtomicMarkingState:
    
    This accessor does not guarantee exclusive access to live_byte_count_ so we need
    to keep the access atomic. This is used by the scavenger when migrating an
    object that was marked black, since marking an object black will implicitly
    increment the live_byte_count_.
    
    Additionally, the live_bytes() and SetLiveBytes() accessor methods were not used
    so remove them.
    
    - MajorNonAtomicMarkingState:
    
    Accesses of live_byte_count_ are not actually non-atomic.
    
    - MinorNonAtomicMarkingState:
    
    The `young_generation_live_byte_count_` field is atomic so we can set the memory
    order manual to relax accesses.
    
    Change-Id: I4c6457843783157ca878540e34ad50878afee20c
    Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel
    Reviewed-on: https://chromium-review.googlesource.com/c/1456095Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
    Cr-Commit-Position: refs/heads/master@{#59548}
    da2300f6
mark-compact.h 35.8 KB