| 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/gc_marker.h" | 5 #include "vm/gc_marker.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // Visit all elements with a key equal to raw_obj. | 180 // Visit all elements with a key equal to raw_obj. |
| 181 ret = delay_set_.equal_range(raw_obj); | 181 ret = delay_set_.equal_range(raw_obj); |
| 182 for (DelaySet::iterator it = ret.first; it != ret.second; ++it) { | 182 for (DelaySet::iterator it = ret.first; it != ret.second; ++it) { |
| 183 it->second->VisitPointers(this); | 183 it->second->VisitPointers(this); |
| 184 } | 184 } |
| 185 delay_set_.erase(ret.first, ret.second); | 185 delay_set_.erase(ret.first, ret.second); |
| 186 raw_obj->ClearWatchedBit(); | 186 raw_obj->ClearWatchedBit(); |
| 187 } | 187 } |
| 188 marking_stack_->Push(raw_obj); | 188 marking_stack_->Push(raw_obj); |
| 189 | 189 |
| 190 // Update the number of used bytes on this page for fast accounting. | |
| 191 HeapPage* page = PageSpace::PageFor(raw_obj); | |
| 192 page->AddUsed(raw_obj->Size()); | |
| 193 | |
| 194 // TODO(iposva): Should we mark the classes early? | 190 // TODO(iposva): Should we mark the classes early? |
| 195 MarkObject(raw_class, NULL); | 191 MarkObject(raw_class, NULL); |
| 196 } | 192 } |
| 197 | 193 |
| 198 void MarkObject(RawObject* raw_obj, RawObject** p) { | 194 void MarkObject(RawObject* raw_obj, RawObject** p) { |
| 199 // Fast exit if the raw object is a Smi. | 195 // Fast exit if the raw object is a Smi. |
| 200 if (!raw_obj->IsHeapObject()) return; | 196 if (!raw_obj->IsHeapObject()) return; |
| 201 | 197 |
| 202 // Fast exit if the raw object is marked. | 198 // Fast exit if the raw object is marked. |
| 203 if (raw_obj->IsMarked()) return; | 199 if (raw_obj->IsMarked()) return; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 DrainMarkingStack(isolate, &mark); | 405 DrainMarkingStack(isolate, &mark); |
| 410 IterateWeakReferences(isolate, &mark); | 406 IterateWeakReferences(isolate, &mark); |
| 411 MarkingWeakVisitor mark_weak; | 407 MarkingWeakVisitor mark_weak; |
| 412 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 408 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 413 mark.Finalize(); | 409 mark.Finalize(); |
| 414 ProcessPeerReferents(page_space); | 410 ProcessPeerReferents(page_space); |
| 415 Epilogue(isolate, invoke_api_callbacks); | 411 Epilogue(isolate, invoke_api_callbacks); |
| 416 } | 412 } |
| 417 | 413 |
| 418 } // namespace dart | 414 } // namespace dart |
| OLD | NEW |