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

Unified Diff: src/heap/spaces.cc

Issue 2806463002: Fix free space repairing after deserialization. (Closed)
Patch Set: Fix issues after review. Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index c58b827368dae4c6913c9af67348d5597d2894d9..5cf47605b75f8d60015f46fc24d56a5f29754ff8 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -2834,14 +2834,18 @@ size_t PagedSpace::SizeOfObjects() {
void PagedSpace::RepairFreeListsAfterDeserialization() {
free_list_.RepairLists(heap());
// Each page may have a small free space that is not tracked by a free list.
- // Update the maps for those free space objects.
+ // Those free spaces still contain null as their map pointer.
+ // Overwrite them with new fillers.
for (Page* page : *this) {
- size_t size = page->wasted_memory();
- if (size == 0) continue;
- DCHECK_GE(static_cast<size_t>(Page::kPageSize), size);
- Address address = page->OffsetToAddress(Page::kPageSize - size);
- heap()->CreateFillerObjectAt(address, static_cast<int>(size),
- ClearRecordedSlots::kNo);
+ int size = static_cast<int>(page->wasted_memory());
+ if (size == 0) {
+ // If there is no wasted memory then all free space is in the free list.
+ continue;
+ }
+ Address start = page->HighWaterMark();
+ Address end = page->area_end();
+ CHECK_EQ(size, static_cast<int>(end - start));
+ heap()->CreateFillerObjectAt(start, size, ClearRecordedSlots::kNo);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698