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

Unified Diff: src/heap/spaces-inl.h

Issue 1901093002: Reland of "🏄 [heap] Add page evacuation mode for new->old" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ExternalStringTable handling Created 4 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 | « src/heap/spaces.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces-inl.h
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h
index db01d0eed99e81690f0e15516b56096fd64de20f..3213d17c136cc024f8d12851575bd3b7d8e3c195 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -287,6 +287,7 @@ NewSpacePage* NewSpacePage::Initialize(Heap* heap, MemoryChunk* chunk,
// --------------------------------------------------------------------------
// PagedSpace
+template <Page::InitializationMode mode>
Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable,
PagedSpace* owner) {
Page* page = reinterpret_cast<Page*>(chunk);
@@ -299,11 +300,25 @@ Page* Page::Initialize(Heap* heap, MemoryChunk* chunk, Executability executable,
// Make sure that categories are initialized before freeing the area.
page->InitializeFreeListCategories();
- owner->Free(page->area_start(), page->area_size());
+ // In the case we do not free the memory, we effectively account for the whole
+ // page as allocated memory that cannot be used for further allocations.
+ if (mode == kFreeMemory) {
+ owner->Free(page->area_start(), page->area_size());
+ }
return page;
}
+Page* Page::Convert(NewSpacePage* old_page, PagedSpace* new_owner) {
+ old_page->set_owner(new_owner);
+ old_page->SetFlags(0, ~0);
+ new_owner->AccountCommitted(old_page->size());
+ Page* new_page = Page::Initialize<kDoNotFreeMemory>(
+ old_page->heap(), old_page, NOT_EXECUTABLE, new_owner);
+ new_page->InsertAfter(new_owner->anchor()->prev_page());
+ return new_page;
+}
+
void Page::InitializeFreeListCategories() {
for (int i = kFirstCategory; i < kNumberOfCategories; i++) {
categories_[i].Initialize(static_cast<FreeListCategoryType>(i));
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698