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

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

Issue 2863943002: [heap] Memory reducer calls GC with kGCCallbackFlagCollectAllExternalMemory flag. (Closed)
Patch Set: Created 3 years, 7 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/heap.cc ('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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 DCHECK_EQ(kWait, state_.action); 59 DCHECK_EQ(kWait, state_.action);
60 state_ = Step(state_, event); 60 state_ = Step(state_, event);
61 if (state_.action == kRun) { 61 if (state_.action == kRun) {
62 DCHECK(heap()->incremental_marking()->IsStopped()); 62 DCHECK(heap()->incremental_marking()->IsStopped());
63 DCHECK(FLAG_incremental_marking); 63 DCHECK(FLAG_incremental_marking);
64 if (FLAG_trace_gc_verbose) { 64 if (FLAG_trace_gc_verbose) {
65 heap()->isolate()->PrintWithTimestamp("Memory reducer: started GC #%d\n", 65 heap()->isolate()->PrintWithTimestamp("Memory reducer: started GC #%d\n",
66 state_.started_gcs); 66 state_.started_gcs);
67 } 67 }
68 heap()->StartIdleIncrementalMarking( 68 heap()->StartIdleIncrementalMarking(
69 GarbageCollectionReason::kMemoryReducer); 69 GarbageCollectionReason::kMemoryReducer,
70 kGCCallbackFlagCollectAllExternalMemory);
70 } else if (state_.action == kWait) { 71 } else if (state_.action == kWait) {
71 if (!heap()->incremental_marking()->IsStopped() && 72 if (!heap()->incremental_marking()->IsStopped() &&
72 heap()->ShouldOptimizeForMemoryUsage()) { 73 heap()->ShouldOptimizeForMemoryUsage()) {
73 // Make progress with pending incremental marking if memory usage has 74 // Make progress with pending incremental marking if memory usage has
74 // higher priority than latency. This is important for background tabs 75 // higher priority than latency. This is important for background tabs
75 // that do not send idle notifications. 76 // that do not send idle notifications.
76 const int kIncrementalMarkingDelayMs = 500; 77 const int kIncrementalMarkingDelayMs = 500;
77 double deadline = heap()->MonotonicallyIncreasingTimeInMs() + 78 double deadline = heap()->MonotonicallyIncreasingTimeInMs() +
78 kIncrementalMarkingDelayMs; 79 kIncrementalMarkingDelayMs;
79 heap()->incremental_marking()->AdvanceIncrementalMarking( 80 heap()->incremental_marking()->AdvanceIncrementalMarking(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap()->isolate()); 208 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(heap()->isolate());
208 auto timer_task = new MemoryReducer::TimerTask(this); 209 auto timer_task = new MemoryReducer::TimerTask(this);
209 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 210 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
210 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 211 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
211 } 212 }
212 213
213 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0, 0); } 214 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0, 0); }
214 215
215 } // namespace internal 216 } // namespace internal
216 } // namespace v8 217 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698