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

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) { tasks_ = val; }
koda 2014/08/26 23:34:49 ASSERT(tasks_ >= 0); Also consider just having in
Ivan Posva 2014/08/27 01:00:22 Done.
302
299 private: 303 private:
300 // Ids for time and data records in Heap::GCStats. 304 // Ids for time and data records in Heap::GCStats.
301 enum { 305 enum {
302 // Time 306 // Time
303 kMarkObjects = 0, 307 kMarkObjects = 0,
304 kResetFreeLists = 1, 308 kResetFreeLists = 1,
305 kSweepPages = 2, 309 kSweepPages = 2,
306 kSweepLargePages = 3, 310 kSweepLargePages = 3,
307 // Data 311 // Data
308 kGarbageRatio = 0, 312 kGarbageRatio = 0,
309 kGCTimeFraction = 1, 313 kGCTimeFraction = 1,
310 kPageGrowth = 2, 314 kPageGrowth = 2,
311 kAllowedGrowth = 3 315 kAllowedGrowth = 3
312 }; 316 };
313 317
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; 318 static const intptr_t kAllocatablePageSize = 64 * KB;
319 319
320 uword TryAllocateInternal(intptr_t size, 320 uword TryAllocateInternal(intptr_t size,
321 HeapPage::PageType type, 321 HeapPage::PageType type,
322 GrowthPolicy growth_policy, 322 GrowthPolicy growth_policy,
323 bool is_protected, 323 bool is_protected,
324 bool is_locked); 324 bool is_locked);
325 HeapPage* AllocatePage(HeapPage::PageType type); 325 HeapPage* AllocatePage(HeapPage::PageType type);
326 void FreePage(HeapPage* page, HeapPage* previous_page); 326 void FreePage(HeapPage* page, HeapPage* previous_page);
327 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type); 327 HeapPage* AllocateLargePage(intptr_t size, HeapPage::PageType type);
328 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes); 328 void TruncateLargePage(HeapPage* page, intptr_t new_object_size_in_bytes);
329 void FreeLargePage(HeapPage* page, HeapPage* previous_page); 329 void FreeLargePage(HeapPage* page, HeapPage* previous_page);
330 void FreePages(HeapPage* pages); 330 void FreePages(HeapPage* pages);
331 HeapPage* NextPageAnySize(HeapPage* page) const { 331 HeapPage* NextPageAnySize(HeapPage* page) const {
332 ASSERT(pages_tail_ == NULL || pages_tail_->next() == NULL); 332 ASSERT((pages_tail_ == NULL) || (pages_tail_->next() == NULL));
333 return page == pages_tail_ ? large_pages_ : page->next(); 333 ASSERT((exec_pages_tail_ == NULL) || (exec_pages_tail_->next() == NULL));
334 if (page == pages_tail_) {
335 return (exec_pages_ != NULL) ? exec_pages_ : large_pages_;
336 }
337 return page == exec_pages_tail_ ? large_pages_ : page->next();
334 } 338 }
335 339
336 static intptr_t LargePageSizeInWordsFor(intptr_t size); 340 static intptr_t LargePageSizeInWordsFor(intptr_t size);
337 341
338 bool CanIncreaseCapacityInWords(intptr_t increase_in_words) { 342 bool CanIncreaseCapacityInWords(intptr_t increase_in_words) {
339 ASSERT(CapacityInWords() <= max_capacity_in_words_); 343 ASSERT(CapacityInWords() <= max_capacity_in_words_);
340 return increase_in_words <= (max_capacity_in_words_ - CapacityInWords()); 344 return increase_in_words <= (max_capacity_in_words_ - CapacityInWords());
341 } 345 }
342 346
343 FreeList freelist_[HeapPage::kNumPageTypes]; 347 FreeList freelist_[HeapPage::kNumPageTypes];
344 348
345 Heap* heap_; 349 Heap* heap_;
346 350
351 Mutex* pages_lock_;
347 HeapPage* pages_; 352 HeapPage* pages_;
348 HeapPage* pages_tail_; 353 HeapPage* pages_tail_;
354 HeapPage* exec_pages_;
355 HeapPage* exec_pages_tail_;
349 HeapPage* large_pages_; 356 HeapPage* large_pages_;
koda 2014/08/26 23:34:49 Can large pages be executable?
Ivan Posva 2014/08/27 01:00:22 Yes, large pages survive as a mixed class list.
350 357
351 // Various sizes being tracked for this generation. 358 // Various sizes being tracked for this generation.
352 intptr_t max_capacity_in_words_; 359 intptr_t max_capacity_in_words_;
353 SpaceUsage usage_; 360 SpaceUsage usage_;
354 361
355 // Keep track of running MarkSweep tasks. 362 // Keep track of running MarkSweep tasks.
356 Monitor* tasks_lock_; 363 Monitor* tasks_lock_;
357 intptr_t tasks_; 364 intptr_t tasks_;
358 365
359 PageSpaceController page_space_controller_; 366 PageSpaceController page_space_controller_;
360 367
361 int64_t gc_time_micros_; 368 int64_t gc_time_micros_;
362 intptr_t collections_; 369 intptr_t collections_;
363 370
364 friend class PageSpaceController; 371 friend class PageSpaceController;
372 friend class SweeperTask;
365 373
366 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace); 374 DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
367 }; 375 };
368 376
369 } // namespace dart 377 } // namespace dart
370 378
371 #endif // VM_PAGES_H_ 379 #endif // VM_PAGES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698