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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 // Call weak callbacks on objects that may now be pointing to dead objects. | 567 // Call weak callbacks on objects that may now be pointing to dead objects. |
568 while (popAndInvokeGlobalWeakCallback(visitor)) { } | 568 while (popAndInvokeGlobalWeakCallback(visitor)) { } |
569 | 569 |
570 // It is not permitted to trace pointers of live objects in the weak | 570 // It is not permitted to trace pointers of live objects in the weak |
571 // callback phase, so the marking stack should still be empty here. | 571 // callback phase, so the marking stack should still be empty here. |
572 ASSERT(s_markingStack->isEmpty()); | 572 ASSERT(s_markingStack->isEmpty()); |
573 } | 573 } |
574 | 574 |
575 void Heap::collectAllGarbage() | 575 void Heap::collectAllGarbage() |
576 { | 576 { |
577 // FIXME: Oilpan: we should perform a single GC and everything | 577 // We need to run multiple GCs to collect a chain of persistent handles. |
578 // should die. Unfortunately it is not the case for all objects | |
579 // because the hierarchy was not completely moved to the heap and | |
580 // some heap allocated objects own objects that contain persistents | |
581 // pointing to other heap allocated objects. | |
582 size_t previousLiveObjects = 0; | 578 size_t previousLiveObjects = 0; |
583 for (int i = 0; i < 5; ++i) { | 579 for (int i = 0; i < 5; ++i) { |
584 collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSw
eep, ForcedGC); | 580 collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSw
eep, ForcedGC); |
585 size_t liveObjects = Heap::markedObjectSize(); | 581 size_t liveObjects = Heap::markedObjectSize(); |
586 if (liveObjects == previousLiveObjects) | 582 if (liveObjects == previousLiveObjects) |
587 break; | 583 break; |
588 previousLiveObjects = liveObjects; | 584 previousLiveObjects = liveObjects; |
589 } | 585 } |
590 } | 586 } |
591 | 587 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 size_t Heap::s_objectSizeAtLastGC = 0; | 775 size_t Heap::s_objectSizeAtLastGC = 0; |
780 size_t Heap::s_markedObjectSize = 0; | 776 size_t Heap::s_markedObjectSize = 0; |
781 size_t Heap::s_markedObjectSizeAtLastCompleteSweep = 0; | 777 size_t Heap::s_markedObjectSizeAtLastCompleteSweep = 0; |
782 size_t Heap::s_persistentCount = 0; | 778 size_t Heap::s_persistentCount = 0; |
783 size_t Heap::s_persistentCountAtLastGC = 0; | 779 size_t Heap::s_persistentCountAtLastGC = 0; |
784 size_t Heap::s_collectedPersistentCount = 0; | 780 size_t Heap::s_collectedPersistentCount = 0; |
785 size_t Heap::s_partitionAllocSizeAtLastGC = 0; | 781 size_t Heap::s_partitionAllocSizeAtLastGC = 0; |
786 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 782 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
787 | 783 |
788 } // namespace blink | 784 } // namespace blink |
OLD | NEW |