| OLD | NEW |
| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 after_total_in_words / desired_utilization_); | 696 after_total_in_words / desired_utilization_); |
| 697 intptr_t capacity_growth_in_words = | 697 intptr_t capacity_growth_in_words = |
| 698 Utils::RoundUp(Utils::Maximum(static_cast<intptr_t>(0), | 698 Utils::RoundUp(Utils::Maximum(static_cast<intptr_t>(0), |
| 699 used_target - after.capacity_in_words), | 699 used_target - after.capacity_in_words), |
| 700 PageSpace::kPageSizeInWords); | 700 PageSpace::kPageSizeInWords); |
| 701 int capacity_growth_in_pages = | 701 int capacity_growth_in_pages = |
| 702 capacity_growth_in_words / PageSpace::kPageSizeInWords; | 702 capacity_growth_in_words / PageSpace::kPageSizeInWords; |
| 703 grow_heap_ = Utils::Maximum(capacity_growth_in_pages, heap_growth_rate_); | 703 grow_heap_ = Utils::Maximum(capacity_growth_in_pages, heap_growth_rate_); |
| 704 heap->RecordData(PageSpace::kPageGrowth, capacity_growth_in_pages); | 704 heap->RecordData(PageSpace::kPageGrowth, capacity_growth_in_pages); |
| 705 } | 705 } |
| 706 // Limit shrinkage: allow growth by at least half the pages freed by GC. |
| 707 intptr_t freed_pages = |
| 708 (before.capacity_in_words - after.capacity_in_words) / |
| 709 PageSpace::kPageSizeInWords; |
| 710 grow_heap_ = Utils::Maximum(grow_heap_, freed_pages / 2); |
| 706 heap->RecordData(PageSpace::kGarbageRatio, collected_garbage_ratio); | 711 heap->RecordData(PageSpace::kGarbageRatio, collected_garbage_ratio); |
| 707 heap->RecordData(PageSpace::kGCTimeFraction, | 712 heap->RecordData(PageSpace::kGCTimeFraction, |
| 708 garbage_collection_time_fraction); | 713 garbage_collection_time_fraction); |
| 709 heap->RecordData(PageSpace::kAllowedGrowth, grow_heap_); | 714 heap->RecordData(PageSpace::kAllowedGrowth, grow_heap_); |
| 710 last_usage_ = after; | 715 last_usage_ = after; |
| 711 } | 716 } |
| 712 | 717 |
| 713 | 718 |
| 714 PageSpaceGarbageCollectionHistory::PageSpaceGarbageCollectionHistory() | 719 PageSpaceGarbageCollectionHistory::PageSpaceGarbageCollectionHistory() |
| 715 : index_(0) { | 720 : index_(0) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 return 0; | 753 return 0; |
| 749 } else { | 754 } else { |
| 750 ASSERT(total_time >= gc_time); | 755 ASSERT(total_time >= gc_time); |
| 751 int result= static_cast<int>((static_cast<double>(gc_time) / | 756 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 752 static_cast<double>(total_time)) * 100); | 757 static_cast<double>(total_time)) * 100); |
| 753 return result; | 758 return result; |
| 754 } | 759 } |
| 755 } | 760 } |
| 756 | 761 |
| 757 } // namespace dart | 762 } // namespace dart |
| OLD | NEW |