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

Side by Side Diff: src/heap/memory-reducer.cc

Issue 1263373002: Perform full GC in background idle notification. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Guard full gc Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/memory-reducer.h" 5 #include "src/heap/memory-reducer.h"
6 6
7 #include "src/flags.h" 7 #include "src/flags.h"
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 89
90 void MemoryReducer::NotifyBackgroundIdleNotification(const Event& event) { 90 void MemoryReducer::NotifyBackgroundIdleNotification(const Event& event) {
91 DCHECK_EQ(kBackgroundIdleNotification, event.type); 91 DCHECK_EQ(kBackgroundIdleNotification, event.type);
92 Action old_action = state_.action; 92 Action old_action = state_.action;
93 int old_started_gcs = state_.started_gcs; 93 int old_started_gcs = state_.started_gcs;
94 state_ = Step(state_, event); 94 state_ = Step(state_, event);
95 if (old_action == kWait && state_.action == kWait && 95 if (old_action == kWait && state_.action == kWait &&
96 old_started_gcs + 1 == state_.started_gcs) { 96 old_started_gcs + 1 == state_.started_gcs) {
97 DCHECK(heap()->incremental_marking()->IsStopped()); 97 DCHECK(heap()->incremental_marking()->IsStopped());
98 DCHECK(FLAG_incremental_marking); 98 // TODO(ulan): Replace it with incremental marking GC once
99 heap()->StartIdleIncrementalMarking(); 99 // chromium:490559 is fixed.
100 if (FLAG_trace_gc_verbose) { 100 if (event.time_ms > state_.last_gc_time_ms + kLongDelayMs) {
101 PrintIsolate(heap()->isolate(), 101 heap()->CollectAllGarbage(Heap::kReduceMemoryFootprintMask,
102 "Memory reducer: started GC #%d" 102 "memory reducer background GC");
103 " (background idle)\n", 103 } else {
104 state_.started_gcs); 104 DCHECK(FLAG_incremental_marking);
105 heap()->StartIdleIncrementalMarking();
106 if (FLAG_trace_gc_verbose) {
107 PrintIsolate(heap()->isolate(),
108 "Memory reducer: started GC #%d"
109 " (background idle)\n",
110 state_.started_gcs);
111 }
105 } 112 }
106 } 113 }
107 } 114 }
108 115
109 116
110 bool MemoryReducer::WatchdogGC(const State& state, const Event& event) { 117 bool MemoryReducer::WatchdogGC(const State& state, const Event& event) {
111 return state.last_gc_time_ms != 0 && 118 return state.last_gc_time_ms != 0 &&
112 event.time_ms > state.last_gc_time_ms + kWatchdogDelayMs; 119 event.time_ms > state.last_gc_time_ms + kWatchdogDelayMs;
113 } 120 }
114 121
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 auto timer_task = new MemoryReducer::TimerTask(this); 193 auto timer_task = new MemoryReducer::TimerTask(this);
187 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 194 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
188 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 195 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
189 } 196 }
190 197
191 198
192 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } 199 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); }
193 200
194 } // internal 201 } // internal
195 } // v8 202 } // v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698