Index: Source/platform/heap/PersistentNode.cpp |
diff --git a/Source/platform/heap/PersistentNode.cpp b/Source/platform/heap/PersistentNode.cpp |
index 6271f7d6ea72c36c01868d2a242d3f18b4db3406..e5981176d5e1c8004cf903648a073a0f0fac75ae 100644 |
--- a/Source/platform/heap/PersistentNode.cpp |
+++ b/Source/platform/heap/PersistentNode.cpp |
@@ -7,6 +7,10 @@ |
#include "platform/heap/Handle.h" |
+#ifndef NDEBUG |
+#include <stdio.h> |
+#endif |
+ |
namespace blink { |
PersistentRegion::~PersistentRegion() |
@@ -32,6 +36,25 @@ int PersistentRegion::numberOfPersistents() |
return persistentCount; |
} |
+#ifndef NDEBUG |
+void PersistentRegion::dumpLivePersistents() |
+{ |
+ class Object; |
+ using GCObject = GarbageCollected<Object>; |
+ |
+ fprintf(stderr, "Live Persistent(heap object, trace method):\n"); |
+ for (PersistentNodeSlots* slots = m_slots; slots; slots = slots->m_next) { |
+ for (int i = 0; i < PersistentNodeSlots::slotCount; ++i) { |
+ if (!slots->m_slot[i].isUnused()) { |
+ Persistent<GCObject>* persistent = reinterpret_cast<Persistent<GCObject>*>(slots->m_slot[i].self()); |
+ ASSERT(persistent); |
+ fprintf(stderr, "%p => (%p, %p)\n", persistent, persistent->get(), slots->m_slot[i].traceCallback()); |
+ } |
+ } |
+ } |
+} |
+#endif |
+ |
void PersistentRegion::ensurePersistentNodeSlots(void* self, TraceCallback trace) |
{ |
ASSERT(!m_freeListHead); |