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

Unified Diff: src/heap/memory-reducer.cc

Issue 1705183003: Activate memory reducer for small heaps in background tabs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: typo Created 4 years, 10 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 | « src/heap/memory-reducer.h ('k') | test/unittests/heap/memory-reducer-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/memory-reducer.cc
diff --git a/src/heap/memory-reducer.cc b/src/heap/memory-reducer.cc
index ee1009134bc75ec9c9ed721ecc3ad0770a34a1d5..f53730785a80fcc3bcd73063f50f7471841fdecd 100644
--- a/src/heap/memory-reducer.cc
+++ b/src/heap/memory-reducer.cc
@@ -47,7 +47,7 @@ void MemoryReducer::TimerTask::RunInternal() {
event.should_start_incremental_gc = is_idle || optimize_for_memory;
event.can_start_incremental_gc =
heap->incremental_marking()->IsStopped() &&
- heap->incremental_marking()->CanBeActivated();
+ (heap->incremental_marking()->CanBeActivated() || optimize_for_memory);
memory_reducer_->NotifyTimer(event);
}
@@ -118,9 +118,8 @@ void MemoryReducer::NotifyMarkCompact(const Event& event) {
}
}
-
-void MemoryReducer::NotifyContextDisposed(const Event& event) {
- DCHECK_EQ(kContextDisposed, event.type);
+void MemoryReducer::NotifyPossibleGarbage(const Event& event) {
+ DCHECK_EQ(kPossibleGarbage, event.type);
Action old_action = state_.action;
state_ = Step(state_, event);
if (old_action != kWait && state_.action == kWait) {
@@ -147,14 +146,14 @@ MemoryReducer::State MemoryReducer::Step(const State& state,
if (event.type == kTimer) {
return state;
} else {
- DCHECK(event.type == kContextDisposed || event.type == kMarkCompact);
+ DCHECK(event.type == kPossibleGarbage || event.type == kMarkCompact);
return State(
kWait, 0, event.time_ms + kLongDelayMs,
event.type == kMarkCompact ? event.time_ms : state.last_gc_time_ms);
}
case kWait:
switch (event.type) {
- case kContextDisposed:
+ case kPossibleGarbage:
return state;
case kTimer:
if (state.started_gcs >= kMaxNumberOfGCs) {
« no previous file with comments | « src/heap/memory-reducer.h ('k') | test/unittests/heap/memory-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698