Commit f501373d authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Properly adjust live bytes for pages where we abort evacaution

BUG=chromium:524425
LOG=N

Review URL: https://codereview.chromium.org/1588823003

Cr-Commit-Position: refs/heads/master@{#33302}
parent 83683e92
......@@ -3484,6 +3484,7 @@ void MarkCompactCollector::RemoveObjectSlots(Address start_slot,
}
}
#ifdef VERIFY_HEAP
static void VerifyAllBlackObjects(MemoryChunk* page) {
LiveObjectIterator<kAllLiveObjects> it(page);
......@@ -3494,6 +3495,7 @@ static void VerifyAllBlackObjects(MemoryChunk* page) {
}
#endif // VERIFY_HEAP
bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page,
HeapObjectVisitor* visitor,
IterationMode mode) {
......@@ -3502,14 +3504,15 @@ bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page,
#endif // VERIFY_HEAP
LiveObjectIterator<kBlackObjects> it(page);
HeapObject* object = NULL;
while ((object = it.Next()) != NULL) {
HeapObject* object = nullptr;
while ((object = it.Next()) != nullptr) {
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
if (!visitor->Visit(object)) {
if (mode == kClearMarkbits) {
page->markbits()->ClearRange(
page->AddressToMarkbitIndex(page->area_start()),
page->AddressToMarkbitIndex(object->address()));
RecomputeLiveBytes(page);
}
return false;
}
......@@ -3521,6 +3524,17 @@ bool MarkCompactCollector::VisitLiveObjects(MemoryChunk* page,
}
void MarkCompactCollector::RecomputeLiveBytes(MemoryChunk* page) {
LiveObjectIterator<kBlackObjects> it(page);
int new_live_size = 0;
HeapObject* object = nullptr;
while ((object = it.Next()) != nullptr) {
new_live_size += object->Size();
}
page->SetLiveBytes(new_live_size);
}
void MarkCompactCollector::VisitLiveObjectsBody(Page* page,
ObjectVisitor* visitor) {
#ifdef VERIFY_HEAP
......
......@@ -730,6 +730,8 @@ class MarkCompactCollector {
void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor);
void RecomputeLiveBytes(MemoryChunk* page);
void SweepAbortedPages();
void ReleaseEvacuationCandidates();
......
......@@ -612,6 +612,12 @@ class MemoryChunk {
return live_byte_count_;
}
void SetLiveBytes(int live_bytes) {
DCHECK_GE(live_bytes, 0);
DCHECK_LE(static_cast<unsigned>(live_bytes), size_);
live_byte_count_ = live_bytes;
}
int write_barrier_counter() {
return static_cast<int>(write_barrier_counter_);
}
......
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