Index: Source/platform/heap/Heap.cpp |
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp |
index f055df916d27a153d4ccc00a1fa90cbafe0dbb5b..17c6ddab553b3e43b5e8fa6fabad5b0c708ee837 100644 |
--- a/Source/platform/heap/Heap.cpp |
+++ b/Source/platform/heap/Heap.cpp |
@@ -1600,12 +1600,20 @@ Address Heap::checkAndMarkPointer(Visitor* visitor, Address address) |
#if ENABLE(GC_TRACING) |
const GCInfo* Heap::findGCInfo(Address address) |
{ |
+ bool needLockForIteration = !ThreadState::isAnyThreadInGC(); |
+ if (needLockForIteration) |
+ ThreadState::threadAttachMutex().lock(); |
+ |
ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads(); |
for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end = threads.end(); it != end; ++it) { |
if (const GCInfo* gcInfo = (*it)->findGCInfo(address)) { |
+ if (needLockForIteration) |
+ ThreadState::threadAttachMutex().unlock(); |
Mads Ager (chromium)
2014/06/06 06:54:01
Do we have a scoped lock object that we could use
kouhei (in TOK)
2014/06/06 06:58:26
I tried to use MutexLocker, but it requires lock a
Mads Ager (chromium)
2014/06/06 07:03:30
Nah, don't bother for this change. This code is ne
|
return gcInfo; |
} |
} |
+ if (needLockForIteration) |
+ ThreadState::threadAttachMutex().unlock(); |
return 0; |
} |