Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: runtime/vm/heap.h

Issue 10696029: Implement a 2-pass heap verification algorithm. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ObjectPointerVisitor; 19 class ObjectPointerVisitor;
20 class ObjectSet;
20 class VirtualMemory; 21 class VirtualMemory;
21 22
22 DECLARE_FLAG(bool, verbose_gc); 23 DECLARE_FLAG(bool, verbose_gc);
23 DECLARE_FLAG(bool, verify_before_gc); 24 DECLARE_FLAG(bool, verify_before_gc);
24 DECLARE_FLAG(bool, verify_after_gc); 25 DECLARE_FLAG(bool, verify_after_gc);
25 DECLARE_FLAG(bool, gc_at_alloc); 26 DECLARE_FLAG(bool, gc_at_alloc);
26 27
27 class Heap { 28 class Heap {
28 public: 29 public:
29 enum Space { 30 enum Space {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 UNREACHABLE(); 74 UNREACHABLE();
74 } 75 }
75 return 0; 76 return 0;
76 } 77 }
77 78
78 // Heap contains the specified address. 79 // Heap contains the specified address.
79 bool Contains(uword addr) const; 80 bool Contains(uword addr) const;
80 bool CodeContains(uword addr) const; 81 bool CodeContains(uword addr) const;
81 bool StubCodeContains(uword addr) const; 82 bool StubCodeContains(uword addr) const;
82 83
84 // Visit all pointers.
85 void IteratePointers(ObjectPointerVisitor* visitor);
86
83 // Visit all pointers in the space. 87 // Visit all pointers in the space.
84 void IterateNewPointers(ObjectPointerVisitor* visitor); 88 void IterateNewPointers(ObjectPointerVisitor* visitor);
85 void IterateOldPointers(ObjectPointerVisitor* visitor); 89 void IterateOldPointers(ObjectPointerVisitor* visitor);
86 void IterateCodePointers(ObjectPointerVisitor* visitor); 90 void IterateCodePointers(ObjectPointerVisitor* visitor);
87 91
92 // Visit all objects.
93 void IterateObjects(ObjectVisitor* visitor);
94
88 // Visit all object in the space. 95 // Visit all object in the space.
89 void IterateNewObjects(ObjectVisitor* visitor); 96 void IterateNewObjects(ObjectVisitor* visitor);
90 void IterateOldObjects(ObjectVisitor* visitor); 97 void IterateOldObjects(ObjectVisitor* visitor);
91 void IterateCodeObjects(ObjectVisitor* visitor); 98 void IterateCodeObjects(ObjectVisitor* visitor);
92 99
93 // Find an object by visiting all pointers in the specified heap space, 100 // Find an object by visiting all pointers in the specified heap space,
94 // the 'visitor' is used to determine if an object is found or not. 101 // the 'visitor' is used to determine if an object is found or not.
95 // The 'visitor' function should be set up to return true if the 102 // The 'visitor' function should be set up to return true if the
96 // object is found, traversal through the heap space stops at that 103 // object is found, traversal through the heap space stops at that
97 // point. 104 // point.
(...skipping 17 matching lines...) Expand all
115 122
116 // Initialize the heap and register it with the isolate. 123 // Initialize the heap and register it with the isolate.
117 static void Init(Isolate* isolate); 124 static void Init(Isolate* isolate);
118 125
119 // Verify that all pointers in the heap point to the heap. 126 // Verify that all pointers in the heap point to the heap.
120 bool Verify() const; 127 bool Verify() const;
121 128
122 // Print heap sizes. 129 // Print heap sizes.
123 void PrintSizes() const; 130 void PrintSizes() const;
124 131
132 // Returns the [lowest, highest) addresses in the heap.
133 void StartEndAddress(uword* start, uword* end) const;
134
135 ObjectSet* CreateAllocatedObjectSet() const;
136
125 // Generates a profile of the current and VM isolate heaps. 137 // Generates a profile of the current and VM isolate heaps.
126 void Profile(Dart_HeapProfileWriteCallback callback, void* stream) const; 138 void Profile(Dart_HeapProfileWriteCallback callback, void* stream) const;
127 139
128 private: 140 private:
129 Heap(); 141 Heap();
130 142
131 uword AllocateNew(intptr_t size); 143 uword AllocateNew(intptr_t size);
132 uword AllocateOld(intptr_t size); 144 uword AllocateOld(intptr_t size);
133 uword AllocateCode(PageSpace* space, intptr_t size); 145 uword AllocateCode(PageSpace* space, intptr_t size);
134 146
(...skipping 19 matching lines...) Expand all
154 public: 166 public:
155 NoGCScope() {} 167 NoGCScope() {}
156 private: 168 private:
157 DISALLOW_COPY_AND_ASSIGN(NoGCScope); 169 DISALLOW_COPY_AND_ASSIGN(NoGCScope);
158 }; 170 };
159 #endif // defined(DEBUG) 171 #endif // defined(DEBUG)
160 172
161 } // namespace dart 173 } // namespace dart
162 174
163 #endif // VM_HEAP_H_ 175 #endif // VM_HEAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698