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

Side by Side Diff: third_party/WebKit/Source/platform/heap/PagePool.cpp

Issue 1919773002: Revert of Prepare for multiple ThreadHeaps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/heap/PagePool.h" 5 #include "platform/heap/PagePool.h"
6 6
7 #include "platform/heap/Heap.h" 7 #include "platform/heap/Heap.h"
8 #include "platform/heap/PageMemory.h" 8 #include "platform/heap/PageMemory.h"
9 #include "wtf/Assertions.h" 9 #include "wtf/Assertions.h"
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 { 70 {
71 page->markOrphaned(); 71 page->markOrphaned();
72 PoolEntry* entry = new PoolEntry(page, m_pool[index]); 72 PoolEntry* entry = new PoolEntry(page, m_pool[index]);
73 m_pool[index] = entry; 73 m_pool[index] = entry;
74 } 74 }
75 75
76 NO_SANITIZE_ADDRESS 76 NO_SANITIZE_ADDRESS
77 void OrphanedPagePool::decommitOrphanedPages() 77 void OrphanedPagePool::decommitOrphanedPages()
78 { 78 {
79 ASSERT(ThreadState::current()->isInGC()); 79 ASSERT(ThreadState::current()->isInGC());
80 ASSERT(ThreadState::current()->heap().isAtSafePoint()); 80
81 #if ENABLE(ASSERT)
82 // No locking needed as all threads are at safepoints at this point in time.
83 for (ThreadState* state : ThreadState::attachedThreads())
84 ASSERT(state->isAtSafePoint());
85 #endif
81 86
82 for (int index = 0; index < BlinkGC::NumberOfArenas; ++index) { 87 for (int index = 0; index < BlinkGC::NumberOfArenas; ++index) {
83 PoolEntry* entry = m_pool[index]; 88 PoolEntry* entry = m_pool[index];
84 PoolEntry** prevNext = &m_pool[index]; 89 PoolEntry** prevNext = &m_pool[index];
85 while (entry) { 90 while (entry) {
86 BasePage* page = entry->data; 91 BasePage* page = entry->data;
87 // Check if we should reuse the memory or just free it. 92 // Check if we should reuse the memory or just free it.
88 // Large object memory is not reused but freed, normal blink heap 93 // Large object memory is not reused but freed, normal blink heap
89 // pages are reused. 94 // pages are reused.
90 // NOTE: We call the destructor before freeing or adding to the 95 // NOTE: We call the destructor before freeing or adding to the
91 // free page pool. 96 // free page pool.
92 PageMemory* memory = page->storage(); 97 PageMemory* memory = page->storage();
93 if (page->isLargeObjectPage()) { 98 if (page->isLargeObjectPage()) {
94 page->~BasePage(); 99 page->~BasePage();
95 delete memory; 100 delete memory;
96 } else { 101 } else {
97 page->~BasePage(); 102 page->~BasePage();
98 clearMemory(memory); 103 clearMemory(memory);
99 ThreadHeap::mainThreadHeap()->getFreePagePool()->addFreePage(ind ex, memory); 104 ThreadHeap::getFreePagePool()->addFreePage(index, memory);
100 } 105 }
101 106
102 PoolEntry* deadEntry = entry; 107 PoolEntry* deadEntry = entry;
103 entry = entry->next; 108 entry = entry->next;
104 *prevNext = entry; 109 *prevNext = entry;
105 delete deadEntry; 110 delete deadEntry;
106 } 111 }
107 } 112 }
108 } 113 }
109 114
(...skipping 29 matching lines...) Expand all
139 BasePage* page = entry->data; 144 BasePage* page = entry->data;
140 if (page->contains(reinterpret_cast<Address>(object))) 145 if (page->contains(reinterpret_cast<Address>(object)))
141 return true; 146 return true;
142 } 147 }
143 } 148 }
144 return false; 149 return false;
145 } 150 }
146 #endif 151 #endif
147 152
148 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h ('k') | third_party/WebKit/Source/platform/heap/SafePoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698