| Index: Source/platform/heap/ThreadState.h
|
| diff --git a/Source/platform/heap/ThreadState.h b/Source/platform/heap/ThreadState.h
|
| index 5269820c6417a1cff55af4d7d8237da95eed2fb1..fa2d9fddf61f8cbedad8ba796d77fca8fb9dedc8 100644
|
| --- a/Source/platform/heap/ThreadState.h
|
| +++ b/Source/platform/heap/ThreadState.h
|
| @@ -49,6 +49,7 @@ class FinalizedHeapObjectHeader;
|
| struct GCInfo;
|
| class HeapContainsCache;
|
| class HeapObjectHeader;
|
| +class PageMemory;
|
| class PersistentNode;
|
| class Visitor;
|
| class SafePointBarrier;
|
| @@ -507,6 +508,9 @@ public:
|
| HeapStats& stats() { return m_stats; }
|
| HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; }
|
|
|
| + void setupHeapsForShutdown();
|
| + void visitLocalRoots(Visitor*);
|
| +
|
| private:
|
| explicit ThreadState();
|
| ~ThreadState();
|
| @@ -657,6 +661,63 @@ private:
|
| bool m_locked;
|
| };
|
|
|
| +// Common header for heap pages. Needs to be defined before class Visitor.
|
| +class BaseHeapPage {
|
| +public:
|
| + BaseHeapPage(PageMemory*, const GCInfo*, ThreadState*);
|
| + virtual ~BaseHeapPage() { }
|
| +
|
| + // Check if the given address points to an object in this
|
| + // heap page. If so, find the start of that object and mark it
|
| + // using the given Visitor. Otherwise do nothing. The pointer must
|
| + // be within the same aligned blinkPageSize as the this-pointer.
|
| + //
|
| + // This is used during conservative stack scanning to
|
| + // conservatively mark all objects that could be referenced from
|
| + // the stack.
|
| + virtual void checkAndMarkPointer(Visitor*, Address) = 0;
|
| + virtual bool contains(Address) = 0;
|
| +
|
| +#if ENABLE(GC_TRACING)
|
| + virtual const GCInfo* findGCInfo(Address) = 0;
|
| +#endif
|
| +
|
| + Address address() { return reinterpret_cast<Address>(this); }
|
| + PageMemory* storage() const { return m_storage; }
|
| + ThreadState* threadState() const { return m_threadState; }
|
| + const GCInfo* gcInfo() { return m_gcInfo; }
|
| + virtual bool isLargeObject() { return false; }
|
| + virtual void markOrphaned()
|
| + {
|
| + m_threadState = 0;
|
| + m_shuttingDown = false;
|
| + m_traced = false;
|
| + }
|
| + bool orphaned() { return !m_threadState; }
|
| + bool shuttingDown() { return m_shuttingDown; }
|
| + void setShutdown() { m_shuttingDown = true; }
|
| + bool traced() { return m_traced; }
|
| + void setTraced() { m_traced = true; }
|
| + bool reuseMemory() { return m_reuseMemory; }
|
| + void clearReuseMemory() { m_reuseMemory = false; }
|
| + void setReuseMemory() { m_reuseMemory = true; }
|
| +
|
| +private:
|
| + // Accessor to silence unused warnings for the m_padding field.
|
| + intptr_t padding() const { return m_padding; }
|
| +
|
| + PageMemory* m_storage;
|
| + const GCInfo* m_gcInfo;
|
| + ThreadState* m_threadState;
|
| + bool m_shuttingDown;
|
| + bool m_traced;
|
| + bool m_reuseMemory;
|
| + // Pointer sized integer to ensure proper alignment of the
|
| + // HeapPage header. This can be used as a bit field if we need
|
| + // to associate more information with pages.
|
| + intptr_t m_padding;
|
| +};
|
| +
|
| }
|
|
|
| #endif // ThreadState_h
|
|
|