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" |
11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/object_set.h" |
13 #include "vm/os_thread.h" | 14 #include "vm/os_thread.h" |
14 #include "vm/safepoint.h" | 15 #include "vm/safepoint.h" |
15 #include "vm/virtual_memory.h" | 16 #include "vm/virtual_memory.h" |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
18 | 19 |
19 DEFINE_FLAG(int, heap_growth_rate, 0, | 20 DEFINE_FLAG(int, heap_growth_rate, 0, |
20 "The max number of pages the heap can grow at a time"); | 21 "The max number of pages the heap can grow at a time"); |
21 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, | 22 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, |
22 "The desired maximum percentage of free space after old gen GC"); | 23 "The desired maximum percentage of free space after old gen GC"); |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 582 } |
582 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 583 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
583 if ((it.page()->type() == type) && it.page()->Contains(addr)) { | 584 if ((it.page()->type() == type) && it.page()->Contains(addr)) { |
584 return true; | 585 return true; |
585 } | 586 } |
586 } | 587 } |
587 return false; | 588 return false; |
588 } | 589 } |
589 | 590 |
590 | 591 |
591 void PageSpace::StartEndAddress(uword* start, uword* end) const { | 592 void PageSpace::AddRegionsToObjectSet(ObjectSet* set) const { |
592 ASSERT((pages_ != NULL) || (exec_pages_ != NULL) || (large_pages_ != NULL)); | 593 ASSERT((pages_ != NULL) || (exec_pages_ != NULL) || (large_pages_ != NULL)); |
593 *start = static_cast<uword>(~0); | |
594 *end = 0; | |
595 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 594 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
596 *start = Utils::Minimum(*start, it.page()->object_start()); | 595 set->AddRegion(it.page()->object_start(), it.page()->object_end()); |
597 *end = Utils::Maximum(*end, it.page()->object_end()); | |
598 } | 596 } |
599 ASSERT(*start != static_cast<uword>(~0)); | |
600 ASSERT(*end != 0); | |
601 } | 597 } |
602 | 598 |
603 | 599 |
604 void PageSpace::VisitObjects(ObjectVisitor* visitor) const { | 600 void PageSpace::VisitObjects(ObjectVisitor* visitor) const { |
605 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 601 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
606 it.page()->VisitObjects(visitor); | 602 it.page()->VisitObjects(visitor); |
607 } | 603 } |
608 } | 604 } |
609 | 605 |
610 | 606 |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 return 0; | 1216 return 0; |
1221 } else { | 1217 } else { |
1222 ASSERT(total_time >= gc_time); | 1218 ASSERT(total_time >= gc_time); |
1223 int result = static_cast<int>((static_cast<double>(gc_time) / | 1219 int result = static_cast<int>((static_cast<double>(gc_time) / |
1224 static_cast<double>(total_time)) * 100); | 1220 static_cast<double>(total_time)) * 100); |
1225 return result; | 1221 return result; |
1226 } | 1222 } |
1227 } | 1223 } |
1228 | 1224 |
1229 } // namespace dart | 1225 } // namespace dart |
OLD | NEW |