| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 VM_PAGES_H_ | 5 #ifndef VM_PAGES_H_ |
| 6 #define VM_PAGES_H_ | 6 #define VM_PAGES_H_ |
| 7 | 7 |
| 8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/virtual_memory.h" | 10 #include "vm/virtual_memory.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 DECLARE_FLAG(bool, collect_code); | 14 DECLARE_FLAG(bool, collect_code); |
| 15 DECLARE_FLAG(bool, log_code_drop); | 15 DECLARE_FLAG(bool, log_code_drop); |
| 16 DECLARE_FLAG(bool, always_drop_code); | 16 DECLARE_FLAG(bool, always_drop_code); |
| 17 | 17 |
| 18 // Forward declarations. | 18 // Forward declarations. |
| 19 class Heap; | 19 class Heap; |
| 20 class JSONObject; |
| 20 class ObjectPointerVisitor; | 21 class ObjectPointerVisitor; |
| 21 | 22 |
| 22 // A page containing old generation objects. | 23 // A page containing old generation objects. |
| 23 class HeapPage { | 24 class HeapPage { |
| 24 public: | 25 public: |
| 25 enum PageType { | 26 enum PageType { |
| 26 kData = 0, | 27 kData = 0, |
| 27 kExecutable, | 28 kExecutable, |
| 28 kNumPageTypes | 29 kNumPageTypes |
| 29 }; | 30 }; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void SetGrowthControlState(bool state) { | 213 void SetGrowthControlState(bool state) { |
| 213 page_space_controller_.set_is_enabled(state); | 214 page_space_controller_.set_is_enabled(state); |
| 214 } | 215 } |
| 215 | 216 |
| 216 bool GrowthControlState() { | 217 bool GrowthControlState() { |
| 217 return page_space_controller_.is_enabled(); | 218 return page_space_controller_.is_enabled(); |
| 218 } | 219 } |
| 219 | 220 |
| 220 void WriteProtect(bool read_only); | 221 void WriteProtect(bool read_only); |
| 221 | 222 |
| 223 void AddGCTime(int64_t micros) { |
| 224 gc_time_micros_ += micros; |
| 225 } |
| 226 |
| 227 int64_t gc_time_micros() const { |
| 228 return gc_time_micros_; |
| 229 } |
| 230 |
| 231 void IncrementCollections() { |
| 232 collections_++; |
| 233 } |
| 234 |
| 235 intptr_t collections() const { |
| 236 return collections_; |
| 237 } |
| 238 |
| 239 void PrintToJSONObject(JSONObject* object); |
| 240 |
| 222 private: | 241 private: |
| 223 // Ids for time and data records in Heap::GCStats. | 242 // Ids for time and data records in Heap::GCStats. |
| 224 enum { | 243 enum { |
| 225 // Time | 244 // Time |
| 226 kMarkObjects = 0, | 245 kMarkObjects = 0, |
| 227 kResetFreeLists = 1, | 246 kResetFreeLists = 1, |
| 228 kSweepPages = 2, | 247 kSweepPages = 2, |
| 229 kSweepLargePages = 3, | 248 kSweepLargePages = 3, |
| 230 // Data | 249 // Data |
| 231 kGarbageRatio = 0, | 250 kGarbageRatio = 0, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 260 // Various sizes being tracked for this generation. | 279 // Various sizes being tracked for this generation. |
| 261 intptr_t max_capacity_in_words_; | 280 intptr_t max_capacity_in_words_; |
| 262 intptr_t capacity_in_words_; | 281 intptr_t capacity_in_words_; |
| 263 intptr_t used_in_words_; | 282 intptr_t used_in_words_; |
| 264 | 283 |
| 265 // Keep track whether a MarkSweep is currently running. | 284 // Keep track whether a MarkSweep is currently running. |
| 266 bool sweeping_; | 285 bool sweeping_; |
| 267 | 286 |
| 268 PageSpaceController page_space_controller_; | 287 PageSpaceController page_space_controller_; |
| 269 | 288 |
| 289 int64_t gc_time_micros_; |
| 290 intptr_t collections_; |
| 291 |
| 270 friend class PageSpaceController; | 292 friend class PageSpaceController; |
| 271 | 293 |
| 272 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 294 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 273 }; | 295 }; |
| 274 | 296 |
| 275 } // namespace dart | 297 } // namespace dart |
| 276 | 298 |
| 277 #endif // VM_PAGES_H_ | 299 #endif // VM_PAGES_H_ |
| OLD | NEW |