| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // Key is white. Delay the weak property. | 373 // Key is white. Delay the weak property. |
| 374 visitor->DelayWeakProperty(raw_weak); | 374 visitor->DelayWeakProperty(raw_weak); |
| 375 } else { | 375 } else { |
| 376 // Key is gray or black. Make the weak property black. | 376 // Key is gray or black. Make the weak property black. |
| 377 raw_weak->VisitPointers(visitor); | 377 raw_weak->VisitPointers(visitor); |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 | 380 |
| 381 | 381 |
| 382 void GCMarker::ProcessWeakTables(PageSpace* page_space) { | 382 void GCMarker::ProcessWeakTables(PageSpace* page_space) { |
| 383 for (Heap::WeakSelector sel = static_cast<Heap::WeakSelector>(0); | 383 for (int sel = 0; |
| 384 sel < Heap::kNumWeakSelectors; | 384 sel < Heap::kNumWeakSelectors; |
| 385 sel++) { | 385 sel++) { |
| 386 WeakTable* table = heap_->GetWeakTable(Heap::kOld, sel); | 386 WeakTable* table = heap_->GetWeakTable( |
| 387 Heap::kOld, static_cast<Heap::WeakSelector>(sel)); |
| 387 intptr_t size = table->size(); | 388 intptr_t size = table->size(); |
| 388 for (intptr_t i = 0; i < size; i++) { | 389 for (intptr_t i = 0; i < size; i++) { |
| 389 if (table->IsValidEntryAt(i)) { | 390 if (table->IsValidEntryAt(i)) { |
| 390 RawObject* raw_obj = table->ObjectAt(i); | 391 RawObject* raw_obj = table->ObjectAt(i); |
| 391 ASSERT(raw_obj->IsHeapObject()); | 392 ASSERT(raw_obj->IsHeapObject()); |
| 392 if (!raw_obj->IsMarked()) { | 393 if (!raw_obj->IsMarked()) { |
| 393 table->InvalidateAt(i); | 394 table->InvalidateAt(i); |
| 394 } | 395 } |
| 395 } | 396 } |
| 396 } | 397 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 408 DrainMarkingStack(isolate, &mark); | 409 DrainMarkingStack(isolate, &mark); |
| 409 IterateWeakReferences(isolate, &mark); | 410 IterateWeakReferences(isolate, &mark); |
| 410 MarkingWeakVisitor mark_weak; | 411 MarkingWeakVisitor mark_weak; |
| 411 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); | 412 IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks); |
| 412 mark.Finalize(); | 413 mark.Finalize(); |
| 413 ProcessWeakTables(page_space); | 414 ProcessWeakTables(page_space); |
| 414 Epilogue(isolate, invoke_api_callbacks); | 415 Epilogue(isolate, invoke_api_callbacks); |
| 415 } | 416 } |
| 416 | 417 |
| 417 } // namespace dart | 418 } // namespace dart |
| OLD | NEW |