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 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2650 } | 2650 } |
2651 delete current; | 2651 delete current; |
2652 } | 2652 } |
2653 | 2653 |
2654 void Heap::resetHeapCounters() | 2654 void Heap::resetHeapCounters() |
2655 { | 2655 { |
2656 ASSERT(ThreadState::current()->isInGC()); | 2656 ASSERT(ThreadState::current()->isInGC()); |
2657 | 2657 |
2658 s_allocatedObjectSize = 0; | 2658 s_allocatedObjectSize = 0; |
2659 s_markedObjectSize = 0; | 2659 s_markedObjectSize = 0; |
2660 | |
2661 // Similarly, reset the amount of externally allocated memory. | |
2662 s_externallyAllocatedBytes = 0; | |
2663 s_externallyAllocatedBytesAlive = 0; | |
2664 | |
2665 s_requestedUrgentGC = false; | |
2666 } | |
2667 | |
2668 void Heap::requestUrgentGC() | |
2669 { | |
2670 // The urgent-gc flag will be considered the next time an out-of-line | |
2671 // allocation is made. Bump allocations from the current block will | |
2672 // go ahead until it can no longer service an allocation request. | |
2673 // | |
2674 // FIXME: if that delays urgently needed GCs for too long, consider | |
2675 // flushing out per-heap "allocation points" to trigger the GC | |
2676 // right away. | |
2677 releaseStore(&s_requestedUrgentGC, 1); | |
2678 } | 2660 } |
2679 | 2661 |
2680 Visitor* Heap::s_markingVisitor; | 2662 Visitor* Heap::s_markingVisitor; |
2681 CallbackStack* Heap::s_markingStack; | 2663 CallbackStack* Heap::s_markingStack; |
2682 CallbackStack* Heap::s_postMarkingCallbackStack; | 2664 CallbackStack* Heap::s_postMarkingCallbackStack; |
2683 CallbackStack* Heap::s_weakCallbackStack; | 2665 CallbackStack* Heap::s_weakCallbackStack; |
2684 CallbackStack* Heap::s_ephemeronStack; | 2666 CallbackStack* Heap::s_ephemeronStack; |
2685 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; | 2667 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; |
2686 bool Heap::s_shutdownCalled = false; | 2668 bool Heap::s_shutdownCalled = false; |
2687 bool Heap::s_lastGCWasConservative = false; | 2669 bool Heap::s_lastGCWasConservative = false; |
2688 FreePagePool* Heap::s_freePagePool; | 2670 FreePagePool* Heap::s_freePagePool; |
2689 OrphanedPagePool* Heap::s_orphanedPagePool; | 2671 OrphanedPagePool* Heap::s_orphanedPagePool; |
2690 Heap::RegionTree* Heap::s_regionTree = nullptr; | 2672 Heap::RegionTree* Heap::s_regionTree = nullptr; |
2691 size_t Heap::s_allocatedObjectSize = 0; | 2673 size_t Heap::s_allocatedObjectSize = 0; |
2692 size_t Heap::s_allocatedSpace = 0; | 2674 size_t Heap::s_allocatedSpace = 0; |
2693 size_t Heap::s_markedObjectSize = 0; | 2675 size_t Heap::s_markedObjectSize = 0; |
2694 // We don't want to use 0 KB for the initial value because it may end up | 2676 // We don't want to use 0 KB for the initial value because it may end up |
2695 // triggering the first GC of some thread too prematurely. | 2677 // triggering the first GC of some thread too prematurely. |
2696 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2678 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
2697 | 2679 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
2698 size_t Heap::s_externallyAllocatedBytes = 0; | |
2699 size_t Heap::s_externallyAllocatedBytesAlive = 0; | |
2700 unsigned Heap::s_requestedUrgentGC = false; | |
2701 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2680 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
2702 | 2681 |
2703 } // namespace blink | 2682 } // namespace blink |
OLD | NEW |