| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/heap/PersistentNode.h" | 6 #include "platform/heap/PersistentNode.h" |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 for (PersistentNodeSlots* slots = m_slots; slots; slots = slots->m_next) { | 25 for (PersistentNodeSlots* slots = m_slots; slots; slots = slots->m_next) { |
| 26 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { | 26 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { |
| 27 if (!slots->m_slot[i].isUnused()) | 27 if (!slots->m_slot[i].isUnused()) |
| 28 ++persistentCount; | 28 ++persistentCount; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 ASSERT(persistentCount == m_persistentCount); | 31 ASSERT(persistentCount == m_persistentCount); |
| 32 return persistentCount; | 32 return persistentCount; |
| 33 } | 33 } |
| 34 | 34 |
| 35 #if ENABLE(ASSERT) | |
| 36 void PersistentRegion::dumpLivePersistents() | |
| 37 { | |
| 38 class Object; | |
| 39 using GCObject = GarbageCollected<Object>; | |
| 40 | |
| 41 fprintf(stderr, "Live Persistent(heap object, trace method):\n"); | |
| 42 for (PersistentNodeSlots* slots = m_slots; slots; slots = slots->m_next) { | |
| 43 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { | |
| 44 if (!slots->m_slot[i].isUnused()) { | |
| 45 Persistent<GCObject>* persistent = reinterpret_cast<Persistent<G
CObject>*>(slots->m_slot[i].self()); | |
| 46 ASSERT(persistent); | |
| 47 fprintf(stderr, "%p => (%p, %p)\n", persistent, persistent->get(
), slots->m_slot[i].traceCallback()); | |
| 48 } | |
| 49 } | |
| 50 } | |
| 51 } | |
| 52 #endif | |
| 53 | |
| 54 void PersistentRegion::ensurePersistentNodeSlots(void* self, TraceCallback trace
) | 35 void PersistentRegion::ensurePersistentNodeSlots(void* self, TraceCallback trace
) |
| 55 { | 36 { |
| 56 ASSERT(!m_freeListHead); | 37 ASSERT(!m_freeListHead); |
| 57 PersistentNodeSlots* slots = new PersistentNodeSlots; | 38 PersistentNodeSlots* slots = new PersistentNodeSlots; |
| 58 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { | 39 for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { |
| 59 PersistentNode* node = &slots->m_slot[i]; | 40 PersistentNode* node = &slots->m_slot[i]; |
| 60 node->setFreeListNext(m_freeListHead); | 41 node->setFreeListNext(m_freeListHead); |
| 61 m_freeListHead = node; | 42 m_freeListHead = node; |
| 62 ASSERT(node->isUnused()); | 43 ASSERT(node->isUnused()); |
| 63 } | 44 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (page->orphaned()) | 124 if (page->orphaned()) |
| 144 continue; | 125 continue; |
| 145 if (page->heap()->threadState() == threadState) | 126 if (page->heap()->threadState() == threadState) |
| 146 persistent->clear(); | 127 persistent->clear(); |
| 147 } | 128 } |
| 148 slots = slots->m_next; | 129 slots = slots->m_next; |
| 149 } | 130 } |
| 150 } | 131 } |
| 151 | 132 |
| 152 } // namespace blink | 133 } // namespace blink |
| OLD | NEW |