Chromium Code Reviews| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 226 |
| 227 releaseStaticPersistentNodes(); | 227 releaseStaticPersistentNodes(); |
| 228 | 228 |
| 229 // From here on ignore all conservatively discovered | 229 // From here on ignore all conservatively discovered |
| 230 // pointers into the heap owned by this thread. | 230 // pointers into the heap owned by this thread. |
| 231 m_isTerminating = true; | 231 m_isTerminating = true; |
| 232 | 232 |
| 233 // Set the terminate flag on all heap pages of this thread. This is used to | 233 // Set the terminate flag on all heap pages of this thread. This is used to |
| 234 // ensure we don't trace pages on other threads that are not part of the | 234 // ensure we don't trace pages on other threads that are not part of the |
| 235 // thread local GC. | 235 // thread local GC. |
| 236 // TODO(haraken): Remove this. This is not needed once we remove a thread- | |
|
sof
2017/02/08 12:06:19
oh, i suppose that is now possible with orphaned p
| |
| 237 // local termination GC. | |
| 236 prepareForThreadStateTermination(); | 238 prepareForThreadStateTermination(); |
| 237 | 239 |
| 238 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( | 240 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( |
| 239 this); | 241 this); |
| 240 | 242 |
| 241 // Do thread local GC's as long as the count of thread local Persistents | 243 // Do thread local GC's as long as the count of thread local Persistents |
| 242 // changes and is above zero. | 244 // changes and is above zero. |
| 243 int oldCount = -1; | 245 int oldCount = -1; |
| 244 int currentCount = getPersistentRegion()->numberOfPersistents(); | 246 int currentCount = getPersistentRegion()->numberOfPersistents(); |
| 245 ASSERT(currentCount >= 0); | 247 ASSERT(currentCount >= 0); |
| 246 while (currentCount != oldCount) { | 248 while (currentCount != oldCount) { |
| 247 collectGarbageForTerminatingThread(); | 249 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, |
| 250 BlinkGC::ThreadTerminationGC); | |
| 248 // Release the thread-local static persistents that were | 251 // Release the thread-local static persistents that were |
| 249 // instantiated while running the termination GC. | 252 // instantiated while running the termination GC. |
| 250 releaseStaticPersistentNodes(); | 253 releaseStaticPersistentNodes(); |
| 251 oldCount = currentCount; | 254 oldCount = currentCount; |
| 252 currentCount = getPersistentRegion()->numberOfPersistents(); | 255 currentCount = getPersistentRegion()->numberOfPersistents(); |
| 253 } | 256 } |
| 254 // We should not have any persistents left when getting to this point, | 257 // We should not have any persistents left when getting to this point, |
| 255 // if we have it is probably a bug so adding a debug ASSERT to catch this. | 258 // if we have it is probably a bug so adding a debug ASSERT to catch this. |
| 256 ASSERT(!currentCount); | 259 ASSERT(!currentCount); |
| 257 // All of pre-finalizers should be consumed. | 260 // All of pre-finalizers should be consumed. |
| (...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1781 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, | 1784 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, |
| 1782 BlinkGC::ForcedGC); | 1785 BlinkGC::ForcedGC); |
| 1783 size_t liveObjects = heap().heapStats().markedObjectSize(); | 1786 size_t liveObjects = heap().heapStats().markedObjectSize(); |
| 1784 if (liveObjects == previousLiveObjects) | 1787 if (liveObjects == previousLiveObjects) |
| 1785 break; | 1788 break; |
| 1786 previousLiveObjects = liveObjects; | 1789 previousLiveObjects = liveObjects; |
| 1787 } | 1790 } |
| 1788 } | 1791 } |
| 1789 | 1792 |
| 1790 } // namespace blink | 1793 } // namespace blink |
| OLD | NEW |