| 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 <map> |
| 9 |
| 8 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
| 9 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 10 #include "vm/virtual_memory.h" | 12 #include "vm/virtual_memory.h" |
| 11 | 13 |
| 12 namespace dart { | 14 namespace dart { |
| 13 | 15 |
| 14 // Forward declarations. | 16 // Forward declarations. |
| 15 class Heap; | 17 class Heap; |
| 16 class ObjectPointerVisitor; | 18 class ObjectPointerVisitor; |
| 17 | 19 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 void SetGrowthControlState(bool state) { | 198 void SetGrowthControlState(bool state) { |
| 197 page_space_controller_.set_is_enabled(state); | 199 page_space_controller_.set_is_enabled(state); |
| 198 } | 200 } |
| 199 | 201 |
| 200 bool GrowthControlState() { | 202 bool GrowthControlState() { |
| 201 return page_space_controller_.is_enabled(); | 203 return page_space_controller_.is_enabled(); |
| 202 } | 204 } |
| 203 | 205 |
| 204 void WriteProtect(bool read_only); | 206 void WriteProtect(bool read_only); |
| 205 | 207 |
| 208 typedef std::map<RawObject*, void*> PeerTable; |
| 209 |
| 210 void SetPeer(RawObject* raw_obj, void* peer); |
| 211 |
| 212 void* GetPeer(RawObject* raw_obj); |
| 213 |
| 214 int64_t PeerCount() const; |
| 215 |
| 216 PeerTable* GetPeerTable() { return &peer_table_; } |
| 217 |
| 206 private: | 218 private: |
| 207 // Ids for time and data records in Heap::GCStats. | 219 // Ids for time and data records in Heap::GCStats. |
| 208 enum { | 220 enum { |
| 209 // Time | 221 // Time |
| 210 kMarkObjects = 0, | 222 kMarkObjects = 0, |
| 211 kResetFreeLists = 1, | 223 kResetFreeLists = 1, |
| 212 kSweepPages = 2, | 224 kSweepPages = 2, |
| 213 kSweepLargePages = 3, | 225 kSweepLargePages = 3, |
| 214 // Data | 226 // Data |
| 215 kGarbageRatio = 0, | 227 kGarbageRatio = 0, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 234 } | 246 } |
| 235 | 247 |
| 236 FreeList freelist_[HeapPage::kNumPageTypes]; | 248 FreeList freelist_[HeapPage::kNumPageTypes]; |
| 237 | 249 |
| 238 Heap* heap_; | 250 Heap* heap_; |
| 239 | 251 |
| 240 HeapPage* pages_; | 252 HeapPage* pages_; |
| 241 HeapPage* pages_tail_; | 253 HeapPage* pages_tail_; |
| 242 HeapPage* large_pages_; | 254 HeapPage* large_pages_; |
| 243 | 255 |
| 256 PeerTable peer_table_; |
| 257 |
| 244 // Various sizes being tracked for this generation. | 258 // Various sizes being tracked for this generation. |
| 245 intptr_t max_capacity_; | 259 intptr_t max_capacity_; |
| 246 intptr_t capacity_; | 260 intptr_t capacity_; |
| 247 intptr_t in_use_; | 261 intptr_t in_use_; |
| 248 | 262 |
| 249 // Keep track whether a MarkSweep is currently running. | 263 // Keep track whether a MarkSweep is currently running. |
| 250 bool sweeping_; | 264 bool sweeping_; |
| 251 | 265 |
| 252 PageSpaceController page_space_controller_; | 266 PageSpaceController page_space_controller_; |
| 253 | 267 |
| 254 friend class PageSpaceController; | 268 friend class PageSpaceController; |
| 255 | 269 |
| 256 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); | 270 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); |
| 257 }; | 271 }; |
| 258 | 272 |
| 259 } // namespace dart | 273 } // namespace dart |
| 260 | 274 |
| 261 #endif // VM_PAGES_H_ | 275 #endif // VM_PAGES_H_ |
| OLD | NEW |