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

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

Issue 2304123003: [heap] Refactor incremental marking step. (Closed)
Patch Set: another fix of the test 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
« no previous file with comments | « src/heap/incremental-marking-job.cc ('k') | src/heap/spaces.cc » ('j') | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } else if (state_.action == kWait) { 77 } else if (state_.action == kWait) {
78 if (!heap()->incremental_marking()->IsStopped() && 78 if (!heap()->incremental_marking()->IsStopped() &&
79 heap()->ShouldOptimizeForMemoryUsage()) { 79 heap()->ShouldOptimizeForMemoryUsage()) {
80 // Make progress with pending incremental marking if memory usage has 80 // Make progress with pending incremental marking if memory usage has
81 // higher priority than latency. This is important for background tabs 81 // higher priority than latency. This is important for background tabs
82 // that do not send idle notifications. 82 // that do not send idle notifications.
83 const int kIncrementalMarkingDelayMs = 500; 83 const int kIncrementalMarkingDelayMs = 500;
84 double deadline = heap()->MonotonicallyIncreasingTimeInMs() + 84 double deadline = heap()->MonotonicallyIncreasingTimeInMs() +
85 kIncrementalMarkingDelayMs; 85 kIncrementalMarkingDelayMs;
86 heap()->incremental_marking()->AdvanceIncrementalMarking( 86 heap()->incremental_marking()->AdvanceIncrementalMarking(
87 deadline, i::IncrementalMarking::StepActions( 87 deadline, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
88 i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, 88 IncrementalMarking::FORCE_COMPLETION);
89 i::IncrementalMarking::FORCE_MARKING,
90 i::IncrementalMarking::FORCE_COMPLETION));
91 heap()->FinalizeIncrementalMarkingIfComplete( 89 heap()->FinalizeIncrementalMarkingIfComplete(
92 "Memory reducer: finalize incremental marking"); 90 "Memory reducer: finalize incremental marking");
93 } 91 }
94 // Re-schedule the timer. 92 // Re-schedule the timer.
95 ScheduleTimer(event.time_ms, state_.next_gc_start_ms - event.time_ms); 93 ScheduleTimer(event.time_ms, state_.next_gc_start_ms - event.time_ms);
96 if (FLAG_trace_gc_verbose) { 94 if (FLAG_trace_gc_verbose) {
97 PrintIsolate(heap()->isolate(), "Memory reducer: waiting for %.f ms\n", 95 PrintIsolate(heap()->isolate(), "Memory reducer: waiting for %.f ms\n",
98 state_.next_gc_start_ms - event.time_ms); 96 state_.next_gc_start_ms - event.time_ms);
99 } 97 }
100 } 98 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 auto timer_task = new MemoryReducer::TimerTask(this); 201 auto timer_task = new MemoryReducer::TimerTask(this);
204 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 202 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
205 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 203 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
206 } 204 }
207 205
208 206
209 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } 207 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); }
210 208
211 } // namespace internal 209 } // namespace internal
212 } // namespace v8 210 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking-job.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698