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" |
| 11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
| 12 #include "vm/pages.h" | 12 #include "vm/pages.h" |
| 13 #include "vm/scavenger.h" | 13 #include "vm/scavenger.h" |
| 14 | 14 |
| 15 namespace dart { | 15 namespace dart { |
| 16 | 16 |
| 17 // Forward declarations. | 17 // Forward declarations. |
| 18 class Isolate; | 18 class Isolate; |
| 19 class Object; | |
|
siva
2012/09/14 00:03:46
Why is this forward declaration needed? I don't se
cshapiro
2012/09/15 01:23:41
This forward reference for Object is noise. Remov
| |
| 19 class ObjectPointerVisitor; | 20 class ObjectPointerVisitor; |
| 20 class ObjectSet; | 21 class ObjectSet; |
| 21 class VirtualMemory; | 22 class VirtualMemory; |
| 22 | 23 |
| 23 DECLARE_FLAG(bool, verbose_gc); | 24 DECLARE_FLAG(bool, verbose_gc); |
| 24 DECLARE_FLAG(bool, verify_before_gc); | 25 DECLARE_FLAG(bool, verify_before_gc); |
| 25 DECLARE_FLAG(bool, verify_after_gc); | 26 DECLARE_FLAG(bool, verify_after_gc); |
| 26 DECLARE_FLAG(bool, gc_at_alloc); | 27 DECLARE_FLAG(bool, gc_at_alloc); |
| 27 | 28 |
| 28 class Heap { | 29 class Heap { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 // Returns the [lowest, highest) addresses in the heap. | 150 // Returns the [lowest, highest) addresses in the heap. |
| 150 void StartEndAddress(uword* start, uword* end) const; | 151 void StartEndAddress(uword* start, uword* end) const; |
| 151 | 152 |
| 152 ObjectSet* CreateAllocatedObjectSet() const; | 153 ObjectSet* CreateAllocatedObjectSet() const; |
| 153 | 154 |
| 154 // Generates a profile of the current and VM isolate heaps. | 155 // Generates a profile of the current and VM isolate heaps. |
| 155 void Profile(Dart_HeapProfileWriteCallback callback, void* stream) const; | 156 void Profile(Dart_HeapProfileWriteCallback callback, void* stream) const; |
| 156 | 157 |
| 157 static const char* GCReasonToString(GCReason gc_reason); | 158 static const char* GCReasonToString(GCReason gc_reason); |
| 158 | 159 |
| 160 // Associates a peer with an object. If an object has a peer, it is | |
| 161 // replaced. A value of NULL disassociate an object from its peer. | |
| 162 void SetPeer(RawObject* raw_obj, void* peer); | |
| 163 | |
| 164 // Retrieves the peer associated with an object. Returns NULL if | |
| 165 // there is no association. | |
| 166 void* GetPeer(RawObject* raw_obj); | |
| 167 | |
| 168 // Returns the number of objects with a peer. | |
| 169 int64_t PeerCount() const; | |
| 170 | |
| 159 private: | 171 private: |
| 160 Heap(); | 172 Heap(); |
| 161 | 173 |
| 162 uword AllocateNew(intptr_t size); | 174 uword AllocateNew(intptr_t size); |
| 163 uword AllocateOld(intptr_t size); | 175 uword AllocateOld(intptr_t size); |
| 164 uword AllocateCode(PageSpace* space, intptr_t size); | 176 uword AllocateCode(PageSpace* space, intptr_t size); |
| 165 | 177 |
| 166 // The different spaces used for allocation. | 178 // The different spaces used for allocation. |
| 167 Scavenger* new_space_; | 179 Scavenger* new_space_; |
| 168 PageSpace* old_space_; | 180 PageSpace* old_space_; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 189 public: | 201 public: |
| 190 NoGCScope() {} | 202 NoGCScope() {} |
| 191 private: | 203 private: |
| 192 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 204 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 193 }; | 205 }; |
| 194 #endif // defined(DEBUG) | 206 #endif // defined(DEBUG) |
| 195 | 207 |
| 196 } // namespace dart | 208 } // namespace dart |
| 197 | 209 |
| 198 #endif // VM_HEAP_H_ | 210 #endif // VM_HEAP_H_ |
| OLD | NEW |