Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.cpp

Issue 1957523007: Cleanly release thread-local static persistents during termination GCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 ASSERT(checkThread()); 220 ASSERT(checkThread());
221 221
222 // Finish sweeping. 222 // Finish sweeping.
223 completeSweep(); 223 completeSweep();
224 224
225 // From here on ignore all conservatively discovered 225 // From here on ignore all conservatively discovered
226 // pointers into the heap owned by this thread. 226 // pointers into the heap owned by this thread.
227 m_isTerminating = true; 227 m_isTerminating = true;
228 228
229 releaseStaticPersistentNodes();
230
231 // Set the terminate flag on all heap pages of this thread. This is used to 229 // Set the terminate flag on all heap pages of this thread. This is used to
232 // ensure we don't trace pages on other threads that are not part of the 230 // ensure we don't trace pages on other threads that are not part of the
233 // thread local GC. 231 // thread local GC.
234 prepareForThreadStateTermination(); 232 prepareForThreadStateTermination();
235 233
236 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( this); 234 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( this);
237 235
238 // Do thread local GC's as long as the count of thread local Persistents 236 // Do thread local GC's as long as the count of thread local Persistents
239 // changes and is above zero. 237 // changes and is above zero.
240 int oldCount = -1; 238 int oldCount = -1;
241 int currentCount = getPersistentRegion()->numberOfPersistents(); 239 int currentCount = getPersistentRegion()->numberOfPersistents();
242 ASSERT(currentCount >= 0); 240 ASSERT(currentCount >= 0);
243 while (currentCount != oldCount) { 241 while (currentCount != oldCount) {
242 // Release the thread-local static persistents, including any
243 // that are instantiated while running the termination GCs.
244 releaseStaticPersistentNodes();
244 ThreadHeap::collectGarbageForTerminatingThread(this); 245 ThreadHeap::collectGarbageForTerminatingThread(this);
245 oldCount = currentCount; 246 oldCount = currentCount;
246 currentCount = getPersistentRegion()->numberOfPersistents(); 247 currentCount = getPersistentRegion()->numberOfPersistents();
247 } 248 }
248 // We should not have any persistents left when getting to this point, 249 // We should not have any persistents left when getting to this point,
249 // if we have it is probably a bug so adding a debug ASSERT to catch this. 250 // if we have it is probably a bug so adding a debug ASSERT to catch this.
250 ASSERT(!currentCount); 251 ASSERT(!currentCount);
251 // All of pre-finalizers should be consumed. 252 // All of pre-finalizers should be consumed.
252 ASSERT(m_orderedPreFinalizers.isEmpty()); 253 ASSERT(m_orderedPreFinalizers.isEmpty());
253 RELEASE_ASSERT(gcState() == NoGCScheduled); 254 RELEASE_ASSERT(gcState() == NoGCScheduled);
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 threadDump->addScalar("dead_count", "objects", totalDeadCount); 1521 threadDump->addScalar("dead_count", "objects", totalDeadCount);
1521 threadDump->addScalar("live_size", "bytes", totalLiveSize); 1522 threadDump->addScalar("live_size", "bytes", totalLiveSize);
1522 threadDump->addScalar("dead_size", "bytes", totalDeadSize); 1523 threadDump->addScalar("dead_size", "bytes", totalDeadSize);
1523 1524
1524 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); 1525 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName);
1525 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); 1526 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName);
1526 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); 1527 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid());
1527 } 1528 }
1528 1529
1529 } // namespace blink 1530 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698