Chromium Code Reviews| Index: Source/platform/heap/Heap.cpp |
| diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp |
| index f055df916d27a153d4ccc00a1fa90cbafe0dbb5b..b7c72bfaf0ec1c37d67f278b500a0809b3e3d194 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::current()->isAtSafePoint(); |
|
haraken
2014/06/05 09:11:23
I guess what matters is not whether we're at a saf
kouhei (in TOK)
2014/06/05 09:26:22
Done.
|
| + 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(); |
| return gcInfo; |
| } |
| } |
| + if (needLockForIteration) |
| + ThreadState::threadAttachMutex().unlock(); |
| return 0; |
| } |