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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 tasks_(0), | 162 tasks_(0), |
163 #if defined(DEBUG) | 163 #if defined(DEBUG) |
164 iterating_thread_(NULL), | 164 iterating_thread_(NULL), |
165 #endif | 165 #endif |
166 page_space_controller_(heap, | 166 page_space_controller_(heap, |
167 FLAG_old_gen_growth_space_ratio, | 167 FLAG_old_gen_growth_space_ratio, |
168 FLAG_old_gen_growth_rate, | 168 FLAG_old_gen_growth_rate, |
169 FLAG_old_gen_growth_time_ratio), | 169 FLAG_old_gen_growth_time_ratio), |
170 gc_time_micros_(0), | 170 gc_time_micros_(0), |
171 collections_(0) { | 171 collections_(0) { |
| 172 // We aren't holding the lock but no one can reference us yet. |
| 173 UpdateMaxCapacityLocked(); |
172 } | 174 } |
173 | 175 |
174 | 176 |
175 PageSpace::~PageSpace() { | 177 PageSpace::~PageSpace() { |
176 { | 178 { |
177 MonitorLocker ml(tasks_lock()); | 179 MonitorLocker ml(tasks_lock()); |
178 while (tasks() > 0) { | 180 while (tasks() > 0) { |
179 ml.Wait(); | 181 ml.Wait(); |
180 } | 182 } |
181 } | 183 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 527 |
526 void PageSpace::AbandonBumpAllocation() { | 528 void PageSpace::AbandonBumpAllocation() { |
527 if (bump_top_ < bump_end_) { | 529 if (bump_top_ < bump_end_) { |
528 freelist_[HeapPage::kData].Free(bump_top_, bump_end_ - bump_top_); | 530 freelist_[HeapPage::kData].Free(bump_top_, bump_end_ - bump_top_); |
529 bump_top_ = 0; | 531 bump_top_ = 0; |
530 bump_end_ = 0; | 532 bump_end_ = 0; |
531 } | 533 } |
532 } | 534 } |
533 | 535 |
534 | 536 |
| 537 void PageSpace::UpdateMaxCapacityLocked() { |
| 538 ASSERT(heap_ != NULL); |
| 539 ASSERT(heap_->isolate() != NULL); |
| 540 Isolate* isolate = heap_->isolate(); |
| 541 isolate->GetHeapOldCapacityMaxMetric()->SetValue( |
| 542 static_cast<int64_t>(usage_.capacity_in_words) * kWordSize); |
| 543 } |
| 544 |
| 545 |
535 bool PageSpace::Contains(uword addr) const { | 546 bool PageSpace::Contains(uword addr) const { |
536 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 547 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
537 if (it.page()->Contains(addr)) { | 548 if (it.page()->Contains(addr)) { |
538 return true; | 549 return true; |
539 } | 550 } |
540 } | 551 } |
541 return false; | 552 return false; |
542 } | 553 } |
543 | 554 |
544 | 555 |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 return 0; | 1190 return 0; |
1180 } else { | 1191 } else { |
1181 ASSERT(total_time >= gc_time); | 1192 ASSERT(total_time >= gc_time); |
1182 int result = static_cast<int>((static_cast<double>(gc_time) / | 1193 int result = static_cast<int>((static_cast<double>(gc_time) / |
1183 static_cast<double>(total_time)) * 100); | 1194 static_cast<double>(total_time)) * 100); |
1184 return result; | 1195 return result; |
1185 } | 1196 } |
1186 } | 1197 } |
1187 | 1198 |
1188 } // namespace dart | 1199 } // namespace dart |
OLD | NEW |