Commit f6657e46 authored by Hannes Payer's avatar Hannes Payer Committed by Commit Bot

[heap] Replace page header check in store buffer with slower large object lookup.

Bug: chromium:800251
Change-Id: I44d997bd54be214c34ca2864470f7cdfc3cc30f3
Reviewed-on: https://chromium-review.googlesource.com/859437
Commit-Queue: Hannes Payer <hpayer@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50504}
parent 3a79d5bc
......@@ -186,18 +186,13 @@ bool PagedSpace::TryFreeLast(HeapObject* object, int object_size) {
}
MemoryChunk* MemoryChunk::FromAnyPointerAddress(Heap* heap, Address addr) {
MemoryChunk* chunk = MemoryChunk::FromAddress(addr);
uintptr_t offset = addr - chunk->address();
if (offset < MemoryChunk::kHeaderSize || !chunk->HasPageHeader()) {
chunk = heap->lo_space()->FindPageThreadSafe(addr);
MemoryChunk* chunk = heap->lo_space()->FindPage(addr);
if (chunk == nullptr) {
chunk = MemoryChunk::FromAddress(addr);
}
return chunk;
}
Page* Page::FromAnyPointerAddress(Heap* heap, Address addr) {
return static_cast<Page*>(MemoryChunk::FromAnyPointerAddress(heap, addr));
}
void Page::MarkNeverAllocateForTesting() {
DCHECK(this->owner()->identity() != NEW_SPACE);
DCHECK(!IsFlagSet(NEVER_ALLOCATE_ON_PAGE));
......
......@@ -792,8 +792,6 @@ class Page : public MemoryChunk {
static Page* ConvertNewToOld(Page* old_page);
inline static Page* FromAnyPointerAddress(Heap* heap, Address addr);
// Create a Page object that is only used as anchor for the doubly-linked
// list of real pages.
explicit Page(Space* owner) { InitializeAsAnchor(owner); }
......@@ -2944,6 +2942,8 @@ class LargeObjectSpace : public Space {
std::unique_ptr<ObjectIterator> GetObjectIterator() override;
base::Mutex* chunk_map_mutex() { return &chunk_map_mutex_; }
#ifdef VERIFY_HEAP
virtual void Verify();
#endif
......
......@@ -105,10 +105,14 @@ void StoreBuffer::MoveEntriesToRememberedSet(int index) {
DCHECK_GE(index, 0);
DCHECK_LT(index, kStoreBuffers);
Address last_inserted_addr = nullptr;
// We are taking the chunk map mutex here because the page lookup of addr
// below may require us to check if addr is part of a large page.
base::LockGuard<base::Mutex> guard(heap_->lo_space()->chunk_map_mutex());
for (Address* current = start_[index]; current < lazy_top_[index];
current++) {
Address addr = *current;
Page* page = Page::FromAnyPointerAddress(heap_, addr);
MemoryChunk* chunk = MemoryChunk::FromAnyPointerAddress(heap_, addr);
if (IsDeletionAddress(addr)) {
last_inserted_addr = nullptr;
current++;
......@@ -116,15 +120,15 @@ void StoreBuffer::MoveEntriesToRememberedSet(int index) {
DCHECK(!IsDeletionAddress(end));
addr = UnmarkDeletionAddress(addr);
if (end) {
RememberedSet<OLD_TO_NEW>::RemoveRange(page, addr, end,
RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, addr, end,
SlotSet::PREFREE_EMPTY_BUCKETS);
} else {
RememberedSet<OLD_TO_NEW>::Remove(page, addr);
RememberedSet<OLD_TO_NEW>::Remove(chunk, addr);
}
} else {
DCHECK(!IsDeletionAddress(addr));
if (addr != last_inserted_addr) {
RememberedSet<OLD_TO_NEW>::Insert(page, addr);
RememberedSet<OLD_TO_NEW>::Insert(chunk, addr);
last_inserted_addr = addr;
}
}
......
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