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

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

Issue 14190014: - Disassociate old page size from new allocatable size. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/heap.h ('k') | runtime/vm/pages.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) 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 <map> 8 #include <map>
9 9
10 #include "vm/freelist.h" 10 #include "vm/freelist.h"
(...skipping 23 matching lines...) Expand all
34 return memory_->Contains(addr); 34 return memory_->Contains(addr);
35 } 35 }
36 36
37 uword object_start() const { 37 uword object_start() const {
38 return (reinterpret_cast<uword>(this) + ObjectStartOffset()); 38 return (reinterpret_cast<uword>(this) + ObjectStartOffset());
39 } 39 }
40 uword object_end() const { 40 uword object_end() const {
41 return object_end_; 41 return object_end_;
42 } 42 }
43 43
44 void set_used(uword used) { used_ = used; }
45 uword used() const { return used_; }
46 void AddUsed(uword size) {
47 used_ += size;
48 }
49
50 PageType type() const { 44 PageType type() const {
51 return executable_ ? kExecutable : kData; 45 return executable_ ? kExecutable : kData;
52 } 46 }
53 47
54 void VisitObjects(ObjectVisitor* visitor) const; 48 void VisitObjects(ObjectVisitor* visitor) const;
55 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 49 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
56 50
57 RawObject* FindObject(FindObjectVisitor* visitor) const; 51 RawObject* FindObject(FindObjectVisitor* visitor) const;
58 52
59 void WriteProtect(bool read_only); 53 void WriteProtect(bool read_only);
(...skipping 10 matching lines...) Expand all
70 64
71 static HeapPage* Initialize(VirtualMemory* memory, PageType type); 65 static HeapPage* Initialize(VirtualMemory* memory, PageType type);
72 static HeapPage* Allocate(intptr_t size, PageType type); 66 static HeapPage* Allocate(intptr_t size, PageType type);
73 67
74 // Deallocate the virtual memory backing this page. The page pointer to this 68 // Deallocate the virtual memory backing this page. The page pointer to this
75 // page becomes immediately inaccessible. 69 // page becomes immediately inaccessible.
76 void Deallocate(); 70 void Deallocate();
77 71
78 VirtualMemory* memory_; 72 VirtualMemory* memory_;
79 HeapPage* next_; 73 HeapPage* next_;
80 uword used_;
81 uword object_end_; 74 uword object_end_;
82 bool executable_; 75 bool executable_;
83 76
84 friend class PageSpace; 77 friend class PageSpace;
85 78
86 DISALLOW_ALLOCATION(); 79 DISALLOW_ALLOCATION();
87 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage); 80 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapPage);
88 }; 81 };
89 82
90 83
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 GrowthPolicy growth_policy = kControlGrowth); 176 GrowthPolicy growth_policy = kControlGrowth);
184 177
185 intptr_t in_use() const { return in_use_; } 178 intptr_t in_use() const { return in_use_; }
186 intptr_t capacity() const { return capacity_; } 179 intptr_t capacity() const { return capacity_; }
187 180
188 bool Contains(uword addr) const; 181 bool Contains(uword addr) const;
189 bool Contains(uword addr, HeapPage::PageType type) const; 182 bool Contains(uword addr, HeapPage::PageType type) const;
190 bool IsValidAddress(uword addr) const { 183 bool IsValidAddress(uword addr) const {
191 return Contains(addr); 184 return Contains(addr);
192 } 185 }
193 static bool IsPageAllocatableSize(intptr_t size) {
194 return size <= kAllocatablePageSize;
195 }
196 186
197 void VisitObjects(ObjectVisitor* visitor) const; 187 void VisitObjects(ObjectVisitor* visitor) const;
198 void VisitObjectPointers(ObjectPointerVisitor* visitor) const; 188 void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
199 189
200 RawObject* FindObject(FindObjectVisitor* visitor, 190 RawObject* FindObject(FindObjectVisitor* visitor,
201 HeapPage::PageType type) const; 191 HeapPage::PageType type) const;
202 192
203 // Collect the garbage in the page space using mark-sweep. 193 // Collect the garbage in the page space using mark-sweep.
204 void MarkSweep(bool invoke_api_callbacks); 194 void MarkSweep(bool invoke_api_callbacks);
205 195
206 static HeapPage* PageFor(RawObject* raw_obj) {
207 return reinterpret_cast<HeapPage*>(
208 RawObject::ToAddr(raw_obj) & ~(kPageSize -1));
209 }
210
211 void StartEndAddress(uword* start, uword* end) const; 196 void StartEndAddress(uword* start, uword* end) const;
212 197
213 void SetGrowthControlState(bool state) { 198 void SetGrowthControlState(bool state) {
214 page_space_controller_.set_is_enabled(state); 199 page_space_controller_.set_is_enabled(state);
215 } 200 }
216 201
217 bool GrowthControlState() { 202 bool GrowthControlState() {
218 return page_space_controller_.is_enabled(); 203 return page_space_controller_.is_enabled();
219 } 204 }
220 205
(...skipping 17 matching lines...) Expand all
238 kResetFreeLists = 1, 223 kResetFreeLists = 1,
239 kSweepPages = 2, 224 kSweepPages = 2,
240 kSweepLargePages = 3, 225 kSweepLargePages = 3,
241 // Data 226 // Data
242 kGarbageRatio = 0, 227 kGarbageRatio = 0,
243 kGCTimeFraction = 1, 228 kGCTimeFraction = 1,
244 kPageGrowth = 2, 229 kPageGrowth = 2,
245 kAllowedGrowth = 3 230 kAllowedGrowth = 3
246 }; 231 };
247 232
248 static const intptr_t kAllocatablePageSize = kPageSize - sizeof(HeapPage); 233 static const intptr_t kAllocatablePageSize = 64 * KB;
249 234
250 HeapPage* AllocatePage(HeapPage::PageType type); 235 HeapPage* AllocatePage(HeapPage::PageType type);
251 void FreePage(HeapPage* page, HeapPage* previous_page); 236 void FreePage(HeapPage* page, HeapPage* previous_page);
252 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); 237 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type);
253 void FreeLargePage(HeapPage* page, HeapPage* previous_page); 238 void FreeLargePage(HeapPage* page, HeapPage* previous_page);
254 void FreePages(HeapPage* pages); 239 void FreePages(HeapPage* pages);
255 240
256 static intptr_t LargePageSizeFor(intptr_t size); 241 static intptr_t LargePageSizeFor(intptr_t size);
257 242
258 bool CanIncreaseCapacity(intptr_t increase) { 243 bool CanIncreaseCapacity(intptr_t increase) {
(...skipping 22 matching lines...) Expand all
281 PageSpaceController page_space_controller_; 266 PageSpaceController page_space_controller_;
282 267
283 friend class PageSpaceController; 268 friend class PageSpaceController;
284 269
285 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 270 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
286 }; 271 };
287 272
288 } // namespace dart 273 } // namespace dart
289 274
290 #endif // VM_PAGES_H_ 275 #endif // VM_PAGES_H_
OLDNEW
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698