OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/scavenger.h" | 5 #include "vm/scavenger.h" |
6 | 6 |
7 #include "vm/dart.h" | 7 #include "vm/dart.h" |
8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 #include "vm/object_set.h" |
12 #include "vm/object_id_ring.h" | 13 #include "vm/object_id_ring.h" |
13 #include "vm/safepoint.h" | 14 #include "vm/safepoint.h" |
14 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
15 #include "vm/store_buffer.h" | 16 #include "vm/store_buffer.h" |
16 #include "vm/thread_registry.h" | 17 #include "vm/thread_registry.h" |
17 #include "vm/timeline.h" | 18 #include "vm/timeline.h" |
18 #include "vm/verifier.h" | 19 #include "vm/verifier.h" |
19 #include "vm/visitor.h" | 20 #include "vm/visitor.h" |
20 #include "vm/weak_table.h" | 21 #include "vm/weak_table.h" |
21 | 22 |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 void Scavenger::VisitObjects(ObjectVisitor* visitor) const { | 739 void Scavenger::VisitObjects(ObjectVisitor* visitor) const { |
739 uword cur = FirstObjectStart(); | 740 uword cur = FirstObjectStart(); |
740 while (cur < top_) { | 741 while (cur < top_) { |
741 RawObject* raw_obj = RawObject::FromAddr(cur); | 742 RawObject* raw_obj = RawObject::FromAddr(cur); |
742 visitor->VisitObject(raw_obj); | 743 visitor->VisitObject(raw_obj); |
743 cur += raw_obj->Size(); | 744 cur += raw_obj->Size(); |
744 } | 745 } |
745 } | 746 } |
746 | 747 |
747 | 748 |
| 749 void Scavenger::AddRegionsToObjectSet(ObjectSet* set) const { |
| 750 set->AddRegion(to_->start(), to_->end()); |
| 751 } |
| 752 |
| 753 |
748 RawObject* Scavenger::FindObject(FindObjectVisitor* visitor) const { | 754 RawObject* Scavenger::FindObject(FindObjectVisitor* visitor) const { |
749 ASSERT(!scavenging_); | 755 ASSERT(!scavenging_); |
750 uword cur = FirstObjectStart(); | 756 uword cur = FirstObjectStart(); |
751 if (visitor->VisitRange(cur, top_)) { | 757 if (visitor->VisitRange(cur, top_)) { |
752 while (cur < top_) { | 758 while (cur < top_) { |
753 RawObject* raw_obj = RawObject::FromAddr(cur); | 759 RawObject* raw_obj = RawObject::FromAddr(cur); |
754 uword next = cur + raw_obj->Size(); | 760 uword next = cur + raw_obj->Size(); |
755 if (visitor->VisitRange(cur, next) && raw_obj->FindObject(visitor)) { | 761 if (visitor->VisitRange(cur, next) && raw_obj->FindObject(visitor)) { |
756 return raw_obj; // Found object, return it. | 762 return raw_obj; // Found object, return it. |
757 } | 763 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 } | 903 } |
898 | 904 |
899 | 905 |
900 void Scavenger::FreeExternal(intptr_t size) { | 906 void Scavenger::FreeExternal(intptr_t size) { |
901 ASSERT(size >= 0); | 907 ASSERT(size >= 0); |
902 external_size_ -= size; | 908 external_size_ -= size; |
903 ASSERT(external_size_ >= 0); | 909 ASSERT(external_size_ >= 0); |
904 } | 910 } |
905 | 911 |
906 } // namespace dart | 912 } // namespace dart |
OLD | NEW |