Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Unified Diff: src/heap/mark-compact.cc

Issue 1588823003: [heap] Properly adjust live bytes for pages where we abort evacaution (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments and remove DCHECK Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index 0e8014014dbd612bf68bcfe0236f668312b1d81b..65bfdd92d871a262e517452c8c14fe0989482d9b 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -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
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698