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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 void PageSpace::AbandonBumpAllocation() { | 528 void PageSpace::AbandonBumpAllocation() { |
529 if (bump_top_ < bump_end_) { | 529 if (bump_top_ < bump_end_) { |
530 freelist_[HeapPage::kData].Free(bump_top_, bump_end_ - bump_top_); | 530 freelist_[HeapPage::kData].Free(bump_top_, bump_end_ - bump_top_); |
531 bump_top_ = 0; | 531 bump_top_ = 0; |
532 bump_end_ = 0; | 532 bump_end_ = 0; |
533 } | 533 } |
534 } | 534 } |
535 | 535 |
536 | 536 |
537 void PageSpace::UpdateMaxCapacityLocked() { | 537 void PageSpace::UpdateMaxCapacityLocked() { |
| 538 if (heap_ == NULL) { |
| 539 // Some unit tests. |
| 540 return; |
| 541 } |
538 ASSERT(heap_ != NULL); | 542 ASSERT(heap_ != NULL); |
539 ASSERT(heap_->isolate() != NULL); | 543 ASSERT(heap_->isolate() != NULL); |
540 Isolate* isolate = heap_->isolate(); | 544 Isolate* isolate = heap_->isolate(); |
541 isolate->GetHeapOldCapacityMaxMetric()->SetValue( | 545 isolate->GetHeapOldCapacityMaxMetric()->SetValue( |
542 static_cast<int64_t>(usage_.capacity_in_words) * kWordSize); | 546 static_cast<int64_t>(usage_.capacity_in_words) * kWordSize); |
543 } | 547 } |
544 | 548 |
545 | 549 |
546 bool PageSpace::Contains(uword addr) const { | 550 bool PageSpace::Contains(uword addr) const { |
547 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 551 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 return 0; | 1194 return 0; |
1191 } else { | 1195 } else { |
1192 ASSERT(total_time >= gc_time); | 1196 ASSERT(total_time >= gc_time); |
1193 int result = static_cast<int>((static_cast<double>(gc_time) / | 1197 int result = static_cast<int>((static_cast<double>(gc_time) / |
1194 static_cast<double>(total_time)) * 100); | 1198 static_cast<double>(total_time)) * 100); |
1195 return result; | 1199 return result; |
1196 } | 1200 } |
1197 } | 1201 } |
1198 | 1202 |
1199 } // namespace dart | 1203 } // namespace dart |
OLD | NEW |