| Index: Source/platform/heap/ThreadState.cpp
|
| diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
|
| index 7dc044028e5de8affae544cb3b1ff6a89ce59461..407bd2a22dad3ff7e20ae69e2d5b51ca14f4084e 100644
|
| --- a/Source/platform/heap/ThreadState.cpp
|
| +++ b/Source/platform/heap/ThreadState.cpp
|
| @@ -265,7 +265,6 @@ private:
|
| ThreadCondition m_resume;
|
| };
|
|
|
| -
|
| BaseHeapPage::BaseHeapPage(PageMemory* storage, const GCInfo* gcInfo, ThreadState* state)
|
| : m_storage(storage)
|
| , m_gcInfo(gcInfo)
|
| @@ -292,6 +291,9 @@ template<> struct InitializeHeaps<0> {
|
|
|
| ThreadState::ThreadState()
|
| : m_thread(currentThread())
|
| + , m_liveWrapperPersistents(new WrapperPersistentRegion())
|
| + , m_pooledWrapperPersistents(0)
|
| + , m_numPooledWrapperPersistentRegions(0)
|
| , m_persistents(adoptPtr(new PersistentAnchor()))
|
| , m_startOfStack(reinterpret_cast<intptr_t*>(getStackStart()))
|
| , m_endOfStack(reinterpret_cast<intptr_t*>(getStackStart()))
|
| @@ -330,6 +332,14 @@ ThreadState::~ThreadState()
|
| for (int i = 0; i < NumberOfHeaps; i++)
|
| delete m_heaps[i];
|
| deleteAllValues(m_interruptors);
|
| + while (m_liveWrapperPersistents) {
|
| + WrapperPersistentRegion* region = WrapperPersistentRegion::removeHead(&m_liveWrapperPersistents);
|
| + delete region;
|
| + }
|
| + while (m_pooledWrapperPersistents) {
|
| + WrapperPersistentRegion* region = WrapperPersistentRegion::removeHead(&m_pooledWrapperPersistents);
|
| + delete region;
|
| + }
|
| **s_threadSpecific = 0;
|
| }
|
|
|
| @@ -561,6 +571,7 @@ void ThreadState::visitStack(Visitor* visitor)
|
| void ThreadState::visitPersistents(Visitor* visitor)
|
| {
|
| m_persistents->trace(visitor);
|
| + WrapperPersistentRegion::trace(m_liveWrapperPersistents, visitor);
|
| }
|
|
|
| bool ThreadState::checkAndMarkPointer(Visitor* visitor, Address address)
|
| @@ -680,6 +691,34 @@ bool ThreadState::popAndInvokeWeakPointerCallback(Visitor* visitor)
|
| return m_weakCallbackStack->popAndInvokeCallback<WeaknessProcessing>(&m_weakCallbackStack, visitor);
|
| }
|
|
|
| +WrapperPersistentRegion* ThreadState::addWrapperPersistentRegion()
|
| +{
|
| + WrapperPersistentRegion* region;
|
| + if (m_numPooledWrapperPersistentRegions) {
|
| + region = WrapperPersistentRegion::removeHead(&m_pooledWrapperPersistents);
|
| + m_numPooledWrapperPersistentRegions--;
|
| + } else {
|
| + region = new WrapperPersistentRegion();
|
| + }
|
| + ASSERT(region);
|
| + WrapperPersistentRegion::insertHead(&m_liveWrapperPersistents, region);
|
| + return region;
|
| +}
|
| +
|
| +void ThreadState::removeWrapperPersistentRegion(WrapperPersistentRegion* region)
|
| +{
|
| + if (!region->removeIfNotLast(&m_liveWrapperPersistents))
|
| + return;
|
| +
|
| + // Region was removed, ie. it was not the last region in the list.
|
| + if (m_numPooledWrapperPersistentRegions < 2) {
|
| + WrapperPersistentRegion::insertHead(&m_pooledWrapperPersistents, region);
|
| + m_numPooledWrapperPersistentRegions++;
|
| + } else {
|
| + delete region;
|
| + }
|
| +}
|
| +
|
| PersistentNode* ThreadState::globalRoots()
|
| {
|
| AtomicallyInitializedStatic(PersistentNode*, anchor = new PersistentAnchor);
|
|
|