| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // thread local GC asserts. We enter a safepoint while waiting for the | 249 // thread local GC asserts. We enter a safepoint while waiting for the |
| 250 // lock to avoid a dead-lock where another thread has already requested | 250 // lock to avoid a dead-lock where another thread has already requested |
| 251 // GC. | 251 // GC. |
| 252 SafePointAwareMutexLocker locker(m_threadAttachMutex, | 252 SafePointAwareMutexLocker locker(m_threadAttachMutex, |
| 253 BlinkGC::NoHeapPointersOnStack); | 253 BlinkGC::NoHeapPointersOnStack); |
| 254 thread->runTerminationGC(); | 254 thread->runTerminationGC(); |
| 255 ASSERT(m_threads.contains(thread)); | 255 ASSERT(m_threads.contains(thread)); |
| 256 m_threads.remove(thread); | 256 m_threads.remove(thread); |
| 257 isLastThread = m_threads.isEmpty(); | 257 isLastThread = m_threads.isEmpty(); |
| 258 } | 258 } |
| 259 // The last thread begin detached should be the owning thread, which would | |
| 260 // be the main thread for the mainThreadHeap and a per thread heap enabled | |
| 261 // thread otherwise. | |
| 262 if (isLastThread) | |
| 263 DCHECK(thread->threadHeapMode() == BlinkGC::PerThreadHeapMode || | |
| 264 thread->isMainThread()); | |
| 265 if (thread->isMainThread()) | 259 if (thread->isMainThread()) |
| 266 DCHECK_EQ(heapStats().allocatedSpace(), 0u); | 260 DCHECK_EQ(heapStats().allocatedSpace(), 0u); |
| 267 if (isLastThread) | 261 if (isLastThread) |
| 268 delete this; | 262 delete this; |
| 269 } | 263 } |
| 270 | 264 |
| 271 bool ThreadHeap::park() { | 265 bool ThreadHeap::park() { |
| 272 return m_safePointBarrier->parkOthers(); | 266 return m_safePointBarrier->parkOthers(); |
| 273 } | 267 } |
| 274 | 268 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 655 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
| 662 | 656 |
| 663 m_stats.reset(); | 657 m_stats.reset(); |
| 664 for (ThreadState* state : m_threads) | 658 for (ThreadState* state : m_threads) |
| 665 state->resetHeapCounters(); | 659 state->resetHeapCounters(); |
| 666 } | 660 } |
| 667 | 661 |
| 668 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 662 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
| 669 | 663 |
| 670 } // namespace blink | 664 } // namespace blink |
| OLD | NEW |