| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 { | 215 { |
| 216 if (isMainThread()) { | 216 if (isMainThread()) { |
| 217 cleanupPages(); | 217 cleanupPages(); |
| 218 return; | 218 return; |
| 219 } | 219 } |
| 220 ASSERT(checkThread()); | 220 ASSERT(checkThread()); |
| 221 | 221 |
| 222 // Finish sweeping. | 222 // Finish sweeping. |
| 223 completeSweep(); | 223 completeSweep(); |
| 224 | 224 |
| 225 releaseStaticPersistentNodes(); |
| 226 |
| 225 // From here on ignore all conservatively discovered | 227 // From here on ignore all conservatively discovered |
| 226 // pointers into the heap owned by this thread. | 228 // pointers into the heap owned by this thread. |
| 227 m_isTerminating = true; | 229 m_isTerminating = true; |
| 228 | 230 |
| 229 // Set the terminate flag on all heap pages of this thread. This is used to | 231 // Set the terminate flag on all heap pages of this thread. This is used to |
| 230 // ensure we don't trace pages on other threads that are not part of the | 232 // ensure we don't trace pages on other threads that are not part of the |
| 231 // thread local GC. | 233 // thread local GC. |
| 232 prepareForThreadStateTermination(); | 234 prepareForThreadStateTermination(); |
| 233 | 235 |
| 234 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination(
this); | 236 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination(
this); |
| 235 | 237 |
| 236 // Do thread local GC's as long as the count of thread local Persistents | 238 // Do thread local GC's as long as the count of thread local Persistents |
| 237 // changes and is above zero. | 239 // changes and is above zero. |
| 238 int oldCount = -1; | 240 int oldCount = -1; |
| 239 int currentCount = getPersistentRegion()->numberOfPersistents(); | 241 int currentCount = getPersistentRegion()->numberOfPersistents(); |
| 240 ASSERT(currentCount >= 0); | 242 ASSERT(currentCount >= 0); |
| 241 while (currentCount != oldCount) { | 243 while (currentCount != oldCount) { |
| 242 // Release the thread-local static persistents, including any | 244 ThreadHeap::collectGarbageForTerminatingThread(this); |
| 243 // that are instantiated while running the termination GCs. | 245 // Release the thread-local static persistents that were |
| 246 // instantiated while running the termination GC. |
| 244 releaseStaticPersistentNodes(); | 247 releaseStaticPersistentNodes(); |
| 245 ThreadHeap::collectGarbageForTerminatingThread(this); | |
| 246 oldCount = currentCount; | 248 oldCount = currentCount; |
| 247 currentCount = getPersistentRegion()->numberOfPersistents(); | 249 currentCount = getPersistentRegion()->numberOfPersistents(); |
| 248 } | 250 } |
| 249 // We should not have any persistents left when getting to this point, | 251 // We should not have any persistents left when getting to this point, |
| 250 // if we have it is probably a bug so adding a debug ASSERT to catch this. | 252 // if we have it is probably a bug so adding a debug ASSERT to catch this. |
| 251 ASSERT(!currentCount); | 253 ASSERT(!currentCount); |
| 252 // All of pre-finalizers should be consumed. | 254 // All of pre-finalizers should be consumed. |
| 253 ASSERT(m_orderedPreFinalizers.isEmpty()); | 255 ASSERT(m_orderedPreFinalizers.isEmpty()); |
| 254 RELEASE_ASSERT(gcState() == NoGCScheduled); | 256 RELEASE_ASSERT(gcState() == NoGCScheduled); |
| 255 | 257 |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1523 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
| 1522 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1524 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
| 1523 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1525 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
| 1524 | 1526 |
| 1525 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1527 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c
reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1526 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1528 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()-
>createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1527 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); | 1529 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners
hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1528 } | 1530 } |
| 1529 | 1531 |
| 1530 } // namespace blink | 1532 } // namespace blink |
| OLD | NEW |