summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/GCThreadSharedData.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
commit5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch)
tree8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/JavaScriptCore/heap/GCThreadSharedData.h
parent33b26980cb24288b5a9f2590ccf32a949281bb79 (diff)
downloadqtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz
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
Diffstat (limited to 'Source/JavaScriptCore/heap/GCThreadSharedData.h')
-rw-r--r--Source/JavaScriptCore/heap/GCThreadSharedData.h45
1 files changed, 38 insertions, 7 deletions
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 <wtf/HashSet.h>
+#include <wtf/TCSpinLock.h>
#include <wtf/Threading.h>
#include <wtf/Vector.h>
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<ThreadIdentifier> m_markingThreads;
- Vector<SlotVisitor*> m_markingThreadsMarkStack;
-
+ Vector<GCThread*> m_gcThreads;
+
Mutex m_markingLock;
ThreadCondition m_markingCondition;
MarkStackArray m_sharedMarkStack;
@@ -79,10 +93,27 @@ private:
Mutex m_opaqueRootsLock;
HashSet<void*> m_opaqueRoots;
+ SpinLock m_copyLock;
+ Vector<MarkedBlock*>& m_blocksToCopy;
+ size_t m_copyIndex;
+ static const size_t s_blockFragmentLength = 32;
+
+ Mutex m_phaseLock;
+ ThreadCondition m_phaseCondition;
+ GCPhase m_currentPhase;
+
ListableHandler<WeakReferenceHarvester>::List m_weakReferenceHarvesters;
ListableHandler<UnconditionalFinalizer>::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