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: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69157}
This commit is contained in:
Omer Katz 2020-07-31 00:29:08 +02:00 committed by Commit Bot
parent e0d382a2f4
commit 84be14c245

View File

@ -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;
}
};
/**