Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: third_party/WebKit/Source/platform/heap/SafePoint.cpp

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/heap/SafePoint.cpp
diff --git a/third_party/WebKit/Source/platform/heap/SafePoint.cpp b/third_party/WebKit/Source/platform/heap/SafePoint.cpp
index a75bb509ce63d75ef0b89f2f48e8b1b2d88074a8..470cb11266cae0ac0a498d8dcf4d9828d4af3b44 100644
--- a/third_party/WebKit/Source/platform/heap/SafePoint.cpp
+++ b/third_party/WebKit/Source/platform/heap/SafePoint.cpp
@@ -17,9 +17,10 @@ static double lockingTimeout()
return 0.100;
}
-SafePointBarrier::SafePointBarrier()
+SafePointBarrier::SafePointBarrier(MultiThreadGCGroup* gcGroup)
: m_canResume(1)
, m_unparkedThreadCount(0)
+ , m_gcGroup(gcGroup)
{
}
@@ -31,17 +32,16 @@ bool SafePointBarrier::parkOthers()
{
ASSERT(ThreadState::current()->isAtSafePoint());
- ThreadState* current = ThreadState::current();
// Lock threadAttachMutex() to prevent threads from attaching.
- ThreadState::lockThreadAttachMutex();
- ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads();
+ m_gcGroup->lockThreadAttachMutex();
+ const HashSet<ThreadState*>& threads = m_gcGroup->threads();
MutexLocker locker(m_mutex);
atomicAdd(&m_unparkedThreadCount, threads.size());
releaseStore(&m_canResume, 0);
for (ThreadState* state : threads) {
- if (state == current)
+ if (state->isAtSafePoint()) // MEMO: original code: if (state == current)
haraken 2016/01/28 15:52:50 Why do you need to make this change? This change
keishi 2016/02/29 06:02:33 Done. Just thought it made more sense.
continue;
for (auto& interruptor : state->interruptors())
@@ -63,7 +63,7 @@ bool SafePointBarrier::parkOthers()
void SafePointBarrier::resumeOthers(bool barrierLocked)
{
- ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads();
+ const HashSet<ThreadState*>& threads = m_gcGroup->threads();
atomicSubtract(&m_unparkedThreadCount, threads.size());
releaseStore(&m_canResume, 1);
@@ -76,7 +76,7 @@ void SafePointBarrier::resumeOthers(bool barrierLocked)
m_resume.broadcast();
}
- ThreadState::unlockThreadAttachMutex();
+ m_gcGroup->unlockThreadAttachMutex();
ASSERT(ThreadState::current()->isAtSafePoint());
}

Powered by Google App Engine
This is Rietveld 408576698