Commit 84be14c2 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Fix TracedReference::IsEmptyThreadSafe

* GetThreadSlot was missing const (Blink CL failed to build).
* Aligning IsEmptyThreadSafe implementation with IsEmpty.

Bug: chromium:1108537
Change-Id: I9c07e9a0e7f029cf3d70b4d2507900b600d064cc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2330027
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69157}
parent e0d382a2
......@@ -916,8 +916,8 @@ class TracedReferenceBase {
/**
* Get this reference in a thread-safe way
*/
T* GetSlotThreadSafe() {
return reinterpret_cast<std::atomic<T*>*>(&val_)->load(
const T* GetSlotThreadSafe() const {
return reinterpret_cast<std::atomic<const T*>*>(&val_)->load(
std::memory_order_relaxed);
}
......@@ -1178,7 +1178,9 @@ class TracedReference : public TracedReferenceBase<T> {
* Returns true if this TracedReference is empty, i.e., has not been
* assigned an object. This version of IsEmpty is thread-safe.
*/
bool IsEmptyThreadSafe() const { return this->GetSlotThreadSafe(); }
bool IsEmptyThreadSafe() const {
return this->GetSlotThreadSafe() == nullptr;
}
};
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment