Chromium Code Reviews| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 | 129 |
| 130 // Enables growth control on the page space heaps. This should be | 130 // Enables growth control on the page space heaps. This should be |
| 131 // called before any user code is executed. | 131 // called before any user code is executed. |
| 132 void EnableGrowthControl() { SetGrowthControlState(true); } | 132 void EnableGrowthControl() { SetGrowthControlState(true); } |
| 133 void DisableGrowthControl() { SetGrowthControlState(false); } | 133 void DisableGrowthControl() { SetGrowthControlState(false); } |
| 134 void SetGrowthControlState(bool state); | 134 void SetGrowthControlState(bool state); |
| 135 bool GrowthControlState(); | 135 bool GrowthControlState(); |
| 136 | 136 |
| 137 // Protect access to the heap. Note: Code pages are made | 137 // Protect access to the heap. Note: Code pages are made |
| 138 // executable/non-executable when 'read_only' is true/false, respectively. | 138 // executable/non-executable when 'read_only' is true/false, respectively. |
| 139 void WriteProtect(bool read_only); | 139 void WriteProtect(bool read_only, bool include_code_pages); |
| 140 void WriteProtectCode(bool read_only) { | 140 void WriteProtectCode(bool read_only) { |
| 141 old_space_.WriteProtectCode(read_only); | 141 old_space_.WriteProtectCode(read_only); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // Accessors for inlined allocation in generated code. | 144 // Accessors for inlined allocation in generated code. |
| 145 static intptr_t TopOffset(Space space); | 145 static intptr_t TopOffset(Space space); |
| 146 static intptr_t EndOffset(Space space); | 146 static intptr_t EndOffset(Space space); |
| 147 static Space SpaceForAllocation(intptr_t class_id); | 147 static Space SpaceForAllocation(intptr_t class_id); |
| 148 | 148 |
| 149 // Initialize the heap and register it with the isolate. | 149 // Initialize the heap and register it with the isolate. |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 ~NoHeapGrowthControlScope(); | 370 ~NoHeapGrowthControlScope(); |
| 371 private: | 371 private: |
| 372 bool current_growth_controller_state_; | 372 bool current_growth_controller_state_; |
| 373 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 373 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 374 }; | 374 }; |
| 375 | 375 |
| 376 | 376 |
| 377 // Note: During this scope, the code pages are non-executable. | 377 // Note: During this scope, the code pages are non-executable. |
| 378 class WritableVMIsolateScope : StackResource { | 378 class WritableVMIsolateScope : StackResource { |
| 379 public: | 379 public: |
| 380 explicit WritableVMIsolateScope(Thread* thread); | 380 explicit WritableVMIsolateScope(Thread* thread, bool include_code_pages); |
|
siva
2015/10/15 01:01:29
not explicit anymore as it has two parameters?
| |
| 381 ~WritableVMIsolateScope(); | 381 ~WritableVMIsolateScope(); |
| 382 | |
| 383 private: | |
| 384 bool include_code_pages_; | |
| 382 }; | 385 }; |
| 383 | 386 |
| 384 } // namespace dart | 387 } // namespace dart |
| 385 | 388 |
| 386 #endif // VM_HEAP_H_ | 389 #endif // VM_HEAP_H_ |
| OLD | NEW |