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

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

Issue 11428067: Merge the Merlin heap tracing to top-of-trunk. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years 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/handles_impl.h ('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 HeapTrace;
18 class Isolate; 19 class Isolate;
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
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 uword TopAddress(); 142 uword TopAddress();
142 uword EndAddress(); 143 uword EndAddress();
143 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } 144 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); }
144 145
145 // Initialize the heap and register it with the isolate. 146 // Initialize the heap and register it with the isolate.
146 static void Init(Isolate* isolate); 147 static void Init(Isolate* isolate);
147 148
148 // Verify that all pointers in the heap point to the heap. 149 // Verify that all pointers in the heap point to the heap.
149 bool Verify() const; 150 bool Verify() const;
150 151
152 // Accessor function to get the HeapTrace used for tracing. There
153 // should only ever be one of these per isolate
154 HeapTrace* trace() const { return heap_trace_; }
155
151 // Print heap sizes. 156 // Print heap sizes.
152 void PrintSizes() const; 157 void PrintSizes() const;
153 158
154 // Returns the [lowest, highest) addresses in the heap. 159 // Returns the [lowest, highest) addresses in the heap.
155 void StartEndAddress(uword* start, uword* end) const; 160 void StartEndAddress(uword* start, uword* end) const;
156 161
157 ObjectSet* CreateAllocatedObjectSet() const; 162 ObjectSet* CreateAllocatedObjectSet() const;
158 163
159 // Generates a profile of the current and VM isolate heaps. 164 // Generates a profile of the current and VM isolate heaps.
160 void Profile(Dart_FileWriteCallback callback, void* stream) const; 165 void Profile(Dart_FileWriteCallback callback, void* stream) const;
(...skipping 15 matching lines...) Expand all
176 private: 181 private:
177 Heap(); 182 Heap();
178 183
179 uword AllocateNew(intptr_t size); 184 uword AllocateNew(intptr_t size);
180 uword AllocateOld(intptr_t size, HeapPage::PageType type); 185 uword AllocateOld(intptr_t size, HeapPage::PageType type);
181 186
182 // The different spaces used for allocation. 187 // The different spaces used for allocation.
183 Scavenger* new_space_; 188 Scavenger* new_space_;
184 PageSpace* old_space_; 189 PageSpace* old_space_;
185 190
191 // The active heap trace.
192 HeapTrace* heap_trace_;
193
186 // This heap is in read-only mode: No allocation is allowed. 194 // This heap is in read-only mode: No allocation is allowed.
187 bool read_only_; 195 bool read_only_;
188 196
189 friend class GCTestHelper; 197 friend class GCTestHelper;
190 DISALLOW_COPY_AND_ASSIGN(Heap); 198 DISALLOW_COPY_AND_ASSIGN(Heap);
191 }; 199 };
192 200
193 201
194 #if defined(DEBUG) 202 #if defined(DEBUG)
195 class NoGCScope : public StackResource { 203 class NoGCScope : public StackResource {
196 public: 204 public:
197 NoGCScope(); 205 NoGCScope();
198 ~NoGCScope(); 206 ~NoGCScope();
199 private: 207 private:
200 DISALLOW_COPY_AND_ASSIGN(NoGCScope); 208 DISALLOW_COPY_AND_ASSIGN(NoGCScope);
201 }; 209 };
202 #else // defined(DEBUG) 210 #else // defined(DEBUG)
203 class NoGCScope : public ValueObject { 211 class NoGCScope : public ValueObject {
204 public: 212 public:
205 NoGCScope() {} 213 NoGCScope() {}
206 private: 214 private:
207 DISALLOW_COPY_AND_ASSIGN(NoGCScope); 215 DISALLOW_COPY_AND_ASSIGN(NoGCScope);
208 }; 216 };
209 #endif // defined(DEBUG) 217 #endif // defined(DEBUG)
210 218
211 } // namespace dart 219 } // namespace dart
212 220
213 #endif // VM_HEAP_H_ 221 #endif // VM_HEAP_H_
OLDNEW
« no previous file with comments | « runtime/vm/handles_impl.h ('k') | runtime/vm/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698