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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 | 223 |
| 224 // Finish sweeping. | 224 // Finish sweeping. |
| 225 completeSweep(); | 225 completeSweep(); |
| 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 |
|
sof
2017/02/08 11:49:47
Could you make this comment up-to-date at the same
haraken
2017/02/08 12:00:10
Maybe can I remove prepareForThreadStateTerminatio
| |
| 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 prepareForThreadStateTermination(); | 236 prepareForThreadStateTermination(); |
| 237 | 237 |
| 238 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( | 238 ProcessHeap::crossThreadPersistentRegion().prepareForThreadStateTermination( |
| 239 this); | 239 this); |
| 240 | 240 |
| 241 // Do thread local GC's as long as the count of thread local Persistents | 241 // Do thread local GC's as long as the count of thread local Persistents |
| 242 // changes and is above zero. | 242 // changes and is above zero. |
| 243 int oldCount = -1; | 243 int oldCount = -1; |
| 244 int currentCount = getPersistentRegion()->numberOfPersistents(); | 244 int currentCount = getPersistentRegion()->numberOfPersistents(); |
| 245 ASSERT(currentCount >= 0); | 245 ASSERT(currentCount >= 0); |
| 246 while (currentCount != oldCount) { | 246 while (currentCount != oldCount) { |
| 247 collectGarbageForTerminatingThread(); | 247 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, |
|
sof
2017/02/08 11:49:47
We're unnecessarily locking CTP access by doing th
haraken
2017/02/08 12:00:10
Added BlinkGC::ThreadTerminationGC. This prevents
| |
| 248 BlinkGC::PreciseGC); | |
| 248 // Release the thread-local static persistents that were | 249 // Release the thread-local static persistents that were |
| 249 // instantiated while running the termination GC. | 250 // instantiated while running the termination GC. |
| 250 releaseStaticPersistentNodes(); | 251 releaseStaticPersistentNodes(); |
| 251 oldCount = currentCount; | 252 oldCount = currentCount; |
| 252 currentCount = getPersistentRegion()->numberOfPersistents(); | 253 currentCount = getPersistentRegion()->numberOfPersistents(); |
| 253 } | 254 } |
| 254 // We should not have any persistents left when getting to this point, | 255 // 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. | 256 // if we have it is probably a bug so adding a debug ASSERT to catch this. |
| 256 ASSERT(!currentCount); | 257 ASSERT(!currentCount); |
| 257 // All of pre-finalizers should be consumed. | 258 // 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, | 1782 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, |
| 1782 BlinkGC::ForcedGC); | 1783 BlinkGC::ForcedGC); |
| 1783 size_t liveObjects = heap().heapStats().markedObjectSize(); | 1784 size_t liveObjects = heap().heapStats().markedObjectSize(); |
| 1784 if (liveObjects == previousLiveObjects) | 1785 if (liveObjects == previousLiveObjects) |
| 1785 break; | 1786 break; |
| 1786 previousLiveObjects = liveObjects; | 1787 previousLiveObjects = liveObjects; |
| 1787 } | 1788 } |
| 1788 } | 1789 } |
| 1789 | 1790 |
| 1790 } // namespace blink | 1791 } // namespace blink |
| OLD | NEW |