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