| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void CollectGarbage(Space space, ApiCallbacks api_callbacks, GCReason reason); | 126 void CollectGarbage(Space space, ApiCallbacks api_callbacks, GCReason reason); |
| 127 void CollectAllGarbage(); | 127 void CollectAllGarbage(); |
| 128 | 128 |
| 129 // Enables growth control on the page space heaps. This should be | 129 // Enables growth control on the page space heaps. This should be |
| 130 // called before any user code is executed. | 130 // called before any user code is executed. |
| 131 void EnableGrowthControl() { SetGrowthControlState(true); } | 131 void EnableGrowthControl() { SetGrowthControlState(true); } |
| 132 void DisableGrowthControl() { SetGrowthControlState(false); } | 132 void DisableGrowthControl() { SetGrowthControlState(false); } |
| 133 void SetGrowthControlState(bool state); | 133 void SetGrowthControlState(bool state); |
| 134 bool GrowthControlState(); | 134 bool GrowthControlState(); |
| 135 | 135 |
| 136 // Protect access to the heap. | 136 // Protect access to the heap. Note: Code pages are made |
| 137 // executable/non-executable when 'read_only' is true/false, respectively. |
| 137 void WriteProtect(bool read_only); | 138 void WriteProtect(bool read_only); |
| 138 void WriteProtectCode(bool read_only) { | 139 void WriteProtectCode(bool read_only) { |
| 139 old_space_.WriteProtectCode(read_only); | 140 old_space_.WriteProtectCode(read_only); |
| 140 } | 141 } |
| 141 | 142 |
| 142 // Accessors for inlined allocation in generated code. | 143 // Accessors for inlined allocation in generated code. |
| 143 static intptr_t TopOffset(Space space); | 144 static intptr_t TopOffset(Space space); |
| 144 static intptr_t EndOffset(Space space); | 145 static intptr_t EndOffset(Space space); |
| 145 static Space SpaceForAllocation(intptr_t class_id); | 146 static Space SpaceForAllocation(intptr_t class_id); |
| 146 | 147 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 352 |
| 352 class NoHeapGrowthControlScope : public StackResource { | 353 class NoHeapGrowthControlScope : public StackResource { |
| 353 public: | 354 public: |
| 354 NoHeapGrowthControlScope(); | 355 NoHeapGrowthControlScope(); |
| 355 ~NoHeapGrowthControlScope(); | 356 ~NoHeapGrowthControlScope(); |
| 356 private: | 357 private: |
| 357 bool current_growth_controller_state_; | 358 bool current_growth_controller_state_; |
| 358 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 359 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 359 }; | 360 }; |
| 360 | 361 |
| 362 |
| 363 // Note: During this scope, the code pages are non-executable. |
| 364 class WritableVMIsolateScope : StackResource { |
| 365 public: |
| 366 explicit WritableVMIsolateScope(Thread* thread); |
| 367 ~WritableVMIsolateScope(); |
| 368 }; |
| 369 |
| 361 } // namespace dart | 370 } // namespace dart |
| 362 | 371 |
| 363 #endif // VM_HEAP_H_ | 372 #endif // VM_HEAP_H_ |
| OLD | NEW |