| 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 <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 handled++; | 342 handled++; |
| 343 if (handled == count) { | 343 if (handled == count) { |
| 344 break; | 344 break; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 delete pending; | 348 delete pending; |
| 349 pending = next; | 349 pending = next; |
| 350 } | 350 } |
| 351 if (FLAG_verbose_gc) { | 351 if (FLAG_verbose_gc) { |
| 352 OS::PrintErr("StoreBuffer: %d, %d (entries, dups)\n", | 352 OS::PrintErr("StoreBuffer: %"Pd", %"Pd" (entries, dups)\n", |
| 353 entries, duplicates); | 353 entries, duplicates); |
| 354 } | 354 } |
| 355 StoreBufferBlock* block = isolate->store_buffer_block(); | 355 StoreBufferBlock* block = isolate->store_buffer_block(); |
| 356 entries = block->Count(); | 356 entries = block->Count(); |
| 357 duplicates = 0; | 357 duplicates = 0; |
| 358 for (intptr_t i = 0; i < entries; i++) { | 358 for (intptr_t i = 0; i < entries; i++) { |
| 359 RawObject** pointer = reinterpret_cast<RawObject**>(block->At(i)); | 359 RawObject** pointer = reinterpret_cast<RawObject**>(block->At(i)); |
| 360 RawObject* value = *pointer; | 360 RawObject* value = *pointer; |
| 361 if (value->IsHeapObject()) { | 361 if (value->IsHeapObject()) { |
| 362 if (from_->Contains(RawObject::ToAddr(value))) { | 362 if (from_->Contains(RawObject::ToAddr(value))) { |
| 363 visitor->VisitPointer(pointer); | 363 visitor->VisitPointer(pointer); |
| 364 } else { | 364 } else { |
| 365 duplicates++; | 365 duplicates++; |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 block->Reset(); | 369 block->Reset(); |
| 370 if (FLAG_verbose_gc) { | 370 if (FLAG_verbose_gc) { |
| 371 OS::PrintErr("StoreBufferBlock: %d, %d (entries, dups)\n", | 371 OS::PrintErr("StoreBufferBlock: %"Pd", %"Pd" (entries, dups)\n", |
| 372 entries, duplicates); | 372 entries, duplicates); |
| 373 } | 373 } |
| 374 // Done iterating through the store buffers. | 374 // Done iterating through the store buffers. |
| 375 visitor->VisitingOldPointers(false); | 375 visitor->VisitingOldPointers(false); |
| 376 } | 376 } |
| 377 | 377 |
| 378 | 378 |
| 379 void Scavenger::IterateRoots(Isolate* isolate, | 379 void Scavenger::IterateRoots(Isolate* isolate, |
| 380 ScavengerVisitor* visitor, | 380 ScavengerVisitor* visitor, |
| 381 bool visit_prologue_weak_persistent_handles) { | 381 bool visit_prologue_weak_persistent_handles) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 Prologue(isolate, invoke_api_callbacks); | 561 Prologue(isolate, invoke_api_callbacks); |
| 562 IterateRoots(isolate, &visitor, !invoke_api_callbacks); | 562 IterateRoots(isolate, &visitor, !invoke_api_callbacks); |
| 563 ProcessToSpace(&visitor); | 563 ProcessToSpace(&visitor); |
| 564 IterateWeakReferences(isolate, &visitor); | 564 IterateWeakReferences(isolate, &visitor); |
| 565 ScavengerWeakVisitor weak_visitor(this); | 565 ScavengerWeakVisitor weak_visitor(this); |
| 566 IterateWeakRoots(isolate, &weak_visitor, invoke_api_callbacks); | 566 IterateWeakRoots(isolate, &weak_visitor, invoke_api_callbacks); |
| 567 visitor.Finalize(); | 567 visitor.Finalize(); |
| 568 Epilogue(isolate, invoke_api_callbacks); | 568 Epilogue(isolate, invoke_api_callbacks); |
| 569 timer.Stop(); | 569 timer.Stop(); |
| 570 if (FLAG_verbose_gc) { | 570 if (FLAG_verbose_gc) { |
| 571 OS::PrintErr("Scavenge[%d]: %dus\n", count_, timer.TotalElapsedTime()); | 571 OS::PrintErr("Scavenge[%d]: %"Pd64"us\n", |
| 572 count_, |
| 573 timer.TotalElapsedTime()); |
| 572 } | 574 } |
| 573 | 575 |
| 574 if (FLAG_verify_after_gc) { | 576 if (FLAG_verify_after_gc) { |
| 575 OS::PrintErr("Verifying after Scavenge..."); | 577 OS::PrintErr("Verifying after Scavenge..."); |
| 576 heap_->Verify(); | 578 heap_->Verify(); |
| 577 OS::PrintErr(" done.\n"); | 579 OS::PrintErr(" done.\n"); |
| 578 } | 580 } |
| 579 | 581 |
| 580 count_++; | 582 count_++; |
| 581 // Done scavenging. Reset the marker. | 583 // Done scavenging. Reset the marker. |
| 582 ASSERT(scavenging_); | 584 ASSERT(scavenging_); |
| 583 scavenging_ = false; | 585 scavenging_ = false; |
| 584 } | 586 } |
| 585 | 587 |
| 586 | 588 |
| 587 void Scavenger::WriteProtect(bool read_only) { | 589 void Scavenger::WriteProtect(bool read_only) { |
| 588 space_->Protect( | 590 space_->Protect( |
| 589 read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite); | 591 read_only ? VirtualMemory::kReadOnly : VirtualMemory::kReadWrite); |
| 590 } | 592 } |
| 591 | 593 |
| 592 } // namespace dart | 594 } // namespace dart |
| OLD | NEW |