| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // Set the terminate flag on all heap pages of this thread. This is used
to | 283 // Set the terminate flag on all heap pages of this thread. This is used
to |
| 284 // ensure we don't trace pages on other threads that are not part of the | 284 // ensure we don't trace pages on other threads that are not part of the |
| 285 // thread local GC. | 285 // thread local GC. |
| 286 prepareForThreadStateTermination(); | 286 prepareForThreadStateTermination(); |
| 287 | 287 |
| 288 Heap::crossThreadPersistentRegion().prepareForThreadStateTermination(thi
s); | 288 Heap::crossThreadPersistentRegion().prepareForThreadStateTermination(thi
s); |
| 289 | 289 |
| 290 // Do thread local GC's as long as the count of thread local Persistents | 290 // Do thread local GC's as long as the count of thread local Persistents |
| 291 // changes and is above zero. | 291 // changes and is above zero. |
| 292 int oldCount = -1; | 292 int oldCount = -1; |
| 293 int currentCount = persistentRegion()->numberOfPersistents(); | 293 int currentCount = getPersistentRegion()->numberOfPersistents(); |
| 294 ASSERT(currentCount >= 0); | 294 ASSERT(currentCount >= 0); |
| 295 while (currentCount != oldCount) { | 295 while (currentCount != oldCount) { |
| 296 Heap::collectGarbageForTerminatingThread(this); | 296 Heap::collectGarbageForTerminatingThread(this); |
| 297 oldCount = currentCount; | 297 oldCount = currentCount; |
| 298 currentCount = persistentRegion()->numberOfPersistents(); | 298 currentCount = getPersistentRegion()->numberOfPersistents(); |
| 299 } | 299 } |
| 300 // We should not have any persistents left when getting to this point, | 300 // We should not have any persistents left when getting to this point, |
| 301 // if we have it is probably a bug so adding a debug ASSERT to catch thi
s. | 301 // if we have it is probably a bug so adding a debug ASSERT to catch thi
s. |
| 302 ASSERT(!currentCount); | 302 ASSERT(!currentCount); |
| 303 // All of pre-finalizers should be consumed. | 303 // All of pre-finalizers should be consumed. |
| 304 ASSERT(m_orderedPreFinalizers.isEmpty()); | 304 ASSERT(m_orderedPreFinalizers.isEmpty()); |
| 305 RELEASE_ASSERT(gcState() == NoGCScheduled); | 305 RELEASE_ASSERT(gcState() == NoGCScheduled); |
| 306 | 306 |
| 307 // Add pages to the orphaned page pool to ensure any global GCs from thi
s point | 307 // Add pages to the orphaned page pool to ensure any global GCs from thi
s point |
| 308 // on will not trace objects on this thread's arenas. | 308 // on will not trace objects on this thread's arenas. |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 if (m_disabledStaticPersistentsRegistration) | 1361 if (m_disabledStaticPersistentsRegistration) |
| 1362 return; | 1362 return; |
| 1363 | 1363 |
| 1364 ASSERT(!m_staticPersistents.contains(node)); | 1364 ASSERT(!m_staticPersistents.contains(node)); |
| 1365 m_staticPersistents.add(node); | 1365 m_staticPersistents.add(node); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 void ThreadState::releaseStaticPersistentNodes() | 1368 void ThreadState::releaseStaticPersistentNodes() |
| 1369 { | 1369 { |
| 1370 for (PersistentNode* node : m_staticPersistents) | 1370 for (PersistentNode* node : m_staticPersistents) |
| 1371 persistentRegion()->freePersistentNode(node); | 1371 getPersistentRegion()->freePersistentNode(node); |
| 1372 | 1372 |
| 1373 m_staticPersistents.clear(); | 1373 m_staticPersistents.clear(); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 void ThreadState::enterStaticReferenceRegistrationDisabledScope() | 1376 void ThreadState::enterStaticReferenceRegistrationDisabledScope() |
| 1377 { | 1377 { |
| 1378 m_disabledStaticPersistentsRegistration++; | 1378 m_disabledStaticPersistentsRegistration++; |
| 1379 } | 1379 } |
| 1380 | 1380 |
| 1381 void ThreadState::leaveStaticReferenceRegistrationDisabledScope() | 1381 void ThreadState::leaveStaticReferenceRegistrationDisabledScope() |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1547 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
| 1548 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1548 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
| 1549 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1549 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
| 1550 | 1550 |
| 1551 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1551 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1552 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1552 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1553 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1553 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 } // namespace blink | 1556 } // namespace blink |
| OLD | NEW |