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

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

Issue 2684633004: Remove orphaned pages from Oilpan (Closed)
Patch Set: temp Created 3 years, 10 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
Index: third_party/WebKit/Source/platform/heap/PagePool.cpp
diff --git a/third_party/WebKit/Source/platform/heap/PagePool.cpp b/third_party/WebKit/Source/platform/heap/PagePool.cpp
index 20e10ff0f3aa86d534670c4a8749c52d9588a2f6..e9c7bff461caa8989fc4e7657be5807461674708 100644
--- a/third_party/WebKit/Source/platform/heap/PagePool.cpp
+++ b/third_party/WebKit/Source/platform/heap/PagePool.cpp
@@ -48,95 +48,4 @@ PageMemory* FreePagePool::takeFreePage(int index) {
return nullptr;
}
-OrphanedPagePool::~OrphanedPagePool() {
- for (int index = 0; index < BlinkGC::NumberOfArenas; ++index) {
- while (PoolEntry* entry = m_pool[index]) {
- m_pool[index] = entry->next;
- BasePage* page = entry->data;
- delete entry;
- PageMemory* memory = page->storage();
- ASSERT(memory);
- page->~BasePage();
- delete memory;
- }
- }
-}
-
-void OrphanedPagePool::addOrphanedPage(int index, BasePage* page) {
- page->markOrphaned();
- PoolEntry* entry = new PoolEntry(page, m_pool[index]);
- m_pool[index] = entry;
-}
-
-NO_SANITIZE_ADDRESS
-void OrphanedPagePool::decommitOrphanedPages() {
- ASSERT(ThreadState::current()->isInGC());
- ASSERT(ThreadState::current()->heap().isAtSafePoint());
-
- for (int index = 0; index < BlinkGC::NumberOfArenas; ++index) {
- PoolEntry* entry = m_pool[index];
- PoolEntry** prevNext = &m_pool[index];
- while (entry) {
- BasePage* page = entry->data;
- // Check if we should reuse the memory or just free it.
- // Large object memory is not reused but freed, normal blink heap
- // pages are reused.
- // NOTE: We call the destructor before freeing or adding to the
- // free page pool.
- PageMemory* memory = page->storage();
- if (page->isLargeObjectPage()) {
- page->~BasePage();
- delete memory;
- } else {
- page->~BasePage();
- clearMemory(memory);
- ThreadHeap::mainThreadHeap()->getFreePagePool()->addFreePage(index,
- memory);
- }
-
- PoolEntry* deadEntry = entry;
- entry = entry->next;
- *prevNext = entry;
- delete deadEntry;
- }
- }
-}
-
-// Make the compiler think that something is going on there.
-static inline void breakOptimization(void* arg) {
-#if !defined(_WIN32) || defined(__clang__)
- __asm__ __volatile__("" : : "r"(arg) : "memory");
-#endif
-}
-
-NO_SANITIZE_ADDRESS
-void OrphanedPagePool::asanDisabledMemset(Address address,
- char value,
- size_t size) {
- // Don't use memset when running with ASan since this needs to zap
- // poisoned memory as well and the NO_SANITIZE_ADDRESS annotation
- // only works for code in this method and not for calls to memset.
- for (Address current = address; current < address + size; ++current) {
- breakOptimization(current);
- *current = value;
- }
-}
-
-void OrphanedPagePool::clearMemory(PageMemory* memory) {
- asanDisabledMemset(memory->writableStart(), 0, blinkPagePayloadSize());
-}
-
-#if DCHECK_IS_ON()
-bool OrphanedPagePool::contains(void* object) {
- for (int index = 0; index < BlinkGC::NumberOfArenas; ++index) {
- for (PoolEntry* entry = m_pool[index]; entry; entry = entry->next) {
- BasePage* page = entry->data;
- if (page->contains(reinterpret_cast<Address>(object)))
- return true;
- }
- }
- return false;
-}
-#endif
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/heap/PagePool.h ('k') | third_party/WebKit/Source/platform/heap/PersistentNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698