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

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

Issue 265773011: De-duplicate code by adding size-independent iteration. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | « no previous file | 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 "vm/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/ring_buffer.h" 10 #include "vm/ring_buffer.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 kAllowedGrowth = 3 289 kAllowedGrowth = 3
290 }; 290 };
291 291
292 static const intptr_t kAllocatablePageSize = 64 * KB; 292 static const intptr_t kAllocatablePageSize = 64 * KB;
293 293
294 HeapPage* AllocatePage(HeapPage::PageType type); 294 HeapPage* AllocatePage(HeapPage::PageType type);
295 void FreePage(HeapPage* page, HeapPage* previous_page); 295 void FreePage(HeapPage* page, HeapPage* previous_page);
296 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); 296 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type);
297 void FreeLargePage(HeapPage* page, HeapPage* previous_page); 297 void FreeLargePage(HeapPage* page, HeapPage* previous_page);
298 void FreePages(HeapPage* pages); 298 void FreePages(HeapPage* pages);
299 HeapPage* NextPageAnySize(HeapPage* page) const {
300 ASSERT(pages_tail_ == NULL || pages_tail_->next() == NULL);
301 return page == pages_tail_ ? large_pages_ : page->next();
302 }
299 303
300 static intptr_t LargePageSizeInWordsFor(intptr_t size); 304 static intptr_t LargePageSizeInWordsFor(intptr_t size);
301 305
302 bool CanIncreaseCapacityInWords(intptr_t increase_in_words) { 306 bool CanIncreaseCapacityInWords(intptr_t increase_in_words) {
303 ASSERT(CapacityInWords() <= max_capacity_in_words_); 307 ASSERT(CapacityInWords() <= max_capacity_in_words_);
304 return increase_in_words <= (max_capacity_in_words_ - CapacityInWords()); 308 return increase_in_words <= (max_capacity_in_words_ - CapacityInWords());
305 } 309 }
306 310
307 FreeList freelist_[HeapPage::kNumPageTypes]; 311 FreeList freelist_[HeapPage::kNumPageTypes];
308 312
(...skipping 16 matching lines...) Expand all
325 intptr_t collections_; 329 intptr_t collections_;
326 330
327 friend class PageSpaceController; 331 friend class PageSpaceController;
328 332
329 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 333 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
330 }; 334 };
331 335
332 } // namespace dart 336 } // namespace dart
333 337
334 #endif // VM_PAGES_H_ 338 #endif // VM_PAGES_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698