| 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" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 PageSpace(Heap* heap, intptr_t max_capacity_in_words); | 182 PageSpace(Heap* heap, intptr_t max_capacity_in_words); |
| 183 ~PageSpace(); | 183 ~PageSpace(); |
| 184 | 184 |
| 185 uword TryAllocate(intptr_t size, | 185 uword TryAllocate(intptr_t size, |
| 186 HeapPage::PageType type = HeapPage::kData, | 186 HeapPage::PageType type = HeapPage::kData, |
| 187 GrowthPolicy growth_policy = kControlGrowth); | 187 GrowthPolicy growth_policy = kControlGrowth); |
| 188 | 188 |
| 189 intptr_t UsedInWords() const { return used_in_words_; } | 189 intptr_t UsedInWords() const { return used_in_words_; } |
| 190 intptr_t CapacityInWords() const { return capacity_in_words_; } | 190 intptr_t CapacityInWords() const { return capacity_in_words_; } |
| 191 intptr_t ExternalInWords() const { |
| 192 return external_in_words_; |
| 193 } |
| 191 | 194 |
| 192 bool Contains(uword addr) const; | 195 bool Contains(uword addr) const; |
| 193 bool Contains(uword addr, HeapPage::PageType type) const; | 196 bool Contains(uword addr, HeapPage::PageType type) const; |
| 194 bool IsValidAddress(uword addr) const { | 197 bool IsValidAddress(uword addr) const { |
| 195 return Contains(addr); | 198 return Contains(addr); |
| 196 } | 199 } |
| 197 | 200 |
| 198 void VisitObjects(ObjectVisitor* visitor) const; | 201 void VisitObjects(ObjectVisitor* visitor) const; |
| 199 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 202 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
| 200 | 203 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 231 void IncrementCollections() { | 234 void IncrementCollections() { |
| 232 collections_++; | 235 collections_++; |
| 233 } | 236 } |
| 234 | 237 |
| 235 intptr_t collections() const { | 238 intptr_t collections() const { |
| 236 return collections_; | 239 return collections_; |
| 237 } | 240 } |
| 238 | 241 |
| 239 void PrintToJSONObject(JSONObject* object); | 242 void PrintToJSONObject(JSONObject* object); |
| 240 | 243 |
| 244 void AllocateExternal(intptr_t size); |
| 245 void FreeExternal(intptr_t size); |
| 246 |
| 241 private: | 247 private: |
| 242 // Ids for time and data records in Heap::GCStats. | 248 // Ids for time and data records in Heap::GCStats. |
| 243 enum { | 249 enum { |
| 244 // Time | 250 // Time |
| 245 kMarkObjects = 0, | 251 kMarkObjects = 0, |
| 246 kResetFreeLists = 1, | 252 kResetFreeLists = 1, |
| 247 kSweepPages = 2, | 253 kSweepPages = 2, |
| 248 kSweepLargePages = 3, | 254 kSweepLargePages = 3, |
| 249 // Data | 255 // Data |
| 250 kGarbageRatio = 0, | 256 kGarbageRatio = 0, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 273 Heap* heap_; | 279 Heap* heap_; |
| 274 | 280 |
| 275 HeapPage* pages_; | 281 HeapPage* pages_; |
| 276 HeapPage* pages_tail_; | 282 HeapPage* pages_tail_; |
| 277 HeapPage* large_pages_; | 283 HeapPage* large_pages_; |
| 278 | 284 |
| 279 // Various sizes being tracked for this generation. | 285 // Various sizes being tracked for this generation. |
| 280 intptr_t max_capacity_in_words_; | 286 intptr_t max_capacity_in_words_; |
| 281 intptr_t capacity_in_words_; | 287 intptr_t capacity_in_words_; |
| 282 intptr_t used_in_words_; | 288 intptr_t used_in_words_; |
| 289 intptr_t external_in_words_; |
| 283 | 290 |
| 284 // Keep track whether a MarkSweep is currently running. | 291 // Keep track whether a MarkSweep is currently running. |
| 285 bool sweeping_; | 292 bool sweeping_; |
| 286 | 293 |
| 287 PageSpaceController page_space_controller_; | 294 PageSpaceController page_space_controller_; |
| 288 | 295 |
| 289 int64_t gc_time_micros_; | 296 int64_t gc_time_micros_; |
| 290 intptr_t collections_; | 297 intptr_t collections_; |
| 291 | 298 |
| 292 friend class PageSpaceController; | 299 friend class PageSpaceController; |
| 293 | 300 |
| 294 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 301 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 295 }; | 302 }; |
| 296 | 303 |
| 297 } // namespace dart | 304 } // namespace dart |
| 298 | 305 |
| 299 #endif // VM_PAGES_H_ | 306 #endif // VM_PAGES_H_ |
| OLD | NEW |