OLD | NEW |
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_HEAP_H_ | 5 #ifndef RUNTIME_VM_HEAP_H_ |
6 #define RUNTIME_VM_HEAP_H_ | 6 #define RUNTIME_VM_HEAP_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Heap contains the specified address. | 86 // Heap contains the specified address. |
87 bool Contains(uword addr) const; | 87 bool Contains(uword addr) const; |
88 bool NewContains(uword addr) const; | 88 bool NewContains(uword addr) const; |
89 bool OldContains(uword addr) const; | 89 bool OldContains(uword addr) const; |
90 bool CodeContains(uword addr) const; | 90 bool CodeContains(uword addr) const; |
91 bool DataContains(uword addr) const; | 91 bool DataContains(uword addr) const; |
92 | 92 |
93 void IterateObjects(ObjectVisitor* visitor) const; | 93 void IterateObjects(ObjectVisitor* visitor) const; |
94 void IterateOldObjects(ObjectVisitor* visitor) const; | 94 void IterateOldObjects(ObjectVisitor* visitor) const; |
95 void IterateOldObjectsNoExternalPages(ObjectVisitor* visitor) const; | 95 void IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const; |
96 void IterateObjectPointers(ObjectVisitor* visitor) const; | 96 void IterateObjectPointers(ObjectVisitor* visitor) const; |
97 | 97 |
98 // Find an object by visiting all pointers in the specified heap space, | 98 // Find an object by visiting all pointers in the specified heap space, |
99 // the 'visitor' is used to determine if an object is found or not. | 99 // the 'visitor' is used to determine if an object is found or not. |
100 // The 'visitor' function should be set up to return true if the | 100 // The 'visitor' function should be set up to return true if the |
101 // object is found, traversal through the heap space stops at that | 101 // object is found, traversal through the heap space stops at that |
102 // point. | 102 // point. |
103 // The 'visitor' function should return false if the object is not found, | 103 // The 'visitor' function should return false if the object is not found, |
104 // traversal through the heap space continues. | 104 // traversal through the heap space continues. |
105 // Returns null object if nothing is found. | 105 // Returns null object if nothing is found. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { | 238 void PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { |
239 old_space_.PrintHeapMapToJSONStream(isolate, stream); | 239 old_space_.PrintHeapMapToJSONStream(isolate, stream); |
240 } | 240 } |
241 #endif // PRODUCT | 241 #endif // PRODUCT |
242 | 242 |
243 Isolate* isolate() const { return isolate_; } | 243 Isolate* isolate() const { return isolate_; } |
244 | 244 |
245 Monitor* barrier() const { return barrier_; } | 245 Monitor* barrier() const { return barrier_; } |
246 Monitor* barrier_done() const { return barrier_done_; } | 246 Monitor* barrier_done() const { return barrier_done_; } |
247 | 247 |
248 void SetupExternalPage(void* pointer, uword size, bool is_executable) { | 248 void SetupImagePage(void* pointer, uword size, bool is_executable) { |
249 old_space_.SetupExternalPage(pointer, size, is_executable); | 249 old_space_.SetupImagePage(pointer, size, is_executable); |
250 } | 250 } |
251 | 251 |
252 private: | 252 private: |
253 class GCStats : public ValueObject { | 253 class GCStats : public ValueObject { |
254 public: | 254 public: |
255 GCStats() {} | 255 GCStats() {} |
256 intptr_t num_; | 256 intptr_t num_; |
257 Heap::Space space_; | 257 Heap::Space space_; |
258 Heap::GCReason reason_; | 258 Heap::GCReason reason_; |
259 | 259 |
(...skipping 29 matching lines...) Expand all Loading... |
289 uword AllocateNew(intptr_t size); | 289 uword AllocateNew(intptr_t size); |
290 uword AllocateOld(intptr_t size, HeapPage::PageType type); | 290 uword AllocateOld(intptr_t size, HeapPage::PageType type); |
291 | 291 |
292 // Visit all pointers. Caller must ensure concurrent sweeper is not running, | 292 // Visit all pointers. Caller must ensure concurrent sweeper is not running, |
293 // and the visitor must not allocate. | 293 // and the visitor must not allocate. |
294 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; | 294 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; |
295 | 295 |
296 // Visit all objects, including FreeListElement "objects". Caller must ensure | 296 // Visit all objects, including FreeListElement "objects". Caller must ensure |
297 // concurrent sweeper is not running, and the visitor must not allocate. | 297 // concurrent sweeper is not running, and the visitor must not allocate. |
298 void VisitObjects(ObjectVisitor* visitor) const; | 298 void VisitObjects(ObjectVisitor* visitor) const; |
299 void VisitObjectsNoExternalPages(ObjectVisitor* visitor) const; | 299 void VisitObjectsNoImagePages(ObjectVisitor* visitor) const; |
300 void VisitObjectsExternalPages(ObjectVisitor* visitor) const; | 300 void VisitObjectsImagePages(ObjectVisitor* visitor) const; |
301 | 301 |
302 // Like Verify, but does not wait for concurrent sweeper, so caller must | 302 // Like Verify, but does not wait for concurrent sweeper, so caller must |
303 // ensure thread-safety. | 303 // ensure thread-safety. |
304 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; | 304 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; |
305 | 305 |
306 // Helper functions for garbage collection. | 306 // Helper functions for garbage collection. |
307 void CollectNewSpaceGarbage(Thread* thread, | 307 void CollectNewSpaceGarbage(Thread* thread, |
308 ApiCallbacks api_callbacks, | 308 ApiCallbacks api_callbacks, |
309 GCReason reason); | 309 GCReason reason); |
310 void CollectOldSpaceGarbage(Thread* thread, | 310 void CollectOldSpaceGarbage(Thread* thread, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Note: During this scope, the code pages are non-executable. | 389 // Note: During this scope, the code pages are non-executable. |
390 class WritableVMIsolateScope : StackResource { | 390 class WritableVMIsolateScope : StackResource { |
391 public: | 391 public: |
392 explicit WritableVMIsolateScope(Thread* thread); | 392 explicit WritableVMIsolateScope(Thread* thread); |
393 ~WritableVMIsolateScope(); | 393 ~WritableVMIsolateScope(); |
394 }; | 394 }; |
395 | 395 |
396 } // namespace dart | 396 } // namespace dart |
397 | 397 |
398 #endif // RUNTIME_VM_HEAP_H_ | 398 #endif // RUNTIME_VM_HEAP_H_ |
OLD | NEW |