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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapPage.cpp

Issue 1666083002: Oilpan: Discard unused system pages when sweeping NormalPageHeaps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | third_party/WebKit/Source/wtf/PageAllocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/HeapPage.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
index 637100d5f8eb42d30327a9ce160010aaeeb1702a..ce37af2f280fec49c7798ba9e254ad7c0df0a29d 100644
--- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -1104,6 +1104,14 @@ void NormalPage::removeFromHeap()
heapForNormalPage()->freePage(this);
}
+static void discardPages(Address begin, Address end)
+{
+ uintptr_t beginAddress = WTF::roundUpToSystemPage(reinterpret_cast<uintptr_t>(begin));
+ uintptr_t endAddress = WTF::roundDownToSystemPage(reinterpret_cast<uintptr_t>(end));
+ if (beginAddress < endAddress)
sof 2016/02/04 10:20:04 I understand the concern; for other live objects o
Yuta Kitamura 2016/02/04 10:50:11 We could make the condition a little bit tighter,
+ WTF::discardSystemPages(reinterpret_cast<void*>(beginAddress), endAddress - beginAddress);
+}
+
void NormalPage::sweep()
{
size_t markedObjectSize = 0;
@@ -1146,15 +1154,23 @@ void NormalPage::sweep()
headerAddress += size;
continue;
}
- if (startOfGap != headerAddress)
+ if (startOfGap != headerAddress) {
heapForNormalPage()->addToFreeList(startOfGap, headerAddress - startOfGap);
+#if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER)
+ discardPages(startOfGap, headerAddress);
+#endif
+ }
header->unmark();
headerAddress += header->size();
markedObjectSize += header->size();
startOfGap = headerAddress;
}
- if (startOfGap != payloadEnd())
+ if (startOfGap != payloadEnd()) {
heapForNormalPage()->addToFreeList(startOfGap, payloadEnd() - startOfGap);
+#if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER)
+ discardPages(startOfGap, payloadEnd());
+#endif
+ }
if (markedObjectSize)
Heap::increaseMarkedObjectSize(markedObjectSize);
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/PageAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698