From d49657edd70a6809c85ab5c60e55326e0317b01a Mon Sep 17 00:00:00 2001 From: hpayer Date: Tue, 10 Mar 2015 07:19:14 -0700 Subject: [PATCH] Remove unnecessary NoBarrier_load instructions in store buffer. There are no stale store buffer pointers anymore. The sweeper thread can not be in conflict with store buffer processing. BUG= Review URL: https://codereview.chromium.org/993983002 Cr-Commit-Position: refs/heads/master@{#27107} --- src/heap/store-buffer.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/heap/store-buffer.cc b/src/heap/store-buffer.cc index 8613e2f..37326e7 100644 --- a/src/heap/store-buffer.cc +++ b/src/heap/store-buffer.cc @@ -350,8 +350,7 @@ void StoreBuffer::VerifyPointers(LargeObjectSpace* space) { // When we are not in GC the Heap::InNewSpace() predicate // checks that pointers which satisfy predicate point into // the active semispace. - Object* object = reinterpret_cast( - base::NoBarrier_Load(reinterpret_cast(slot))); + Object* object = *slot; heap_->InNewSpace(object); slot_address += kPointerSize; } @@ -381,8 +380,7 @@ void StoreBuffer::GCEpilogue() { void StoreBuffer::ProcessOldToNewSlot(Address slot_address, ObjectSlotCallback slot_callback) { Object** slot = reinterpret_cast(slot_address); - Object* object = reinterpret_cast( - base::NoBarrier_Load(reinterpret_cast(slot))); + Object* object = *slot; // If the object is not in from space, it must be a duplicate store buffer // entry and the slot was already updated. @@ -390,8 +388,7 @@ void StoreBuffer::ProcessOldToNewSlot(Address slot_address, HeapObject* heap_object = reinterpret_cast(object); DCHECK(heap_object->IsHeapObject()); slot_callback(reinterpret_cast(slot), heap_object); - object = reinterpret_cast( - base::NoBarrier_Load(reinterpret_cast(slot))); + object = *slot; // If the object was in from space before and is after executing the // callback in to space, the object is still live. // Unfortunately, we do not know about the slot. It could be in a @@ -435,6 +432,8 @@ void StoreBuffer::ClearInvalidStoreBufferEntries() { for (Address* current = old_start_; current < old_top_; current++) { Address addr = *current; Object** slot = reinterpret_cast(*current); + // Use a NoBarrier_Load here since the slot can be in a dead object + // which may be touched by the concurrent sweeper thread. Object* object = reinterpret_cast( base::NoBarrier_Load(reinterpret_cast(slot))); if (heap_->InNewSpace(object)) { @@ -462,8 +461,7 @@ void StoreBuffer::ClearInvalidStoreBufferEntries() { void StoreBuffer::VerifyValidStoreBufferEntries() { for (Address* current = old_start_; current < old_top_; current++) { Object** slot = reinterpret_cast(*current); - Object* object = reinterpret_cast( - base::NoBarrier_Load(reinterpret_cast(slot))); + Object* object = *slot; CHECK(heap_->InNewSpace(object)); heap_->mark_compact_collector()->VerifyIsSlotInLiveObject( reinterpret_cast(slot), -- 2.7.4