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

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

Issue 1375853005: Add a flag for memory reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « src/flag-definitions.h ('k') | 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/gc-tracer.h" 8 #include "src/heap/gc-tracer.h"
9 #include "src/heap/heap-inl.h" 9 #include "src/heap/heap-inl.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 bool MemoryReducer::WatchdogGC(const State& state, const Event& event) { 144 bool MemoryReducer::WatchdogGC(const State& state, const Event& event) {
145 return state.last_gc_time_ms != 0 && 145 return state.last_gc_time_ms != 0 &&
146 event.time_ms > state.last_gc_time_ms + kWatchdogDelayMs; 146 event.time_ms > state.last_gc_time_ms + kWatchdogDelayMs;
147 } 147 }
148 148
149 149
150 // For specification of this function see the comment for MemoryReducer class. 150 // For specification of this function see the comment for MemoryReducer class.
151 MemoryReducer::State MemoryReducer::Step(const State& state, 151 MemoryReducer::State MemoryReducer::Step(const State& state,
152 const Event& event) { 152 const Event& event) {
153 if (!FLAG_incremental_marking) { 153 if (!FLAG_incremental_marking || !FLAG_memory_reducer) {
154 return State(kDone, 0, 0, state.last_gc_time_ms); 154 return State(kDone, 0, 0, state.last_gc_time_ms);
155 } 155 }
156 switch (state.action) { 156 switch (state.action) {
157 case kDone: 157 case kDone:
158 if (event.type == kTimer || event.type == kBackgroundIdleNotification) { 158 if (event.type == kTimer || event.type == kBackgroundIdleNotification) {
159 return state; 159 return state;
160 } else { 160 } else {
161 DCHECK(event.type == kContextDisposed || event.type == kMarkCompact); 161 DCHECK(event.type == kContextDisposed || event.type == kMarkCompact);
162 return State( 162 return State(
163 kWait, 0, event.time_ms + kLongDelayMs, 163 kWait, 0, event.time_ms + kLongDelayMs,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 auto timer_task = new MemoryReducer::TimerTask(this); 220 auto timer_task = new MemoryReducer::TimerTask(this);
221 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 221 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
222 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 222 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
223 } 223 }
224 224
225 225
226 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } 226 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); }
227 227
228 } // namespace internal 228 } // namespace internal
229 } // namespace v8 229 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698