| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // The object has survived. Do nothing. | 389 // The object has survived. Do nothing. |
| 390 ++it; | 390 ++it; |
| 391 } else { | 391 } else { |
| 392 // The object has become garbage. Remove its record. | 392 // The object has become garbage. Remove its record. |
| 393 peer_table->erase(it++); | 393 peer_table->erase(it++); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 | 398 |
| 399 void GCMarker::ProcessObjectIdTable() { |
| 400 RawObject** table = heap_->get_object_id_ring_table(); |
| 401 const intptr_t table_size = heap_->get_object_id_ring_table_size(); |
| 402 if ((table == NULL) || (table_size <= 0)) { |
| 403 return; |
| 404 } |
| 405 for (intptr_t i = 0; i < table_size; i++) { |
| 406 RawObject* raw_obj = table[i]; |
| 407 ASSERT(raw_obj->IsHeapObject()); |
| 408 if (!raw_obj->IsMarked()) { |
| 409 // Object has become garbage. Replace it will null. |
| 410 table[i] = Object::null(); |
| 411 } |
| 412 } |
| 413 } |
| 414 |
| 415 |
| 399 void GCMarker::MarkObjects(Isolate* isolate, | 416 void GCMarker::MarkObjects(Isolate* isolate, |
| 400 PageSpace* page_space, | 417 PageSpace* page_space, |
| 401 bool invoke_api_callbacks) { | 418 bool invoke_api_callbacks) { |
| 402 MarkingStack marking_stack; | 419 MarkingStack marking_stack; |
| 403 Prologue(isolate, invoke_api_callbacks); | 420 Prologue(isolate, invoke_api_callbacks); |
| 404 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack); | 421 MarkingVisitor mark(isolate, heap_, page_space, &marking_stack); |
| 405 IterateRoots(isolate, &mark, !invoke_api_callbacks); | 422 IterateRoots(isolate, &mark, !invoke_api_callbacks); |
| 406 DrainMarkingStack(isolate, &mark); | 423 DrainMarkingStack(isolate, &mark); |
| 407 IterateWeakReferences(isolate, &mark); | 424 IterateWeakReferences(isolate, &mark); |
| 408 MarkingWeakVisitor mark_weak; | 425 MarkingWeakVisitor mark_weak; |
| 409 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 426 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 410 mark.Finalize(); | 427 mark.Finalize(); |
| 411 ProcessPeerReferents(page_space); | 428 ProcessPeerReferents(page_space); |
| 429 ProcessObjectIdTable(); |
| 412 Epilogue(isolate, invoke_api_callbacks); | 430 Epilogue(isolate, invoke_api_callbacks); |
| 413 } | 431 } |
| 414 | 432 |
| 415 } // namespace dart | 433 } // namespace dart |
| OLD | NEW |