cppgc: Check AssignUnsafe use cases
Assert that the lock is help whenever AssignUnsafe is called. LazyMutex::AssertHeld resolves to a DCHECK so this should not regress production performance (other than the call itself that might not be inlined). Bug: chromium:1056170 Change-Id: Ic2005d180e6960c24dff7743aa3e0d5e57a63d80 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2716286 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Omer Katz <omerkatz@chromium.org> Cr-Commit-Position: refs/heads/master@{#73000}
This commit is contained in:
parent
8cc862ed79
commit
e18591dfb4
@ -271,6 +271,7 @@ class BasicCrossThreadPersistent final : public PersistentBase,
|
||||
}
|
||||
|
||||
void AssignUnsafe(T* ptr) {
|
||||
PersistentRegionLock::AssertLocked();
|
||||
const void* old_value = GetValue();
|
||||
if (IsValid(old_value)) {
|
||||
PersistentRegion& region = this->GetPersistentRegion(old_value);
|
||||
|
@ -121,6 +121,8 @@ class V8_EXPORT PersistentRegionLock final {
|
||||
public:
|
||||
PersistentRegionLock();
|
||||
~PersistentRegionLock();
|
||||
|
||||
static void AssertLocked();
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -90,5 +90,10 @@ PersistentRegionLock::~PersistentRegionLock() {
|
||||
g_process_mutex.Pointer()->Unlock();
|
||||
}
|
||||
|
||||
// static
|
||||
void PersistentRegionLock::AssertLocked() {
|
||||
return g_process_mutex.Pointer()->AssertHeld();
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace cppgc
|
||||
|
Loading…
Reference in New Issue
Block a user