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

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

Issue 2321553002: [heap] Do more incremental marking work in tasks. (Closed)
Patch Set: Created 4 years, 3 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (!heap()->incremental_marking()->IsStopped() && 79 if (!heap()->incremental_marking()->IsStopped() &&
80 heap()->ShouldOptimizeForMemoryUsage()) { 80 heap()->ShouldOptimizeForMemoryUsage()) {
81 // Make progress with pending incremental marking if memory usage has 81 // Make progress with pending incremental marking if memory usage has
82 // higher priority than latency. This is important for background tabs 82 // higher priority than latency. This is important for background tabs
83 // that do not send idle notifications. 83 // that do not send idle notifications.
84 const int kIncrementalMarkingDelayMs = 500; 84 const int kIncrementalMarkingDelayMs = 500;
85 double deadline = heap()->MonotonicallyIncreasingTimeInMs() + 85 double deadline = heap()->MonotonicallyIncreasingTimeInMs() +
86 kIncrementalMarkingDelayMs; 86 kIncrementalMarkingDelayMs;
87 heap()->incremental_marking()->AdvanceIncrementalMarking( 87 heap()->incremental_marking()->AdvanceIncrementalMarking(
88 deadline, IncrementalMarking::NO_GC_VIA_STACK_GUARD, 88 deadline, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
89 IncrementalMarking::FORCE_COMPLETION); 89 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kTask);
90 heap()->FinalizeIncrementalMarkingIfComplete( 90 heap()->FinalizeIncrementalMarkingIfComplete(
91 GarbageCollectionReason::kFinalizeMarkingViaTask); 91 GarbageCollectionReason::kFinalizeMarkingViaTask);
92 } 92 }
93 // Re-schedule the timer. 93 // Re-schedule the timer.
94 ScheduleTimer(event.time_ms, state_.next_gc_start_ms - event.time_ms); 94 ScheduleTimer(event.time_ms, state_.next_gc_start_ms - event.time_ms);
95 if (FLAG_trace_gc_verbose) { 95 if (FLAG_trace_gc_verbose) {
96 PrintIsolate(heap()->isolate(), "Memory reducer: waiting for %.f ms\n", 96 PrintIsolate(heap()->isolate(), "Memory reducer: waiting for %.f ms\n",
97 state_.next_gc_start_ms - event.time_ms); 97 state_.next_gc_start_ms - event.time_ms);
98 } 98 }
99 } 99 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 auto timer_task = new MemoryReducer::TimerTask(this); 202 auto timer_task = new MemoryReducer::TimerTask(this);
203 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 203 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
204 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 204 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
205 } 205 }
206 206
207 207
208 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } 208 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); }
209 209
210 } // namespace internal 210 } // namespace internal
211 } // namespace v8 211 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698