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

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

Issue 10452006: Implement a heap profiler for the Dart managed heap. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: added basic test code Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_PAGES_H_ 5 #ifndef VM_PAGES_H_
6 #define VM_PAGES_H_ 6 #define VM_PAGES_H_
7 7
8 #include "vm/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/virtual_memory.h" 10 #include "vm/virtual_memory.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 uword TryBumpAllocate(intptr_t size) { 45 uword TryBumpAllocate(intptr_t size) {
46 uword result = top(); 46 uword result = top();
47 intptr_t remaining_space = end() - result; 47 intptr_t remaining_space = end() - result;
48 if (remaining_space < size) { 48 if (remaining_space < size) {
49 return 0; 49 return 0;
50 } 50 }
51 set_top(result + size); 51 set_top(result + size);
52 return result; 52 return result;
53 } 53 }
54 54
55 void VisitObjects(ObjectVisitor* visitor) const;
55 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 56 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
56 57
57 RawObject* FindObject(FindObjectVisitor* visitor) const; 58 RawObject* FindObject(FindObjectVisitor* visitor) const;
58 59
59 private: 60 private:
60 static HeapPage* Initialize(VirtualMemory* memory, bool is_executable); 61 static HeapPage* Initialize(VirtualMemory* memory, bool is_executable);
61 static HeapPage* Allocate(intptr_t size, bool is_executable); 62 static HeapPage* Allocate(intptr_t size, bool is_executable);
62 63
63 // Deallocate the virtual memory backing this page. The page pointer to this 64 // Deallocate the virtual memory backing this page. The page pointer to this
64 // page becomes immediately inaccessible. 65 // page becomes immediately inaccessible.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 intptr_t capacity() const { return capacity_; } 161 intptr_t capacity() const { return capacity_; }
161 162
162 bool Contains(uword addr) const; 163 bool Contains(uword addr) const;
163 bool IsValidAddress(uword addr) const { 164 bool IsValidAddress(uword addr) const {
164 return Contains(addr); 165 return Contains(addr);
165 } 166 }
166 static bool IsPageAllocatableSize(intptr_t size) { 167 static bool IsPageAllocatableSize(intptr_t size) {
167 return size <= kAllocatablePageSize; 168 return size <= kAllocatablePageSize;
168 } 169 }
169 170
171 void VisitObjects(ObjectVisitor* visitor) const;
170 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 172 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
171 173
172 RawObject* FindObject(FindObjectVisitor* visitor) const; 174 RawObject* FindObject(FindObjectVisitor* visitor) const;
173 175
174 // Collect the garbage in the page space using mark-sweep. 176 // Collect the garbage in the page space using mark-sweep.
175 void MarkSweep(bool invoke_api_callbacks); 177 void MarkSweep(bool invoke_api_callbacks);
176 178
177 static HeapPage* PageFor(RawObject* raw_obj) { 179 static HeapPage* PageFor(RawObject* raw_obj) {
178 return reinterpret_cast<HeapPage*>( 180 return reinterpret_cast<HeapPage*>(
179 RawObject::ToAddr(raw_obj) & ~(kPageSize -1)); 181 RawObject::ToAddr(raw_obj) & ~(kPageSize -1));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 bool sweeping_; 232 bool sweeping_;
231 233
232 PageSpaceController page_space_controller_; 234 PageSpaceController page_space_controller_;
233 235
234 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 236 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
235 }; 237 };
236 238
237 } // namespace dart 239 } // namespace dart
238 240
239 #endif // VM_PAGES_H_ 241 #endif // VM_PAGES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698