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

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

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 unified diff | Download patch
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/memory-reducer.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 #ifndef V8_HEAP_memory_reducer_H 5 #ifndef V8_HEAP_memory_reducer_H
6 #define V8_HEAP_memory_reducer_H 6 #define V8_HEAP_memory_reducer_H
7 7
8 #include "include/v8-platform.h" 8 #include "include/v8-platform.h"
9 #include "src/base/macros.h" 9 #include "src/base/macros.h"
10 #include "src/cancelable-task.h" 10 #include "src/cancelable-task.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 : action(action), 89 : action(action),
90 started_gcs(started_gcs), 90 started_gcs(started_gcs),
91 next_gc_start_ms(next_gc_start_ms), 91 next_gc_start_ms(next_gc_start_ms),
92 last_gc_time_ms(last_gc_time_ms) {} 92 last_gc_time_ms(last_gc_time_ms) {}
93 Action action; 93 Action action;
94 int started_gcs; 94 int started_gcs;
95 double next_gc_start_ms; 95 double next_gc_start_ms;
96 double last_gc_time_ms; 96 double last_gc_time_ms;
97 }; 97 };
98 98
99 enum EventType { kTimer, kMarkCompact, kContextDisposed }; 99 enum EventType { kTimer, kMarkCompact, kPossibleGarbage };
100 100
101 struct Event { 101 struct Event {
102 EventType type; 102 EventType type;
103 double time_ms; 103 double time_ms;
104 bool next_gc_likely_to_collect_more; 104 bool next_gc_likely_to_collect_more;
105 bool should_start_incremental_gc; 105 bool should_start_incremental_gc;
106 bool can_start_incremental_gc; 106 bool can_start_incremental_gc;
107 }; 107 };
108 108
109 explicit MemoryReducer(Heap* heap) 109 explicit MemoryReducer(Heap* heap)
110 : heap_(heap), 110 : heap_(heap),
111 state_(kDone, 0, 0.0, 0.0), 111 state_(kDone, 0, 0.0, 0.0),
112 js_calls_counter_(0), 112 js_calls_counter_(0),
113 js_calls_sample_time_ms_(0.0) {} 113 js_calls_sample_time_ms_(0.0) {}
114 // Callbacks. 114 // Callbacks.
115 void NotifyMarkCompact(const Event& event); 115 void NotifyMarkCompact(const Event& event);
116 void NotifyContextDisposed(const Event& event); 116 void NotifyPossibleGarbage(const Event& event);
117 void NotifyBackgroundIdleNotification(const Event& event); 117 void NotifyBackgroundIdleNotification(const Event& event);
118 // The step function that computes the next state from the current state and 118 // The step function that computes the next state from the current state and
119 // the incoming event. 119 // the incoming event.
120 static State Step(const State& state, const Event& event); 120 static State Step(const State& state, const Event& event);
121 // Posts a timer task that will call NotifyTimer after the given delay. 121 // Posts a timer task that will call NotifyTimer after the given delay.
122 void ScheduleTimer(double time_ms, double delay_ms); 122 void ScheduleTimer(double time_ms, double delay_ms);
123 void TearDown(); 123 void TearDown();
124 static const int kLongDelayMs; 124 static const int kLongDelayMs;
125 static const int kShortDelayMs; 125 static const int kShortDelayMs;
126 static const int kWatchdogDelayMs; 126 static const int kWatchdogDelayMs;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 // Used in cctest. 159 // Used in cctest.
160 friend class HeapTester; 160 friend class HeapTester;
161 DISALLOW_COPY_AND_ASSIGN(MemoryReducer); 161 DISALLOW_COPY_AND_ASSIGN(MemoryReducer);
162 }; 162 };
163 163
164 } // namespace internal 164 } // namespace internal
165 } // namespace v8 165 } // namespace v8
166 166
167 #endif // V8_HEAP_memory_reducer_H 167 #endif // V8_HEAP_memory_reducer_H
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.cc ('k') | src/heap/memory-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698