• Omer Katz's avatar
    cppgc: Fix termination GCs · 7a22cf7a
    Omer Katz authored
    Whenever we destroy an object that contains a
    (Weak)(CrossThread)Persistent, we call the Persistent's dtor which frees
    the relevant PersistentNode. To get the PersistentRegion for the node,
    we get the value, then get the the relevant page which holds a reference
    to the heap which holds the regions.
    
    During a termination GC there is no marking and no weak callback
    processing. That means that, when destroying a Persistent, the page on
    which the object referenced by the Persistent resides may have already
    been swept and destroyed. Then when we try to get the page we cleared or
    unallocated memory and crash.
    This issue presented as a sweeper crash in the web tests and
    content_browsertests.
    
    This issue affects only Weak(CrossThread)Persistent since the region for
    their strong counterparts are already cleared at the start of a
    termination GC.
    This is not an issue in the Blink impl because (1) Blink finds the
    elevant regions through ThreadState without going through pages, and
    (2) Blink runs a  full GC on termination that includes executing weak
    callbacks.
    
    Alternatively we could trace the Weak(CrossThread)Persistent region
    which will run the weakness callbacks and clear all WeakPersistents.
    The cost and outcome is equivalent.
    
    Bug: chromium:1056170
    Change-Id: I3db5b01424500eb695f9876247ef0c787d0d9ef2
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2708645
    Commit-Queue: Omer Katz <omerkatz@chromium.org>
    Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72897}
    7a22cf7a
Name
Last commit
Last update
..
api Loading commit data...
asmjs Loading commit data...
ast Loading commit data...
base Loading commit data...
baseline Loading commit data...
builtins Loading commit data...
codegen Loading commit data...
common Loading commit data...
compiler Loading commit data...
compiler-dispatcher Loading commit data...
d8 Loading commit data...
date Loading commit data...
debug Loading commit data...
deoptimizer Loading commit data...
diagnostics Loading commit data...
execution Loading commit data...
extensions Loading commit data...
flags Loading commit data...
handles Loading commit data...
heap Loading commit data...
ic Loading commit data...
init Loading commit data...
inspector Loading commit data...
interpreter Loading commit data...
json Loading commit data...
libplatform Loading commit data...
libsampler Loading commit data...
logging Loading commit data...
numbers Loading commit data...
objects Loading commit data...
parsing Loading commit data...
profiler Loading commit data...
protobuf Loading commit data...
regexp Loading commit data...
roots Loading commit data...
runtime Loading commit data...
sanitizer Loading commit data...
snapshot Loading commit data...
strings Loading commit data...
tasks Loading commit data...
third_party Loading commit data...
torque Loading commit data...
tracing Loading commit data...
trap-handler Loading commit data...
utils Loading commit data...
wasm Loading commit data...
zone Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
OWNERS Loading commit data...