[heap] Avoid concurrent accessors when releasing slot sets

Those sets are to be released on the main thread without concurrent
accesses. Making this explicit will give TSAN a chance to help us once
the surrounding code changes.

Bug: 
Change-Id: Ia73754caafbeec385d4c922fb8140e3e64f7378c
Reviewed-on: https://chromium-review.googlesource.com/541375
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46025}
This commit is contained in:
Michael Lippautz 2017-06-20 10:35:29 +02:00 committed by Commit Bot
parent a42473abb7
commit 0a67fdf63a
2 changed files with 10 additions and 8 deletions

View File

@ -1249,10 +1249,10 @@ template void MemoryChunk::ReleaseSlotSet<OLD_TO_OLD>();
template <RememberedSetType type>
void MemoryChunk::ReleaseSlotSet() {
SlotSet* slot_set = base::AsAtomicWord::Acquire_Load(&slot_set_[type]);
SlotSet* slot_set = slot_set_[type];
if (slot_set) {
slot_set_[type] = nullptr;
delete[] slot_set;
base::AsAtomicWord::Release_Store(&slot_set_[type], nullptr);
}
}
@ -1277,11 +1277,10 @@ template void MemoryChunk::ReleaseTypedSlotSet<OLD_TO_OLD>();
template <RememberedSetType type>
void MemoryChunk::ReleaseTypedSlotSet() {
TypedSlotSet* typed_slot_set =
base::AsAtomicWord::Acquire_Load(&typed_slot_set_[type]);
TypedSlotSet* typed_slot_set = typed_slot_set_[type];
if (typed_slot_set) {
typed_slot_set_[type] = nullptr;
delete typed_slot_set;
base::AsAtomicWord::Release_Store(&typed_slot_set_[type], nullptr);
}
}

View File

@ -461,19 +461,22 @@ class MemoryChunk {
return typed_slot_set_[type];
}
inline LocalArrayBufferTracker* local_tracker() { return local_tracker_; }
bool contains_array_buffers();
template <RememberedSetType type>
SlotSet* AllocateSlotSet();
// Not safe to be called concurrently.
template <RememberedSetType type>
void ReleaseSlotSet();
template <RememberedSetType type>
TypedSlotSet* AllocateTypedSlotSet();
// Not safe to be called concurrently.
template <RememberedSetType type>
void ReleaseTypedSlotSet();
void AllocateLocalTracker();
void ReleaseLocalTracker();
inline LocalArrayBufferTracker* local_tracker() { return local_tracker_; }
bool contains_array_buffers();
void AllocateYoungGenerationBitmap();
void ReleaseYoungGenerationBitmap();