| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 class ScavengerVisitor : public ObjectPointerVisitor { | 66 class ScavengerVisitor : public ObjectPointerVisitor { |
| 67 public: | 67 public: |
| 68 explicit ScavengerVisitor(Isolate* isolate, | 68 explicit ScavengerVisitor(Isolate* isolate, |
| 69 Scavenger* scavenger, | 69 Scavenger* scavenger, |
| 70 SemiSpace* from) | 70 SemiSpace* from) |
| 71 : ObjectPointerVisitor(isolate), | 71 : ObjectPointerVisitor(isolate), |
| 72 thread_(Thread::Current()), | 72 thread_(Thread::Current()), |
| 73 scavenger_(scavenger), | 73 scavenger_(scavenger), |
| 74 from_(from), | 74 from_(from), |
| 75 heap_(scavenger->heap_), | 75 heap_(scavenger->heap_), |
| 76 vm_heap_(Dart::vm_isolate()->heap()), | |
| 77 page_space_(scavenger->heap_->old_space()), | 76 page_space_(scavenger->heap_->old_space()), |
| 78 bytes_promoted_(0), | 77 bytes_promoted_(0), |
| 79 visiting_old_object_(NULL) {} | 78 visiting_old_object_(NULL) {} |
| 80 | 79 |
| 81 void VisitPointers(RawObject** first, RawObject** last) { | 80 void VisitPointers(RawObject** first, RawObject** last) { |
| 82 if (FLAG_verify_gc_contains) { | 81 if (FLAG_verify_gc_contains) { |
| 83 ASSERT((visiting_old_object_ != NULL) || | 82 ASSERT((visiting_old_object_ != NULL) || |
| 84 scavenger_->Contains(reinterpret_cast<uword>(first)) || | 83 scavenger_->Contains(reinterpret_cast<uword>(first)) || |
| 85 !heap_->Contains(reinterpret_cast<uword>(first))); | 84 !heap_->Contains(reinterpret_cast<uword>(first))); |
| 86 } | 85 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Update the store buffer as needed. | 176 // Update the store buffer as needed. |
| 178 if (visiting_old_object_ != NULL) { | 177 if (visiting_old_object_ != NULL) { |
| 179 UpdateStoreBuffer(p, new_obj); | 178 UpdateStoreBuffer(p, new_obj); |
| 180 } | 179 } |
| 181 } | 180 } |
| 182 | 181 |
| 183 Thread* thread_; | 182 Thread* thread_; |
| 184 Scavenger* scavenger_; | 183 Scavenger* scavenger_; |
| 185 SemiSpace* from_; | 184 SemiSpace* from_; |
| 186 Heap* heap_; | 185 Heap* heap_; |
| 187 Heap* vm_heap_; | |
| 188 PageSpace* page_space_; | 186 PageSpace* page_space_; |
| 189 RawWeakProperty* delayed_weak_properties_; | 187 RawWeakProperty* delayed_weak_properties_; |
| 190 intptr_t bytes_promoted_; | 188 intptr_t bytes_promoted_; |
| 191 RawObject* visiting_old_object_; | 189 RawObject* visiting_old_object_; |
| 192 | 190 |
| 193 friend class Scavenger; | 191 friend class Scavenger; |
| 194 | 192 |
| 195 DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor); | 193 DISALLOW_COPY_AND_ASSIGN(ScavengerVisitor); |
| 196 }; | 194 }; |
| 197 | 195 |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 // Forces the next scavenge to promote all the objects in the new space. | 920 // Forces the next scavenge to promote all the objects in the new space. |
| 923 survivor_end_ = top_; | 921 survivor_end_ = top_; |
| 924 Scavenge(); | 922 Scavenge(); |
| 925 | 923 |
| 926 // It is possible for objects to stay in the new space | 924 // It is possible for objects to stay in the new space |
| 927 // if the VM cannot create more pages for these objects. | 925 // if the VM cannot create more pages for these objects. |
| 928 ASSERT((UsedInWords() == 0) || failed_to_promote_); | 926 ASSERT((UsedInWords() == 0) || failed_to_promote_); |
| 929 } | 927 } |
| 930 | 928 |
| 931 } // namespace dart | 929 } // namespace dart |
| OLD | NEW |