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

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

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored Created 4 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 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 80
81 #if ENABLE(ASSERT) 81 #if ENABLE(ASSERT)
82 // No locking needed as all threads are at safepoints at this point in time. 82 // No locking needed as all threads are at safepoints at this point in time.
83 for (ThreadState* state : ThreadState::attachedThreads()) 83 ASSERT(ThreadState::mainThreadState()->gcGroup()->isParked());
haraken 2016/01/28 15:52:50 isParked => isAtSafePoint Note that "safe point"
keishi 2016/02/29 06:02:33 Done.
84 ASSERT(state->isAtSafePoint());
85 #endif 84 #endif
86 85
87 for (int index = 0; index < BlinkGC::NumberOfHeaps; ++index) { 86 for (int index = 0; index < BlinkGC::NumberOfHeaps; ++index) {
88 PoolEntry* entry = m_pool[index]; 87 PoolEntry* entry = m_pool[index];
89 PoolEntry** prevNext = &m_pool[index]; 88 PoolEntry** prevNext = &m_pool[index];
90 while (entry) { 89 while (entry) {
91 BasePage* page = entry->data; 90 BasePage* page = entry->data;
92 // Check if we should reuse the memory or just free it. 91 // Check if we should reuse the memory or just free it.
93 // Large object memory is not reused but freed, normal blink heap 92 // Large object memory is not reused but freed, normal blink heap
94 // pages are reused. 93 // pages are reused.
95 // NOTE: We call the destructor before freeing or adding to the 94 // NOTE: We call the destructor before freeing or adding to the
96 // free page pool. 95 // free page pool.
97 PageMemory* memory = page->storage(); 96 PageMemory* memory = page->storage();
98 if (page->isLargeObjectPage()) { 97 if (page->isLargeObjectPage()) {
99 page->~BasePage(); 98 page->~BasePage();
100 delete memory; 99 delete memory;
101 } else { 100 } else {
102 page->~BasePage(); 101 page->~BasePage();
103 clearMemory(memory); 102 clearMemory(memory);
104 Heap::freePagePool()->addFreePage(index, memory); 103 ThreadState::current()->gcGroup()->freePagePool()->addFreePage(i ndex, memory);
105 } 104 }
106 105
107 PoolEntry* deadEntry = entry; 106 PoolEntry* deadEntry = entry;
108 entry = entry->next; 107 entry = entry->next;
109 *prevNext = entry; 108 *prevNext = entry;
110 delete deadEntry; 109 delete deadEntry;
111 } 110 }
112 } 111 }
113 } 112 }
114 113
(...skipping 29 matching lines...) Expand all
144 BasePage* page = entry->data; 143 BasePage* page = entry->data;
145 if (page->contains(reinterpret_cast<Address>(object))) 144 if (page->contains(reinterpret_cast<Address>(object)))
146 return true; 145 return true;
147 } 146 }
148 } 147 }
149 return false; 148 return false;
150 } 149 }
151 #endif 150 #endif
152 151
153 } // namespace blink 152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698