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

Side by Side Diff: Source/platform/heap/Heap.cpp

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

Powered by Google App Engine
This is Rietveld 408576698