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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 604 } |
605 | 605 |
606 | 606 |
607 void PageSpace::VisitObjects(ObjectVisitor* visitor) const { | 607 void PageSpace::VisitObjects(ObjectVisitor* visitor) const { |
608 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 608 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
609 it.page()->VisitObjects(visitor); | 609 it.page()->VisitObjects(visitor); |
610 } | 610 } |
611 } | 611 } |
612 | 612 |
613 | 613 |
| 614 void PageSpace::VisitObjectsNoEmbedderPages(ObjectVisitor* visitor) const { |
| 615 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
| 616 if (!it.page()->embedder_allocated()) { |
| 617 it.page()->VisitObjects(visitor); |
| 618 } |
| 619 } |
| 620 } |
| 621 |
| 622 |
614 void PageSpace::VisitObjectPointers(ObjectPointerVisitor* visitor) const { | 623 void PageSpace::VisitObjectPointers(ObjectPointerVisitor* visitor) const { |
615 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 624 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
616 it.page()->VisitObjectPointers(visitor); | 625 it.page()->VisitObjectPointers(visitor); |
617 } | 626 } |
618 } | 627 } |
619 | 628 |
620 | 629 |
621 RawObject* PageSpace::FindObject(FindObjectVisitor* visitor, | 630 RawObject* PageSpace::FindObject(FindObjectVisitor* visitor, |
622 HeapPage::PageType type) const { | 631 HeapPage::PageType type) const { |
623 if (type == HeapPage::kExecutable) { | 632 if (type == HeapPage::kExecutable) { |
(...skipping 21 matching lines...) Expand all Loading... |
645 RawObject* obj = it.page()->FindObject(visitor); | 654 RawObject* obj = it.page()->FindObject(visitor); |
646 if (obj != Object::null()) { | 655 if (obj != Object::null()) { |
647 return obj; | 656 return obj; |
648 } | 657 } |
649 } | 658 } |
650 } | 659 } |
651 return Object::null(); | 660 return Object::null(); |
652 } | 661 } |
653 | 662 |
654 | 663 |
655 void PageSpace::WriteProtect(bool read_only, bool include_code_pages) { | 664 void PageSpace::WriteProtect(bool read_only) { |
656 if (read_only) { | 665 if (read_only) { |
657 // Avoid MakeIterable trying to write to the heap. | 666 // Avoid MakeIterable trying to write to the heap. |
658 AbandonBumpAllocation(); | 667 AbandonBumpAllocation(); |
659 } | 668 } |
660 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 669 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
661 HeapPage::PageType page_type = it.page()->type(); | 670 if (!it.page()->embedder_allocated()) { |
662 if ((page_type != HeapPage::kReadOnlyData) && | |
663 ((page_type != HeapPage::kExecutable) || include_code_pages)) { | |
664 it.page()->WriteProtect(read_only); | 671 it.page()->WriteProtect(read_only); |
665 } | 672 } |
666 } | 673 } |
667 } | 674 } |
668 | 675 |
669 | 676 |
670 void PageSpace::PrintToJSONObject(JSONObject* object) const { | 677 void PageSpace::PrintToJSONObject(JSONObject* object) const { |
671 if (!FLAG_support_service) { | 678 if (!FLAG_support_service) { |
672 return; | 679 return; |
673 } | 680 } |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 return 0; | 1237 return 0; |
1231 } else { | 1238 } else { |
1232 ASSERT(total_time >= gc_time); | 1239 ASSERT(total_time >= gc_time); |
1233 int result = static_cast<int>((static_cast<double>(gc_time) / | 1240 int result = static_cast<int>((static_cast<double>(gc_time) / |
1234 static_cast<double>(total_time)) * 100); | 1241 static_cast<double>(total_time)) * 100); |
1235 return result; | 1242 return result; |
1236 } | 1243 } |
1237 } | 1244 } |
1238 | 1245 |
1239 } // namespace dart | 1246 } // namespace dart |
OLD | NEW |