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

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

Issue 1420283021: Temporarily revert to non-incremental GC in background tabs to see (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 DCHECK_EQ(kTimer, event.type); 66 DCHECK_EQ(kTimer, event.type);
67 DCHECK_EQ(kWait, state_.action); 67 DCHECK_EQ(kWait, state_.action);
68 state_ = Step(state_, event); 68 state_ = Step(state_, event);
69 if (state_.action == kRun) { 69 if (state_.action == kRun) {
70 DCHECK(heap()->incremental_marking()->IsStopped()); 70 DCHECK(heap()->incremental_marking()->IsStopped());
71 DCHECK(FLAG_incremental_marking); 71 DCHECK(FLAG_incremental_marking);
72 if (FLAG_trace_gc_verbose) { 72 if (FLAG_trace_gc_verbose) {
73 PrintIsolate(heap()->isolate(), "Memory reducer: started GC #%d\n", 73 PrintIsolate(heap()->isolate(), "Memory reducer: started GC #%d\n",
74 state_.started_gcs); 74 state_.started_gcs);
75 } 75 }
76 heap()->StartIdleIncrementalMarking(); 76 if (heap()->ShouldOptimizeForMemoryUsage()) {
77 // TODO(ulan): Remove this once crbug.com/552305 is fixed.
78 // Do full GC if memory usage has higher priority than latency.
79 heap()->CollectAllGarbage(Heap::kReduceMemoryFootprintMask,
80 "memory reducer");
81 } else {
82 heap()->StartIdleIncrementalMarking();
83 }
77 } else if (state_.action == kWait) { 84 } else if (state_.action == kWait) {
78 if (!heap()->incremental_marking()->IsStopped() && 85 if (!heap()->incremental_marking()->IsStopped() &&
79 heap()->ShouldOptimizeForMemoryUsage()) { 86 heap()->ShouldOptimizeForMemoryUsage()) {
80 // Make progress with pending incremental marking if memory usage has 87 // Make progress with pending incremental marking if memory usage has
81 // higher priority than latency. This is important for background tabs 88 // higher priority than latency. This is important for background tabs
82 // that do not send idle notifications. 89 // that do not send idle notifications.
83 const int kIncrementalMarkingDelayMs = 500; 90 const int kIncrementalMarkingDelayMs = 500;
84 double deadline = heap()->MonotonicallyIncreasingTimeInMs() + 91 double deadline = heap()->MonotonicallyIncreasingTimeInMs() +
85 kIncrementalMarkingDelayMs; 92 kIncrementalMarkingDelayMs;
86 heap()->incremental_marking()->AdvanceIncrementalMarking( 93 heap()->incremental_marking()->AdvanceIncrementalMarking(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 auto timer_task = new MemoryReducer::TimerTask(this); 211 auto timer_task = new MemoryReducer::TimerTask(this);
205 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 212 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
206 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 213 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
207 } 214 }
208 215
209 216
210 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } 217 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); }
211 218
212 } // namespace internal 219 } // namespace internal
213 } // namespace v8 220 } // namespace 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