Commit 4919e5dc authored by Darius Mercadier's avatar Darius Mercadier Committed by Commit Bot

[heap] make FreeListCategory::is_linked() more precise

Change-Id: I2e0632756ac92b18d2d9a30b03b698b533b34862
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1722564Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@google.com>
Cr-Commit-Position: refs/heads/master@{#63061}
parent 8b66189b
...@@ -318,7 +318,8 @@ MemoryChunk* OldGenerationMemoryChunkIterator::next() { ...@@ -318,7 +318,8 @@ MemoryChunk* OldGenerationMemoryChunkIterator::next() {
FreeList* FreeListCategory::owner() { return free_list_; } FreeList* FreeListCategory::owner() { return free_list_; }
bool FreeListCategory::is_linked() { bool FreeListCategory::is_linked() {
return prev_ != nullptr || next_ != nullptr; return prev_ != nullptr || next_ != nullptr ||
free_list_->categories_[type_] == this;
} }
AllocationResult LocalAllocationBuffer::AllocateRawAligned( AllocationResult LocalAllocationBuffer::AllocateRawAligned(
......
...@@ -2972,7 +2972,7 @@ void FreeListCategory::Free(Address start, size_t size_in_bytes, ...@@ -2972,7 +2972,7 @@ void FreeListCategory::Free(Address start, size_t size_in_bytes,
set_top(free_space); set_top(free_space);
available_ += size_in_bytes; available_ += size_in_bytes;
length_++; length_++;
if ((mode == kLinkCategory) && (prev() == nullptr) && (next() == nullptr)) { if ((mode == kLinkCategory) && !is_linked()) {
owner()->AddCategory(this); owner()->AddCategory(this);
} }
} }
...@@ -3313,7 +3313,7 @@ bool FreeList::AddCategory(FreeListCategory* category) { ...@@ -3313,7 +3313,7 @@ bool FreeList::AddCategory(FreeListCategory* category) {
FreeListCategory* top = categories_[type]; FreeListCategory* top = categories_[type];
if (category->is_empty()) return false; if (category->is_empty()) return false;
if (top == category) return false; DCHECK_NE(top, category);
// Common double-linked list insertion. // Common double-linked list insertion.
if (top != nullptr) { if (top != nullptr) {
......
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