Index: src/heap/store-buffer.cc |
diff --git a/src/heap/store-buffer.cc b/src/heap/store-buffer.cc |
index 45fc7a22f639c4ff18ad378259150b60c66538f5..abf6da409e1906cb5b95ef902678b5ffdcf27611 100644 |
--- a/src/heap/store-buffer.cc |
+++ b/src/heap/store-buffer.cc |
@@ -138,14 +138,28 @@ void StoreBuffer::ConcurrentlyProcessStoreBuffer() { |
} |
void StoreBuffer::DeleteEntry(Address start, Address end) { |
- if (top_ + sizeof(Address) * 2 > limit_[current_]) { |
- StoreBufferOverflow(heap_->isolate()); |
+ // Deletions coming from the GC are directly deleted from the remembered |
+ // set. Deletions coming from the runtime are added to the store buffer |
+ // to allow concurrent processing. |
+ if (heap_->gc_state() == Heap::NOT_IN_GC) { |
+ if (top_ + sizeof(Address) * 2 > limit_[current_]) { |
+ StoreBufferOverflow(heap_->isolate()); |
+ } |
+ *top_ = MarkDeletionAddress(start); |
+ top_++; |
+ *top_ = end; |
+ top_++; |
+ } else { |
+ // In GC the store buffer has to be empty at any time. |
+ DCHECK(Empty()); |
+ Page* page = Page::FromAddress(start); |
+ if (end) { |
+ RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end, |
+ SlotSet::PREFREE_EMPTY_BUCKETS); |
+ } else { |
+ RememberedSet<OLD_TO_NEW>::Remove(page, start); |
+ } |
} |
- *top_ = MarkDeletionAddress(start); |
- top_++; |
- *top_ = end; |
- top_++; |
} |
- |
} // namespace internal |
} // namespace v8 |