| 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 VM_HEAP_H_ | 5 #ifndef VM_HEAP_H_ |
| 6 #define VM_HEAP_H_ | 6 #define 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 // Return amount of memory used and capacity in a space, excluding external. | 160 // Return amount of memory used and capacity in a space, excluding external. |
| 161 int64_t UsedInWords(Space space) const; | 161 int64_t UsedInWords(Space space) const; |
| 162 int64_t CapacityInWords(Space space) const; | 162 int64_t CapacityInWords(Space space) const; |
| 163 int64_t ExternalInWords(Space space) const; | 163 int64_t ExternalInWords(Space space) const; |
| 164 // Return the amount of GCing in microseconds. | 164 // Return the amount of GCing in microseconds. |
| 165 int64_t GCTimeInMicros(Space space) const; | 165 int64_t GCTimeInMicros(Space space) const; |
| 166 | 166 |
| 167 intptr_t Collections(Space space) const; | 167 intptr_t Collections(Space space) const; |
| 168 | 168 |
| 169 ObjectSet* CreateAllocatedObjectSet(MarkExpectation mark_expectation) const; | 169 ObjectSet* CreateAllocatedObjectSet(Zone* zone, |
| 170 MarkExpectation mark_expectation) const; |
| 170 | 171 |
| 171 static const char* GCReasonToString(GCReason gc_reason); | 172 static const char* GCReasonToString(GCReason gc_reason); |
| 172 | 173 |
| 173 // Associate a peer with an object. A non-existent peer is equal to NULL. | 174 // Associate a peer with an object. A non-existent peer is equal to NULL. |
| 174 void SetPeer(RawObject* raw_obj, void* peer) { | 175 void SetPeer(RawObject* raw_obj, void* peer) { |
| 175 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer)); | 176 SetWeakEntry(raw_obj, kPeers, reinterpret_cast<intptr_t>(peer)); |
| 176 } | 177 } |
| 177 void* GetPeer(RawObject* raw_obj) const { | 178 void* GetPeer(RawObject* raw_obj) const { |
| 178 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers)); | 179 return reinterpret_cast<void*>(GetWeakEntry(raw_obj, kPeers)); |
| 179 } | 180 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 void PrintStats(); | 323 void PrintStats(); |
| 323 void UpdateClassHeapStatsBeforeGC(Heap::Space space); | 324 void UpdateClassHeapStatsBeforeGC(Heap::Space space); |
| 324 void PrintStatsToTimeline(TimelineEventScope* event); | 325 void PrintStatsToTimeline(TimelineEventScope* event); |
| 325 | 326 |
| 326 // Updates gc in progress flags. | 327 // Updates gc in progress flags. |
| 327 bool BeginNewSpaceGC(Thread* thread); | 328 bool BeginNewSpaceGC(Thread* thread); |
| 328 void EndNewSpaceGC(); | 329 void EndNewSpaceGC(); |
| 329 bool BeginOldSpaceGC(Thread* thread); | 330 bool BeginOldSpaceGC(Thread* thread); |
| 330 void EndOldSpaceGC(); | 331 void EndOldSpaceGC(); |
| 331 | 332 |
| 332 // If this heap is non-empty, updates start and end to the smallest range that | 333 void AddRegionsToObjectSet(ObjectSet* set) const; |
| 333 // contains both the original [start, end) and the [lowest, highest) addresses | |
| 334 // of this heap. | |
| 335 void GetMergedAddressRange(uword* start, uword* end) const; | |
| 336 | 334 |
| 337 Isolate* isolate_; | 335 Isolate* isolate_; |
| 338 | 336 |
| 339 // The different spaces used for allocation. | 337 // The different spaces used for allocation. |
| 340 ALIGN8 Scavenger new_space_; | 338 ALIGN8 Scavenger new_space_; |
| 341 PageSpace old_space_; | 339 PageSpace old_space_; |
| 342 | 340 |
| 343 WeakTable* new_weak_tables_[kNumWeakSelectors]; | 341 WeakTable* new_weak_tables_[kNumWeakSelectors]; |
| 344 WeakTable* old_weak_tables_[kNumWeakSelectors]; | 342 WeakTable* old_weak_tables_[kNumWeakSelectors]; |
| 345 | 343 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Note: During this scope, the code pages are non-executable. | 390 // Note: During this scope, the code pages are non-executable. |
| 393 class WritableVMIsolateScope : StackResource { | 391 class WritableVMIsolateScope : StackResource { |
| 394 public: | 392 public: |
| 395 explicit WritableVMIsolateScope(Thread* thread); | 393 explicit WritableVMIsolateScope(Thread* thread); |
| 396 ~WritableVMIsolateScope(); | 394 ~WritableVMIsolateScope(); |
| 397 }; | 395 }; |
| 398 | 396 |
| 399 } // namespace dart | 397 } // namespace dart |
| 400 | 398 |
| 401 #endif // VM_HEAP_H_ | 399 #endif // VM_HEAP_H_ |
| OLD | NEW |