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

Side by Side Diff: runtime/vm/scavenger.h

Issue 3001423002: Initial idle GC logic. (Closed)
Patch Set: divide-by-zero Created 3 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 | « runtime/vm/heap.cc ('k') | runtime/vm/scavenger.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_SCAVENGER_H_ 5 #ifndef RUNTIME_VM_SCAVENGER_H_
6 #define RUNTIME_VM_SCAVENGER_H_ 6 #define RUNTIME_VM_SCAVENGER_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 // Fraction of promotion candidates that survived and was thereby promoted. 91 // Fraction of promotion candidates that survived and was thereby promoted.
92 // Returns zero if there were no promotion candidates. 92 // Returns zero if there were no promotion candidates.
93 double PromoCandidatesSuccessFraction() const { 93 double PromoCandidatesSuccessFraction() const {
94 return promo_candidates_in_words_ > 0 94 return promo_candidates_in_words_ > 0
95 ? promoted_in_words_ / 95 ? promoted_in_words_ /
96 static_cast<double>(promo_candidates_in_words_) 96 static_cast<double>(promo_candidates_in_words_)
97 : 0.0; 97 : 0.0;
98 } 98 }
99 99
100 intptr_t UsedBeforeInWords() const { return before_.used_in_words; }
101
100 int64_t DurationMicros() const { return end_micros_ - start_micros_; } 102 int64_t DurationMicros() const { return end_micros_ - start_micros_; }
101 103
102 private: 104 private:
103 int64_t start_micros_; 105 int64_t start_micros_;
104 int64_t end_micros_; 106 int64_t end_micros_;
105 SpaceUsage before_; 107 SpaceUsage before_;
106 SpaceUsage after_; 108 SpaceUsage after_;
107 intptr_t promo_candidates_in_words_; 109 intptr_t promo_candidates_in_words_;
108 intptr_t promoted_in_words_; 110 intptr_t promoted_in_words_;
109 }; 111 };
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return usage; 196 return usage;
195 } 197 }
196 198
197 void VisitObjects(ObjectVisitor* visitor) const; 199 void VisitObjects(ObjectVisitor* visitor) const;
198 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 200 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
199 201
200 void AddRegionsToObjectSet(ObjectSet* set) const; 202 void AddRegionsToObjectSet(ObjectSet* set) const;
201 203
202 void WriteProtect(bool read_only); 204 void WriteProtect(bool read_only);
203 205
206 bool ShouldPerformIdleScavenge(int64_t deadline);
207
204 void AddGCTime(int64_t micros) { gc_time_micros_ += micros; } 208 void AddGCTime(int64_t micros) { gc_time_micros_ += micros; }
205 209
206 int64_t gc_time_micros() const { return gc_time_micros_; } 210 int64_t gc_time_micros() const { return gc_time_micros_; }
207 211
208 void IncrementCollections() { collections_++; } 212 void IncrementCollections() { collections_++; }
209 213
210 intptr_t collections() const { return collections_; } 214 intptr_t collections() const { return collections_; }
211 215
212 #ifndef PRODUCT 216 #ifndef PRODUCT
213 void PrintToJSONObject(JSONObject* object) const; 217 void PrintToJSONObject(JSONObject* object) const;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 uword object_alignment_; 304 uword object_alignment_;
301 305
302 // Keep track whether a scavenge is currently running. 306 // Keep track whether a scavenge is currently running.
303 bool scavenging_; 307 bool scavenging_;
304 308
305 // Keep track of pending weak properties discovered while scagenging. 309 // Keep track of pending weak properties discovered while scagenging.
306 RawWeakProperty* delayed_weak_properties_; 310 RawWeakProperty* delayed_weak_properties_;
307 311
308 int64_t gc_time_micros_; 312 int64_t gc_time_micros_;
309 intptr_t collections_; 313 intptr_t collections_;
310 static const int kStatsHistoryCapacity = 2; 314 static const int kStatsHistoryCapacity = 4;
311 RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_; 315 RingBuffer<ScavengeStats, kStatsHistoryCapacity> stats_history_;
312 316
317 intptr_t scavenge_words_per_micro_;
318 intptr_t idle_scavenge_threshold_in_words_;
319
313 // The total size of external data associated with objects in this scavenger. 320 // The total size of external data associated with objects in this scavenger.
314 intptr_t external_size_; 321 intptr_t external_size_;
315 322
316 bool failed_to_promote_; 323 bool failed_to_promote_;
317 324
318 friend class ScavengerVisitor; 325 friend class ScavengerVisitor;
319 friend class ScavengerWeakVisitor; 326 friend class ScavengerWeakVisitor;
320 327
321 DISALLOW_COPY_AND_ASSIGN(Scavenger); 328 DISALLOW_COPY_AND_ASSIGN(Scavenger);
322 }; 329 };
323 330
324 } // namespace dart 331 } // namespace dart
325 332
326 #endif // RUNTIME_VM_SCAVENGER_H_ 333 #endif // RUNTIME_VM_SCAVENGER_H_
OLDNEW
« no previous file with comments | « runtime/vm/heap.cc ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698