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

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

Issue 1840103004: Introduce ThreadHeapStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/PersistentNode.h" 5 #include "platform/heap/PersistentNode.h"
6 6
7 #include "platform/heap/Handle.h" 7 #include "platform/heap/Handle.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 slots->m_next = m_slots; 44 slots->m_next = m_slots;
45 m_slots = slots; 45 m_slots = slots;
46 } 46 }
47 47
48 // This function traces all PersistentNodes. If we encounter 48 // This function traces all PersistentNodes. If we encounter
49 // a PersistentNodeSlot that contains only freed PersistentNodes, 49 // a PersistentNodeSlot that contains only freed PersistentNodes,
50 // we delete the PersistentNodeSlot. This function rebuilds the free 50 // we delete the PersistentNodeSlot. This function rebuilds the free
51 // list of PersistentNodes. 51 // list of PersistentNodes.
52 void PersistentRegion::tracePersistentNodes(Visitor* visitor) 52 void PersistentRegion::tracePersistentNodes(Visitor* visitor)
53 { 53 {
54 size_t debugMarkedObjectSize = Heap::markedObjectSize(); 54 size_t debugMarkedObjectSize = ProcessHeap::totalMarkedObjectSize();
55 base::debug::Alias(&debugMarkedObjectSize); 55 base::debug::Alias(&debugMarkedObjectSize);
56 56
57 m_freeListHead = nullptr; 57 m_freeListHead = nullptr;
58 int persistentCount = 0; 58 int persistentCount = 0;
59 PersistentNodeSlots** prevNext = &m_slots; 59 PersistentNodeSlots** prevNext = &m_slots;
60 PersistentNodeSlots* slots = m_slots; 60 PersistentNodeSlots* slots = m_slots;
61 while (slots) { 61 while (slots) {
62 PersistentNode* freeListNext = nullptr; 62 PersistentNode* freeListNext = nullptr;
63 PersistentNode* freeListLast = nullptr; 63 PersistentNode* freeListLast = nullptr;
64 int freeCount = 0; 64 int freeCount = 0;
65 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { 65 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) {
66 PersistentNode* node = &slots->m_slot[i]; 66 PersistentNode* node = &slots->m_slot[i];
67 if (node->isUnused()) { 67 if (node->isUnused()) {
68 if (!freeListNext) 68 if (!freeListNext)
69 freeListLast = node; 69 freeListLast = node;
70 node->setFreeListNext(freeListNext); 70 node->setFreeListNext(freeListNext);
71 freeListNext = node; 71 freeListNext = node;
72 ++freeCount; 72 ++freeCount;
73 } else { 73 } else {
74 node->tracePersistentNode(visitor); 74 node->tracePersistentNode(visitor);
75 ++persistentCount; 75 ++persistentCount;
76 debugMarkedObjectSize = Heap::markedObjectSize(); 76 debugMarkedObjectSize = ProcessHeap::totalMarkedObjectSize();
77 } 77 }
78 } 78 }
79 if (freeCount == PersistentNodeSlots::slotCount) { 79 if (freeCount == PersistentNodeSlots::slotCount) {
80 PersistentNodeSlots* deadSlots = slots; 80 PersistentNodeSlots* deadSlots = slots;
81 *prevNext = slots->m_next; 81 *prevNext = slots->m_next;
82 slots = slots->m_next; 82 slots = slots->m_next;
83 delete deadSlots; 83 delete deadSlots;
84 } else { 84 } else {
85 if (freeListLast) { 85 if (freeListLast) {
86 ASSERT(freeListNext); 86 ASSERT(freeListNext);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (page->orphaned()) 131 if (page->orphaned())
132 continue; 132 continue;
133 if (page->arena()->getThreadState() == threadState) 133 if (page->arena()->getThreadState() == threadState)
134 persistent->clear(); 134 persistent->clear();
135 } 135 }
136 slots = slots->m_next; 136 slots = slots->m_next;
137 } 137 }
138 } 138 }
139 139
140 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTest.cpp ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698