Commit fc2503d1 authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Black areas are created for both linear and free list allocations.

BUG=

Review-Url: https://codereview.chromium.org/2562383002
Cr-Commit-Position: refs/heads/master@{#41646}
parent 64d9352a
......@@ -430,11 +430,10 @@ AllocationResult PagedSpace::AllocateRawUnaligned(
if (object == NULL) {
object = SlowAllocateRaw(size_in_bytes);
}
if (object != NULL) {
if (heap()->incremental_marking()->black_allocation()) {
Marking::MarkBlack(ObjectMarking::MarkBitFrom(object));
MemoryChunk::IncrementLiveBytes(object, size_in_bytes);
}
if (object != NULL && heap()->incremental_marking()->black_allocation()) {
Address start = object->address();
Address end = object->address() + size_in_bytes;
Page::FromAllocationAreaAddress(start)->CreateBlackArea(start, end);
}
}
......@@ -472,6 +471,11 @@ AllocationResult PagedSpace::AllocateRawAligned(int size_in_bytes,
object = free_list_.Allocate(allocation_size);
if (object == NULL) {
object = SlowAllocateRaw(allocation_size);
if (object != NULL && heap()->incremental_marking()->black_allocation()) {
Address start = object->address();
Address end = object->address() + size_in_bytes;
Page::FromAllocationAreaAddress(start)->CreateBlackArea(start, end);
}
}
if (object != NULL && filler_size != 0) {
object = heap()->AlignWithFiller(object, size_in_bytes, allocation_size,
......
......@@ -833,6 +833,16 @@ size_t Page::ShrinkToHighWaterMark() {
return unused;
}
void Page::CreateBlackArea(Address start, Address end) {
DCHECK(heap()->incremental_marking()->black_allocation());
DCHECK_EQ(Page::FromAddress(start), this);
DCHECK_NE(start, end);
DCHECK_EQ(Page::FromAddress(end - 1), this);
markbits()->SetRange(AddressToMarkbitIndex(start),
AddressToMarkbitIndex(end));
IncrementLiveBytes(static_cast<int>(end - start));
}
void MemoryAllocator::PartialFreeMemory(MemoryChunk* chunk,
Address start_free) {
// We do not allow partial shrink for code.
......@@ -1342,10 +1352,7 @@ void PagedSpace::SetAllocationInfo(Address top, Address limit) {
SetTopAndLimit(top, limit);
if (top != nullptr && top != limit &&
heap()->incremental_marking()->black_allocation()) {
Page* page = Page::FromAllocationAreaAddress(top);
page->markbits()->SetRange(page->AddressToMarkbitIndex(top),
page->AddressToMarkbitIndex(limit));
page->IncrementLiveBytes(static_cast<int>(limit - top));
Page::FromAllocationAreaAddress(top)->CreateBlackArea(top, limit);
}
}
......@@ -1354,10 +1361,8 @@ void PagedSpace::MarkAllocationInfoBlack() {
Address current_top = top();
Address current_limit = limit();
if (current_top != nullptr && current_top != current_limit) {
Page* page = Page::FromAllocationAreaAddress(current_top);
page->markbits()->SetRange(page->AddressToMarkbitIndex(current_top),
page->AddressToMarkbitIndex(current_limit));
page->IncrementLiveBytes(static_cast<int>(current_limit - current_top));
Page::FromAllocationAreaAddress(current_top)
->CreateBlackArea(current_top, current_limit);
}
}
......
......@@ -769,6 +769,8 @@ class Page : public MemoryChunk {
size_t ShrinkToHighWaterMark();
void CreateBlackArea(Address start, Address end);
#ifdef DEBUG
void Print();
#endif // DEBUG
......
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