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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void PromoteExternal(intptr_t size); | 87 void PromoteExternal(intptr_t size); |
88 | 88 |
89 // Heap contains the specified address. | 89 // Heap contains the specified address. |
90 bool Contains(uword addr) const; | 90 bool Contains(uword addr) const; |
91 bool NewContains(uword addr) const; | 91 bool NewContains(uword addr) const; |
92 bool OldContains(uword addr) const; | 92 bool OldContains(uword addr) const; |
93 bool CodeContains(uword addr) const; | 93 bool CodeContains(uword addr) const; |
94 bool DataContains(uword addr) const; | 94 bool DataContains(uword addr) const; |
95 | 95 |
96 void IterateObjects(ObjectVisitor* visitor) const; | 96 void IterateObjects(ObjectVisitor* visitor) const; |
| 97 void IterateNewObjects(ObjectVisitor* visitor) const; |
97 void IterateOldObjects(ObjectVisitor* visitor) const; | 98 void IterateOldObjects(ObjectVisitor* visitor) const; |
98 void IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const; | 99 void IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const; |
99 void IterateObjectPointers(ObjectVisitor* visitor) const; | 100 void IterateObjectPointers(ObjectVisitor* visitor) const; |
100 | 101 |
101 // Find an object by visiting all pointers in the specified heap space, | 102 // Find an object by visiting all pointers in the specified heap space, |
102 // the 'visitor' is used to determine if an object is found or not. | 103 // the 'visitor' is used to determine if an object is found or not. |
103 // The 'visitor' function should be set up to return true if the | 104 // The 'visitor' function should be set up to return true if the |
104 // object is found, traversal through the heap space stops at that | 105 // object is found, traversal through the heap space stops at that |
105 // point. | 106 // point. |
106 // The 'visitor' function should return false if the object is not found, | 107 // The 'visitor' function should return false if the object is not found, |
(...skipping 22 matching lines...) Expand all Loading... |
129 bool GrowthControlState(); | 130 bool GrowthControlState(); |
130 | 131 |
131 // Protect access to the heap. Note: Code pages are made | 132 // Protect access to the heap. Note: Code pages are made |
132 // executable/non-executable when 'read_only' is true/false, respectively. | 133 // executable/non-executable when 'read_only' is true/false, respectively. |
133 void WriteProtect(bool read_only); | 134 void WriteProtect(bool read_only); |
134 void WriteProtectCode(bool read_only) { | 135 void WriteProtectCode(bool read_only) { |
135 old_space_.WriteProtectCode(read_only); | 136 old_space_.WriteProtectCode(read_only); |
136 } | 137 } |
137 | 138 |
138 // Accessors for inlined allocation in generated code. | 139 // Accessors for inlined allocation in generated code. |
139 static intptr_t TopOffset(Space space); | |
140 static intptr_t EndOffset(Space space); | |
141 | 140 |
142 // Initialize the heap and register it with the isolate. | 141 // Initialize the heap and register it with the isolate. |
143 static void Init(Isolate* isolate, | 142 static void Init(Isolate* isolate, |
144 intptr_t max_new_gen_words, | 143 intptr_t max_new_gen_words, |
145 intptr_t max_old_gen_words, | 144 intptr_t max_old_gen_words, |
146 intptr_t max_external_words); | 145 intptr_t max_external_words); |
147 | 146 |
148 // Writes a suitable name for a VM region in the heap into the buffer `name`. | 147 // Writes a suitable name for a VM region in the heap into the buffer `name`. |
149 static void RegionName(Heap* heap, | 148 static void RegionName(Heap* heap, |
150 Space space, | 149 Space space, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 bool BeginNewSpaceGC(Thread* thread); | 335 bool BeginNewSpaceGC(Thread* thread); |
337 void EndNewSpaceGC(); | 336 void EndNewSpaceGC(); |
338 bool BeginOldSpaceGC(Thread* thread); | 337 bool BeginOldSpaceGC(Thread* thread); |
339 void EndOldSpaceGC(); | 338 void EndOldSpaceGC(); |
340 | 339 |
341 void AddRegionsToObjectSet(ObjectSet* set) const; | 340 void AddRegionsToObjectSet(ObjectSet* set) const; |
342 | 341 |
343 Isolate* isolate_; | 342 Isolate* isolate_; |
344 | 343 |
345 // The different spaces used for allocation. | 344 // The different spaces used for allocation. |
346 ALIGN8 Scavenger new_space_; | 345 Scavenger new_space_; |
347 PageSpace old_space_; | 346 PageSpace old_space_; |
348 | 347 |
349 WeakTable* new_weak_tables_[kNumWeakSelectors]; | 348 WeakTable* new_weak_tables_[kNumWeakSelectors]; |
350 WeakTable* old_weak_tables_[kNumWeakSelectors]; | 349 WeakTable* old_weak_tables_[kNumWeakSelectors]; |
351 | 350 |
352 Monitor* barrier_; | 351 Monitor* barrier_; |
353 Monitor* barrier_done_; | 352 Monitor* barrier_done_; |
354 | 353 |
355 // GC stats collection. | 354 // GC stats collection. |
356 GCStats stats_; | 355 GCStats stats_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Note: During this scope, the code pages are non-executable. | 403 // Note: During this scope, the code pages are non-executable. |
405 class WritableVMIsolateScope : StackResource { | 404 class WritableVMIsolateScope : StackResource { |
406 public: | 405 public: |
407 explicit WritableVMIsolateScope(Thread* thread); | 406 explicit WritableVMIsolateScope(Thread* thread); |
408 ~WritableVMIsolateScope(); | 407 ~WritableVMIsolateScope(); |
409 }; | 408 }; |
410 | 409 |
411 } // namespace dart | 410 } // namespace dart |
412 | 411 |
413 #endif // RUNTIME_VM_HEAP_H_ | 412 #endif // RUNTIME_VM_HEAP_H_ |
OLD | NEW |