Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/heap/SafePoint.h" | 6 #include "platform/heap/SafePoint.h" |
| 7 | 7 |
| 8 #include "wtf/Atomics.h" | 8 #include "wtf/Atomics.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads( ); | 38 ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads( ); |
| 39 | 39 |
| 40 MutexLocker locker(m_mutex); | 40 MutexLocker locker(m_mutex); |
| 41 atomicAdd(&m_unparkedThreadCount, threads.size()); | 41 atomicAdd(&m_unparkedThreadCount, threads.size()); |
| 42 releaseStore(&m_canResume, 0); | 42 releaseStore(&m_canResume, 0); |
| 43 | 43 |
| 44 for (ThreadState* state : threads) { | 44 for (ThreadState* state : threads) { |
| 45 if (state == current) | 45 if (state == current) |
| 46 continue; | 46 continue; |
| 47 | 47 |
| 48 if (state->isolated()) | |
| 49 continue; | |
|
haraken
2015/11/30 02:54:42
Instead of making this change, we should not add t
keishi
2016/01/06 05:35:33
Done.
| |
| 50 | |
| 48 for (auto& interruptor : state->interruptors()) | 51 for (auto& interruptor : state->interruptors()) |
| 49 interruptor->requestInterrupt(); | 52 interruptor->requestInterrupt(); |
| 50 } | 53 } |
| 51 | 54 |
| 52 while (acquireLoad(&m_unparkedThreadCount) > 0) { | 55 while (acquireLoad(&m_unparkedThreadCount) > 0) { |
| 53 double expirationTime = currentTime() + lockingTimeout(); | 56 double expirationTime = currentTime() + lockingTimeout(); |
| 54 if (!m_parked.timedWait(m_mutex, expirationTime)) { | 57 if (!m_parked.timedWait(m_mutex, expirationTime)) { |
| 55 // One of the other threads did not return to a safepoint within the maximum | 58 // One of the other threads did not return to a safepoint within the maximum |
| 56 // time we allow for threads to be parked. Abandon the GC and resume the | 59 // time we allow for threads to be parked. Abandon the GC and resume the |
| 57 // currently parked threads. | 60 // currently parked threads. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 // If no other thread is waiting for other threads to park then | 134 // If no other thread is waiting for other threads to park then |
| 132 // this counter can be negative: if N threads are at safe-points | 135 // this counter can be negative: if N threads are at safe-points |
| 133 // the counter will be -N. | 136 // the counter will be -N. |
| 134 if (!atomicDecrement(&m_unparkedThreadCount)) { | 137 if (!atomicDecrement(&m_unparkedThreadCount)) { |
| 135 MutexLocker locker(m_mutex); | 138 MutexLocker locker(m_mutex); |
| 136 m_parked.signal(); // Safe point reached. | 139 m_parked.signal(); // Safe point reached. |
| 137 } | 140 } |
| 138 } | 141 } |
| 139 | 142 |
| 140 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |