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

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

Issue 480343003: - Address review comments from https://codereview.chromium.org/474913004/ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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/message_handler.cc ('k') | runtime/vm/snapshot.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/pages.h" 5 #include "vm/pages.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/compiler_stats.h" 8 #include "vm/compiler_stats.h"
9 #include "vm/gc_marker.h" 9 #include "vm/gc_marker.h"
10 #include "vm/gc_sweeper.h" 10 #include "vm/gc_sweeper.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 FLAG_heap_growth_rate, 132 FLAG_heap_growth_rate,
133 FLAG_heap_growth_time_ratio), 133 FLAG_heap_growth_time_ratio),
134 gc_time_micros_(0), 134 gc_time_micros_(0),
135 collections_(0) { 135 collections_(0) {
136 } 136 }
137 137
138 138
139 PageSpace::~PageSpace() { 139 PageSpace::~PageSpace() {
140 { 140 {
141 MonitorLocker ml(tasks_lock()); 141 MonitorLocker ml(tasks_lock());
142 ASSERT(tasks() == 0); 142 while (tasks() > 0) {
143 ml.Wait();
144 }
143 } 145 }
144 FreePages(pages_); 146 FreePages(pages_);
145 FreePages(large_pages_); 147 FreePages(large_pages_);
146 delete tasks_lock_; 148 delete tasks_lock_;
147 } 149 }
148 150
149 151
150 intptr_t PageSpace::LargePageSizeInWordsFor(intptr_t size) { 152 intptr_t PageSpace::LargePageSizeInWordsFor(intptr_t size) {
151 intptr_t page_size = Utils::RoundUp(size + HeapPage::ObjectStartOffset(), 153 intptr_t page_size = Utils::RoundUp(size + HeapPage::ObjectStartOffset(),
152 VirtualMemory::PageSize()); 154 VirtualMemory::PageSize());
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 517 }
516 518
517 519
518 void PageSpace::MarkSweep(bool invoke_api_callbacks) { 520 void PageSpace::MarkSweep(bool invoke_api_callbacks) {
519 Isolate* isolate = heap_->isolate(); 521 Isolate* isolate = heap_->isolate();
520 ASSERT(isolate == Isolate::Current()); 522 ASSERT(isolate == Isolate::Current());
521 523
522 // Wait for pending tasks to complete and then account for the driver task. 524 // Wait for pending tasks to complete and then account for the driver task.
523 { 525 {
524 MonitorLocker locker(tasks_lock()); 526 MonitorLocker locker(tasks_lock());
525 while (tasks() != 0) { 527 while (tasks() > 0) {
526 locker.Wait(); 528 locker.Wait();
527 } 529 }
528 set_tasks(1); 530 set_tasks(1);
529 } 531 }
530 532
531 NoHandleScope no_handles(isolate); 533 NoHandleScope no_handles(isolate);
532 534
533 if (FLAG_print_free_list_before_gc) { 535 if (FLAG_print_free_list_before_gc) {
534 OS::Print("Data Freelist (before GC):\n"); 536 OS::Print("Data Freelist (before GC):\n");
535 freelist_[HeapPage::kData].Print(); 537 freelist_[HeapPage::kData].Print();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 631 }
630 632
631 if (FLAG_verify_after_gc) { 633 if (FLAG_verify_after_gc) {
632 OS::PrintErr("Verifying after MarkSweep..."); 634 OS::PrintErr("Verifying after MarkSweep...");
633 heap_->Verify(); 635 heap_->Verify();
634 OS::PrintErr(" done.\n"); 636 OS::PrintErr(" done.\n");
635 } 637 }
636 638
637 // Done, reset the task count. 639 // Done, reset the task count.
638 { 640 {
639 MonitorLocker locker(tasks_lock()); 641 MonitorLocker ml(tasks_lock());
640 ASSERT(tasks() == 1); 642 ASSERT(tasks() == 1);
641 set_tasks(tasks() - 1); 643 set_tasks(tasks() - 1);
644 ml.Notify();
642 } 645 }
643 } 646 }
644 647
645 648
646 PageSpaceController::PageSpaceController(Heap* heap, 649 PageSpaceController::PageSpaceController(Heap* heap,
647 int heap_growth_ratio, 650 int heap_growth_ratio,
648 int heap_growth_max, 651 int heap_growth_max,
649 int garbage_collection_time_ratio) 652 int garbage_collection_time_ratio)
650 : heap_(heap), 653 : heap_(heap),
651 is_enabled_(false), 654 is_enabled_(false),
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 return 0; 760 return 0;
758 } else { 761 } else {
759 ASSERT(total_time >= gc_time); 762 ASSERT(total_time >= gc_time);
760 int result= static_cast<int>((static_cast<double>(gc_time) / 763 int result= static_cast<int>((static_cast<double>(gc_time) /
761 static_cast<double>(total_time)) * 100); 764 static_cast<double>(total_time)) * 100);
762 return result; 765 return result;
763 } 766 }
764 } 767 }
765 768
766 } // namespace dart 769 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698