Commit ccd53957 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Do not skip LAB in PagedSpaceObjectIterator

Instead of skipping LAB in PagedSpaceObjectIterator, make the space
iterable by inserting a filler object into the LAB.

Bug: v8:10315
Change-Id: I6d79c309b7b8180b2a173ebd5ebdf8a893e88c4d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2210234Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67928}
parent 312d6d52
......@@ -27,10 +27,6 @@ HeapObject PagedSpaceObjectIterator::Next() {
HeapObject PagedSpaceObjectIterator::FromCurrentPage() {
while (cur_addr_ != cur_end_) {
if (cur_addr_ == space_->top() && cur_addr_ != space_->limit()) {
cur_addr_ = space_->limit();
continue;
}
HeapObject obj = HeapObject::FromAddress(cur_addr_);
const int obj_size = obj.Size();
cur_addr_ += obj_size;
......
......@@ -32,6 +32,7 @@ PagedSpaceObjectIterator::PagedSpaceObjectIterator(Heap* heap,
space_(space),
page_range_(space->first_page(), nullptr),
current_page_(page_range_.begin()) {
space_->MakeLinearAllocationAreaIterable();
heap->mark_compact_collector()->EnsureSweepingCompleted();
}
......@@ -43,6 +44,7 @@ PagedSpaceObjectIterator::PagedSpaceObjectIterator(Heap* heap,
space_(space),
page_range_(page),
current_page_(page_range_.begin()) {
space_->MakeLinearAllocationAreaIterable();
heap->mark_compact_collector()->EnsureSweepingCompleted();
#ifdef DEBUG
AllocationSpace owner = page->owner_identity();
......@@ -56,7 +58,9 @@ PagedSpaceObjectIterator::PagedSpaceObjectIterator(OffThreadSpace* space)
cur_end_(kNullAddress),
space_(space),
page_range_(space->first_page(), nullptr),
current_page_(page_range_.begin()) {}
current_page_(page_range_.begin()) {
space_->MakeLinearAllocationAreaIterable();
}
// We have hit the end of the page and should advance to the next block of
// objects. This happens at the end of the page.
......@@ -394,6 +398,23 @@ void PagedSpace::UnmarkLinearAllocationArea() {
}
}
void PagedSpace::MakeLinearAllocationAreaIterable() {
Address current_top = top();
Address current_limit = limit();
if (current_top != kNullAddress && current_top != current_limit) {
base::Optional<CodePageMemoryModificationScope> optional_scope;
if (identity() == CODE_SPACE) {
MemoryChunk* chunk = MemoryChunk::FromAddress(current_top);
optional_scope.emplace(chunk);
}
heap_->CreateFillerObjectAt(current_top,
static_cast<int>(current_limit - current_top),
ClearRecordedSlots::kNo);
}
}
void PagedSpace::FreeLinearAllocationArea() {
// Mark the old linear allocation area with a free space map so it can be
// skipped when scanning the heap.
......
......@@ -189,6 +189,8 @@ class V8_EXPORT_PRIVATE PagedSpace
// Empty space linear allocation area, returning unused area to free list.
void FreeLinearAllocationArea();
void MakeLinearAllocationAreaIterable();
void MarkLinearAllocationAreaBlack();
void UnmarkLinearAllocationArea();
......
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