Chromium Code Reviews| 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); |