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

Unified Diff: Source/wtf/PartitionAlloc.h

Issue 1197753003: PartitionAlloc: implement discarding for partitionPurgeMemoryGeneric(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@rawsize
Patch Set: Fix Windows compile error. Created 5 years, 6 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 | Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/PartitionAlloc.h
diff --git a/Source/wtf/PartitionAlloc.h b/Source/wtf/PartitionAlloc.h
index 5dbdb487add327bba0beee4d6271e2f42f0f5479..59db16ab084d28e0edec7974ae8c073ca0f02f54 100644
--- a/Source/wtf/PartitionAlloc.h
+++ b/Source/wtf/PartitionAlloc.h
@@ -376,6 +376,11 @@ WTF_EXPORT bool partitionAllocGenericShutdown(PartitionRootGeneric*);
enum PartitionPurgeFlags {
// Decommitting the ring list of empty pages is reasonably fast.
PartitionPurgeDecommitEmptyPages = 1 << 0,
+ // Discarding unused system pages is slower, because it involves walking all
+ // freelists in all active partition pages of all buckets >= system page
+ // size. It often frees a similar amount of memory to decommitting the empty
+ // pages, though.
+ PartitionPurgeDiscardUnusedSystemPages = 1 << 1,
};
WTF_EXPORT void partitionPurgeMemory(PartitionRoot*, int);
@@ -478,7 +483,7 @@ ALWAYS_INLINE PartitionPage* partitionPointerToPageNoAlignmentCheck(void* ptr)
return page;
}
-ALWAYS_INLINE void* partitionPageToPointer(PartitionPage* page)
+ALWAYS_INLINE void* partitionPageToPointer(const PartitionPage* page)
{
uintptr_t pointerAsUint = reinterpret_cast<uintptr_t>(page);
uintptr_t superPageOffset = (pointerAsUint & kSuperPageOffsetMask);
@@ -525,6 +530,7 @@ ALWAYS_INLINE size_t* partitionPageGetRawSizePtr(PartitionPage* page)
if (bucket->slotSize <= kMaxSystemPagesPerSlotSpan * kSystemPageSize)
return nullptr;
+ ASSERT((bucket->slotSize % kSystemPageSize) == 0);
ASSERT(partitionBucketIsDirectMapped(bucket) || partitionBucketSlots(bucket) == 1);
page++;
return reinterpret_cast<size_t*>(&page->freelistHead);
« no previous file with comments | « no previous file | Source/wtf/PartitionAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698