From 5466563f4b5b6b86523e3f89bb7f77e5b5270c78 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 15 Oct 2012 16:08:57 +0200 Subject: Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300) WebKit update which introduces the QtWebKitWidgets module that contains the WK1 widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're working on completing the entire split as part of https://bugs.webkit.org/show_bug.cgi?id=99314 --- Source/JavaScriptCore/heap/GCThreadSharedData.h | 45 +++++++++++++++++++++---- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'Source/JavaScriptCore/heap/GCThreadSharedData.h') diff --git a/Source/JavaScriptCore/heap/GCThreadSharedData.h b/Source/JavaScriptCore/heap/GCThreadSharedData.h index 3f09a2820..bd48d9263 100644 --- a/Source/JavaScriptCore/heap/GCThreadSharedData.h +++ b/Source/JavaScriptCore/heap/GCThreadSharedData.h @@ -28,16 +28,27 @@ #include "ListableHandler.h" #include "MarkStack.h" +#include "MarkedBlock.h" #include "UnconditionalFinalizer.h" #include "WeakReferenceHarvester.h" #include +#include #include #include namespace JSC { +class GCThread; class JSGlobalData; class CopiedSpace; +class CopyVisitor; + +enum GCPhase { + NoPhase, + Mark, + Copy, + Exit +}; class GCThreadSharedData { public: @@ -46,6 +57,11 @@ public: void reset(); + void didStartMarking(); + void didFinishMarking(); + void didStartCopying(); + void didFinishCopying(); + #if ENABLE(PARALLEL_GC) void resetChildren(); size_t childVisitCount(); @@ -53,12 +69,11 @@ public: #endif private: + friend class GCThread; friend class SlotVisitor; + friend class CopyVisitor; -#if ENABLE(PARALLEL_GC) - void markingThreadMain(SlotVisitor*); - static void markingThreadStartFunc(void* heap); -#endif + void getNextBlocksToCopy(size_t&, size_t&); JSGlobalData* m_globalData; CopiedSpace* m_copiedSpace; @@ -67,9 +82,8 @@ private: bool m_shouldHashConst; - Vector m_markingThreads; - Vector m_markingThreadsMarkStack; - + Vector m_gcThreads; + Mutex m_markingLock; ThreadCondition m_markingCondition; MarkStackArray m_sharedMarkStack; @@ -79,10 +93,27 @@ private: Mutex m_opaqueRootsLock; HashSet m_opaqueRoots; + SpinLock m_copyLock; + Vector& m_blocksToCopy; + size_t m_copyIndex; + static const size_t s_blockFragmentLength = 32; + + Mutex m_phaseLock; + ThreadCondition m_phaseCondition; + GCPhase m_currentPhase; + ListableHandler::List m_weakReferenceHarvesters; ListableHandler::List m_unconditionalFinalizers; }; +inline void GCThreadSharedData::getNextBlocksToCopy(size_t& start, size_t& end) +{ + SpinLockHolder locker(&m_copyLock); + start = m_copyIndex; + end = std::min(m_blocksToCopy.size(), m_copyIndex + s_blockFragmentLength); + m_copyIndex = end; +} + } // namespace JSC #endif -- cgit v1.2.1