| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 enum WeakSelector { | 36 enum WeakSelector { |
| 37 kPeers = 0, | 37 kPeers = 0, |
| 38 #if !defined(HASH_IN_OBJECT_HEADER) | 38 #if !defined(HASH_IN_OBJECT_HEADER) |
| 39 kHashes, | 39 kHashes, |
| 40 #endif | 40 #endif |
| 41 kObjectIds, | 41 kObjectIds, |
| 42 kNumWeakSelectors | 42 kNumWeakSelectors |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 enum ApiCallbacks { kIgnoreApiCallbacks, kInvokeApiCallbacks }; | |
| 46 | |
| 47 enum GCReason { | 45 enum GCReason { |
| 48 kNewSpace, | 46 kNewSpace, |
| 49 kPromotion, | 47 kPromotion, |
| 50 kOldSpace, | 48 kOldSpace, |
| 51 kFull, | 49 kFull, |
| 52 kGCAtAlloc, | 50 kGCAtAlloc, |
| 53 kGCTestCase, | 51 kGCTestCase, |
| 54 }; | 52 }; |
| 55 | 53 |
| 56 // Pattern for unused new space and swept old space. | 54 // Pattern for unused new space and swept old space. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // point. | 98 // point. |
| 101 // The 'visitor' function should return false if the object is not found, | 99 // The 'visitor' function should return false if the object is not found, |
| 102 // traversal through the heap space continues. | 100 // traversal through the heap space continues. |
| 103 // Returns null object if nothing is found. | 101 // Returns null object if nothing is found. |
| 104 RawInstructions* FindObjectInCodeSpace(FindObjectVisitor* visitor) const; | 102 RawInstructions* FindObjectInCodeSpace(FindObjectVisitor* visitor) const; |
| 105 RawObject* FindOldObject(FindObjectVisitor* visitor) const; | 103 RawObject* FindOldObject(FindObjectVisitor* visitor) const; |
| 106 RawObject* FindNewObject(FindObjectVisitor* visitor) const; | 104 RawObject* FindNewObject(FindObjectVisitor* visitor) const; |
| 107 RawObject* FindObject(FindObjectVisitor* visitor) const; | 105 RawObject* FindObject(FindObjectVisitor* visitor) const; |
| 108 | 106 |
| 109 void CollectGarbage(Space space); | 107 void CollectGarbage(Space space); |
| 110 void CollectGarbage(Space space, ApiCallbacks api_callbacks, GCReason reason); | 108 void CollectGarbage(Space space, GCReason reason); |
| 111 void CollectAllGarbage(); | 109 void CollectAllGarbage(); |
| 112 bool NeedsGarbageCollection() const { | 110 bool NeedsGarbageCollection() const { |
| 113 return old_space_.NeedsGarbageCollection(); | 111 return old_space_.NeedsGarbageCollection(); |
| 114 } | 112 } |
| 115 | 113 |
| 116 void WaitForSweeperTasks(Thread* thread); | 114 void WaitForSweeperTasks(Thread* thread); |
| 117 | 115 |
| 118 // Enables growth control on the page space heaps. This should be | 116 // Enables growth control on the page space heaps. This should be |
| 119 // called before any user code is executed. | 117 // called before any user code is executed. |
| 120 void InitGrowthControl(); | 118 void InitGrowthControl(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void VisitObjects(ObjectVisitor* visitor) const; | 303 void VisitObjects(ObjectVisitor* visitor) const; |
| 306 void VisitObjectsNoImagePages(ObjectVisitor* visitor) const; | 304 void VisitObjectsNoImagePages(ObjectVisitor* visitor) const; |
| 307 void VisitObjectsImagePages(ObjectVisitor* visitor) const; | 305 void VisitObjectsImagePages(ObjectVisitor* visitor) const; |
| 308 | 306 |
| 309 // Like Verify, but does not wait for concurrent sweeper, so caller must | 307 // Like Verify, but does not wait for concurrent sweeper, so caller must |
| 310 // ensure thread-safety. | 308 // ensure thread-safety. |
| 311 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; | 309 bool VerifyGC(MarkExpectation mark_expectation = kForbidMarked) const; |
| 312 | 310 |
| 313 // Helper functions for garbage collection. | 311 // Helper functions for garbage collection. |
| 314 void CollectNewSpaceGarbage(Thread* thread, | 312 void CollectNewSpaceGarbage(Thread* thread, |
| 315 ApiCallbacks api_callbacks, | |
| 316 GCReason reason); | 313 GCReason reason); |
| 317 void CollectOldSpaceGarbage(Thread* thread, | 314 void CollectOldSpaceGarbage(Thread* thread, |
| 318 ApiCallbacks api_callbacks, | |
| 319 GCReason reason); | 315 GCReason reason); |
| 320 void EvacuateNewSpace(Thread* thread, GCReason reason); | 316 void EvacuateNewSpace(Thread* thread, GCReason reason); |
| 321 | 317 |
| 322 // GC stats collection. | 318 // GC stats collection. |
| 323 void RecordBeforeGC(Space space, GCReason reason); | 319 void RecordBeforeGC(Space space, GCReason reason); |
| 324 void RecordAfterGC(Space space); | 320 void RecordAfterGC(Space space); |
| 325 void PrintStats(); | 321 void PrintStats(); |
| 326 void UpdateClassHeapStatsBeforeGC(Heap::Space space); | 322 void UpdateClassHeapStatsBeforeGC(Heap::Space space); |
| 327 void PrintStatsToTimeline(TimelineEventScope* event); | 323 void PrintStatsToTimeline(TimelineEventScope* event); |
| 328 | 324 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 // Note: During this scope, the code pages are non-executable. | 403 // Note: During this scope, the code pages are non-executable. |
| 408 class WritableVMIsolateScope : StackResource { | 404 class WritableVMIsolateScope : StackResource { |
| 409 public: | 405 public: |
| 410 explicit WritableVMIsolateScope(Thread* thread); | 406 explicit WritableVMIsolateScope(Thread* thread); |
| 411 ~WritableVMIsolateScope(); | 407 ~WritableVMIsolateScope(); |
| 412 }; | 408 }; |
| 413 | 409 |
| 414 } // namespace dart | 410 } // namespace dart |
| 415 | 411 |
| 416 #endif // RUNTIME_VM_HEAP_H_ | 412 #endif // RUNTIME_VM_HEAP_H_ |
| OLD | NEW |