summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/GCThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/heap/GCThread.cpp')
-rw-r--r--Source/JavaScriptCore/heap/GCThread.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/heap/GCThread.cpp b/Source/JavaScriptCore/heap/GCThread.cpp
index ea43456bd..ce3bbedc9 100644
--- a/Source/JavaScriptCore/heap/GCThread.cpp
+++ b/Source/JavaScriptCore/heap/GCThread.cpp
@@ -70,8 +70,16 @@ CopyVisitor* GCThread::copyVisitor()
GCPhase GCThread::waitForNextPhase()
{
MutexLocker locker(m_shared.m_phaseLock);
+ while (m_shared.m_gcThreadsShouldWait)
+ m_shared.m_phaseCondition.wait(m_shared.m_phaseLock);
+
+ m_shared.m_numberOfActiveGCThreads--;
+ if (!m_shared.m_numberOfActiveGCThreads)
+ m_shared.m_activityCondition.signal();
+
while (m_shared.m_currentPhase == NoPhase)
m_shared.m_phaseCondition.wait(m_shared.m_phaseLock);
+ m_shared.m_numberOfActiveGCThreads++;
return m_shared.m_currentPhase;
}
@@ -84,7 +92,7 @@ void GCThread::gcThreadMain()
// Wait for the main thread to finish creating and initializing us. The main thread grabs this lock before
// creating this thread. We aren't guaranteed to have a valid threadID until the main thread releases this lock.
{
- MutexLocker locker(m_shared.m_markingLock);
+ MutexLocker locker(m_shared.m_phaseLock);
}
{
ParallelModeEnabler enabler(*m_slotVisitor);