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