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

Unified Diff: runtime/vm/heap.cc

Issue 3001423002: Initial idle GC logic. (Closed)
Patch Set: divide-by-zero Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap.cc
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index 0a8bf12debfb93d73f2afaf56a0a103611155ec3..54a540274d15636c69e514067799394da157f60e 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -360,6 +360,14 @@ void Heap::UpdateClassHeapStatsBeforeGC(Heap::Space space) {
}
#endif
+void Heap::NotifyIdle(int64_t deadline) {
+ if (new_space_.ShouldPerformIdleScavenge(deadline)) {
+ Thread* thread = Thread::Current();
+ TIMELINE_FUNCTION_GC_DURATION(thread, "IdleGC");
+ CollectNewSpaceGarbage(thread, kIdle);
+ }
+}
+
void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) {
ASSERT(reason == kFull);
if (BeginNewSpaceGC(thread)) {
@@ -378,7 +386,7 @@ void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) {
void Heap::CollectNewSpaceGarbage(Thread* thread,
GCReason reason) {
- ASSERT((reason == kNewSpace) || (reason == kFull));
+ ASSERT((reason == kNewSpace) || (reason == kFull) || (reason == kIdle));
if (BeginNewSpaceGC(thread)) {
RecordBeforeGC(kNew, reason);
{
@@ -624,6 +632,8 @@ const char* Heap::GCReasonToString(GCReason gc_reason) {
return "old space";
case kFull:
return "full";
+ case kIdle:
+ return "idle";
case kGCAtAlloc:
return "debugging";
case kGCTestCase:
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698