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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void PromoteExternal(intptr_t size); | 95 void PromoteExternal(intptr_t size); |
96 | 96 |
97 // Heap contains the specified address. | 97 // Heap contains the specified address. |
98 bool Contains(uword addr) const; | 98 bool Contains(uword addr) const; |
99 bool NewContains(uword addr) const; | 99 bool NewContains(uword addr) const; |
100 bool OldContains(uword addr) const; | 100 bool OldContains(uword addr) const; |
101 bool CodeContains(uword addr) const; | 101 bool CodeContains(uword addr) const; |
102 | 102 |
103 void IterateObjects(ObjectVisitor* visitor) const; | 103 void IterateObjects(ObjectVisitor* visitor) const; |
104 void IterateOldObjects(ObjectVisitor* visitor) const; | 104 void IterateOldObjects(ObjectVisitor* visitor) const; |
| 105 void IterateOldObjectsNoEmbedderPages(ObjectVisitor* visitor) const; |
105 void IterateObjectPointers(ObjectVisitor* visitor) const; | 106 void IterateObjectPointers(ObjectVisitor* visitor) const; |
106 | 107 |
107 // Find an object by visiting all pointers in the specified heap space, | 108 // Find an object by visiting all pointers in the specified heap space, |
108 // the 'visitor' is used to determine if an object is found or not. | 109 // the 'visitor' is used to determine if an object is found or not. |
109 // The 'visitor' function should be set up to return true if the | 110 // The 'visitor' function should be set up to return true if the |
110 // object is found, traversal through the heap space stops at that | 111 // object is found, traversal through the heap space stops at that |
111 // point. | 112 // point. |
112 // The 'visitor' function should return false if the object is not found, | 113 // The 'visitor' function should return false if the object is not found, |
113 // traversal through the heap space continues. | 114 // traversal through the heap space continues. |
114 // Returns null object if nothing is found. | 115 // Returns null object if nothing is found. |
(...skipping 16 matching lines...) Expand all Loading... |
131 // Enables growth control on the page space heaps. This should be | 132 // Enables growth control on the page space heaps. This should be |
132 // called before any user code is executed. | 133 // called before any user code is executed. |
133 void InitGrowthControl(); | 134 void InitGrowthControl(); |
134 void EnableGrowthControl() { SetGrowthControlState(true); } | 135 void EnableGrowthControl() { SetGrowthControlState(true); } |
135 void DisableGrowthControl() { SetGrowthControlState(false); } | 136 void DisableGrowthControl() { SetGrowthControlState(false); } |
136 void SetGrowthControlState(bool state); | 137 void SetGrowthControlState(bool state); |
137 bool GrowthControlState(); | 138 bool GrowthControlState(); |
138 | 139 |
139 // Protect access to the heap. Note: Code pages are made | 140 // Protect access to the heap. Note: Code pages are made |
140 // executable/non-executable when 'read_only' is true/false, respectively. | 141 // executable/non-executable when 'read_only' is true/false, respectively. |
141 void WriteProtect(bool read_only, bool include_code_pages); | 142 void WriteProtect(bool read_only); |
142 void WriteProtectCode(bool read_only) { | 143 void WriteProtectCode(bool read_only) { |
143 old_space_.WriteProtectCode(read_only); | 144 old_space_.WriteProtectCode(read_only); |
144 } | 145 } |
145 | 146 |
146 // Accessors for inlined allocation in generated code. | 147 // Accessors for inlined allocation in generated code. |
147 static intptr_t TopOffset(Space space); | 148 static intptr_t TopOffset(Space space); |
148 static intptr_t EndOffset(Space space); | 149 static intptr_t EndOffset(Space space); |
149 static Space SpaceForAllocation(intptr_t class_id); | 150 static Space SpaceForAllocation(intptr_t class_id); |
150 | 151 |
151 // Initialize the heap and register it with the isolate. | 152 // Initialize the heap and register it with the isolate. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 ~NoHeapGrowthControlScope(); | 385 ~NoHeapGrowthControlScope(); |
385 private: | 386 private: |
386 bool current_growth_controller_state_; | 387 bool current_growth_controller_state_; |
387 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 388 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
388 }; | 389 }; |
389 | 390 |
390 | 391 |
391 // Note: During this scope, the code pages are non-executable. | 392 // Note: During this scope, the code pages are non-executable. |
392 class WritableVMIsolateScope : StackResource { | 393 class WritableVMIsolateScope : StackResource { |
393 public: | 394 public: |
394 explicit WritableVMIsolateScope(Thread* thread, bool include_code_pages); | 395 explicit WritableVMIsolateScope(Thread* thread); |
395 ~WritableVMIsolateScope(); | 396 ~WritableVMIsolateScope(); |
396 | |
397 private: | |
398 bool include_code_pages_; | |
399 }; | 397 }; |
400 | 398 |
401 } // namespace dart | 399 } // namespace dart |
402 | 400 |
403 #endif // VM_HEAP_H_ | 401 #endif // VM_HEAP_H_ |
OLD | NEW |