| 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 15 matching lines...) Expand all Loading... |
| 26 DECLARE_FLAG(bool, verify_before_gc); | 26 DECLARE_FLAG(bool, verify_before_gc); |
| 27 DECLARE_FLAG(bool, verify_after_gc); | 27 DECLARE_FLAG(bool, verify_after_gc); |
| 28 DECLARE_FLAG(bool, gc_at_alloc); | 28 DECLARE_FLAG(bool, gc_at_alloc); |
| 29 | 29 |
| 30 class Heap { | 30 class Heap { |
| 31 public: | 31 public: |
| 32 enum Space { | 32 enum Space { |
| 33 kNew, | 33 kNew, |
| 34 kOld, | 34 kOld, |
| 35 kCode, | 35 kCode, |
| 36 // TODO(koda): Harmonize all old-space allocation and get rid of this. |
| 36 kPretenured, | 37 kPretenured, |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 enum WeakSelector { | 40 enum WeakSelector { |
| 40 kPeers = 0, | 41 kPeers = 0, |
| 41 kHashes, | 42 kHashes, |
| 42 kNumWeakSelectors | 43 kNumWeakSelectors |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 enum ApiCallbacks { | 46 enum ApiCallbacks { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void SetGrowthControlState(bool state); | 139 void SetGrowthControlState(bool state); |
| 139 bool GrowthControlState(); | 140 bool GrowthControlState(); |
| 140 | 141 |
| 141 // Protect access to the heap. | 142 // Protect access to the heap. |
| 142 void WriteProtect(bool read_only); | 143 void WriteProtect(bool read_only); |
| 143 void WriteProtectCode(bool read_only) { | 144 void WriteProtectCode(bool read_only) { |
| 144 old_space_->WriteProtectCode(read_only); | 145 old_space_->WriteProtectCode(read_only); |
| 145 } | 146 } |
| 146 | 147 |
| 147 // Accessors for inlined allocation in generated code. | 148 // Accessors for inlined allocation in generated code. |
| 148 uword TopAddress(); | 149 uword TopAddress(Space space); |
| 149 uword EndAddress(); | 150 uword EndAddress(Space space); |
| 150 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } | 151 Space SpaceForAllocation(intptr_t class_id) const; |
| 151 uword NewSpaceAddress() const { return reinterpret_cast<uword>(new_space_); } | |
| 152 | 152 |
| 153 // Initialize the heap and register it with the isolate. | 153 // Initialize the heap and register it with the isolate. |
| 154 static void Init(Isolate* isolate, | 154 static void Init(Isolate* isolate, |
| 155 intptr_t max_new_gen_words, | 155 intptr_t max_new_gen_words, |
| 156 intptr_t max_old_gen_words); | 156 intptr_t max_old_gen_words); |
| 157 | 157 |
| 158 // Verify that all pointers in the heap point to the heap. | 158 // Verify that all pointers in the heap point to the heap. |
| 159 bool Verify() const; | 159 bool Verify() const; |
| 160 | 160 |
| 161 // Print heap sizes. | 161 // Print heap sizes. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 NoHeapGrowthControlScope(); | 353 NoHeapGrowthControlScope(); |
| 354 ~NoHeapGrowthControlScope(); | 354 ~NoHeapGrowthControlScope(); |
| 355 private: | 355 private: |
| 356 bool current_growth_controller_state_; | 356 bool current_growth_controller_state_; |
| 357 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 357 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 358 }; | 358 }; |
| 359 | 359 |
| 360 } // namespace dart | 360 } // namespace dart |
| 361 | 361 |
| 362 #endif // VM_HEAP_H_ | 362 #endif // VM_HEAP_H_ |
| OLD | NEW |