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

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

Issue 503363005: - Add and enable concurrent sweeper. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/ring_buffer.h" 10 #include "vm/ring_buffer.h"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 uword TryAllocateDataLocked(intptr_t size, GrowthPolicy growth_policy) { 290 uword TryAllocateDataLocked(intptr_t size, GrowthPolicy growth_policy) {
291 bool is_protected = false; 291 bool is_protected = false;
292 bool is_locked = true; 292 bool is_locked = true;
293 return TryAllocateInternal(size, 293 return TryAllocateInternal(size,
294 HeapPage::kData, 294 HeapPage::kData,
295 growth_policy, 295 growth_policy,
296 is_protected, is_locked); 296 is_protected, is_locked);
297 } 297 }
298 298
299 Monitor* tasks_lock() const { return tasks_lock_; }
300 intptr_t tasks() const { return tasks_; }
301 void set_tasks(intptr_t val) {
302 ASSERT(val >= 0);
303 tasks_ = val;
304 }
305
299 private: 306 private:
300 // Ids for time and data records in Heap::GCStats. 307 // Ids for time and data records in Heap::GCStats.
301 enum { 308 enum {
302 // Time 309 // Time
303 kMarkObjects = 0, 310 kMarkObjects = 0,
304 kResetFreeLists = 1, 311 kResetFreeLists = 1,
305 kSweepPages = 2, 312 kSweepPages = 2,
306 kSweepLargePages = 3, 313 kSweepLargePages = 3,
307 // Data 314 // Data
308 kGarbageRatio = 0, 315 kGarbageRatio = 0,
309 kGCTimeFraction = 1, 316 kGCTimeFraction = 1,
310 kPageGrowth = 2, 317 kPageGrowth = 2,
311 kAllowedGrowth = 3 318 kAllowedGrowth = 3
312 }; 319 };
313 320
314 Monitor* tasks_lock() const { return tasks_lock_; }
315 intptr_t tasks() const { return tasks_; }
316 void set_tasks(intptr_t val) { tasks_ = val; }
317
318 static const intptr_t kAllocatablePageSize = 64 * KB; 321 static const intptr_t kAllocatablePageSize = 64 * KB;
319 322
320 uword TryAllocateInternal(intptr_t size, 323 uword TryAllocateInternal(intptr_t size,
321 HeapPage::PageType type, 324 HeapPage::PageType type,
322 GrowthPolicy growth_policy, 325 GrowthPolicy growth_policy,
323 bool is_protected, 326 bool is_protected,
324 bool is_locked); 327 bool is_locked);
325 HeapPage* AllocatePage(HeapPage::PageType type); 328 HeapPage* AllocatePage(HeapPage::PageType type);
326 void FreePage(HeapPage* page, HeapPage* previous_page); 329 void FreePage(HeapPage* page, HeapPage* previous_page);
327 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); 330 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type);
328 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes); 331 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes);
329 void FreeLargePage(HeapPage* page, HeapPage* previous_page); 332 void FreeLargePage(HeapPage* page, HeapPage* previous_page);
330 void FreePages(HeapPage* pages); 333 void FreePages(HeapPage* pages);
331 HeapPage* NextPageAnySize(HeapPage* page) const { 334 HeapPage* NextPageAnySize(HeapPage* page) const {
332 ASSERT(pages_tail_ == NULL || pages_tail_->next() == NULL); 335 ASSERT((pages_tail_ == NULL) || (pages_tail_->next() == NULL));
333 return page == pages_tail_ ? large_pages_ : page->next(); 336 ASSERT((exec_pages_tail_ == NULL) || (exec_pages_tail_->next() == NULL));
337 if (page == pages_tail_) {
338 return (exec_pages_ != NULL) ? exec_pages_ : large_pages_;
339 }
340 return page == exec_pages_tail_ ? large_pages_ : page->next();
334 } 341 }
335 342
336 static intptr_t LargePageSizeInWordsFor(intptr_t size); 343 static intptr_t LargePageSizeInWordsFor(intptr_t size);
337 344
338 bool CanIncreaseCapacityInWords(intptr_t increase_in_words) { 345 bool CanIncreaseCapacityInWords(intptr_t increase_in_words) {
339 ASSERT(CapacityInWords() <= max_capacity_in_words_); 346 ASSERT(CapacityInWords() <= max_capacity_in_words_);
340 return increase_in_words <= (max_capacity_in_words_ - CapacityInWords()); 347 return increase_in_words <= (max_capacity_in_words_ - CapacityInWords());
341 } 348 }
342 349
343 FreeList freelist_[HeapPage::kNumPageTypes]; 350 FreeList freelist_[HeapPage::kNumPageTypes];
344 351
345 Heap* heap_; 352 Heap* heap_;
346 353
354 Mutex* pages_lock_;
347 HeapPage* pages_; 355 HeapPage* pages_;
348 HeapPage* pages_tail_; 356 HeapPage* pages_tail_;
357 HeapPage* exec_pages_;
358 HeapPage* exec_pages_tail_;
349 HeapPage* large_pages_; 359 HeapPage* large_pages_;
350 360
351 // Various sizes being tracked for this generation. 361 // Various sizes being tracked for this generation.
352 intptr_t max_capacity_in_words_; 362 intptr_t max_capacity_in_words_;
353 SpaceUsage usage_; 363 SpaceUsage usage_;
354 364
355 // Keep track of running MarkSweep tasks. 365 // Keep track of running MarkSweep tasks.
356 Monitor* tasks_lock_; 366 Monitor* tasks_lock_;
357 intptr_t tasks_; 367 intptr_t tasks_;
358 368
359 PageSpaceController page_space_controller_; 369 PageSpaceController page_space_controller_;
360 370
361 int64_t gc_time_micros_; 371 int64_t gc_time_micros_;
362 intptr_t collections_; 372 intptr_t collections_;
363 373
364 friend class PageSpaceController; 374 friend class PageSpaceController;
375 friend class SweeperTask;
365 376
366 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 377 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
367 }; 378 };
368 379
369 } // namespace dart 380 } // namespace dart
370 381
371 #endif // VM_PAGES_H_ 382 #endif // VM_PAGES_H_
OLDNEW
« runtime/vm/heap.cc ('K') | « runtime/vm/metrics.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698