| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 IterateWeakReferences(isolate, &visitor); | 648 IterateWeakReferences(isolate, &visitor); |
| 649 ScavengerWeakVisitor weak_visitor(this); | 649 ScavengerWeakVisitor weak_visitor(this); |
| 650 IterateWeakRoots(isolate, &weak_visitor, invoke_api_callbacks); | 650 IterateWeakRoots(isolate, &weak_visitor, invoke_api_callbacks); |
| 651 visitor.Finalize(); | 651 visitor.Finalize(); |
| 652 ProcessPeerReferents(); | 652 ProcessPeerReferents(); |
| 653 Epilogue(isolate, invoke_api_callbacks); | 653 Epilogue(isolate, invoke_api_callbacks); |
| 654 timer.Stop(); | 654 timer.Stop(); |
| 655 | 655 |
| 656 if (FLAG_verbose_gc) { | 656 if (FLAG_verbose_gc) { |
| 657 const intptr_t KB2 = KB / 2; | 657 const intptr_t KB2 = KB / 2; |
| 658 double survival = ((in_use() + visitor.bytes_promoted()) / |
| 659 static_cast<double>(in_use_before)) * 100.0; |
| 660 double promoted = (visitor.bytes_promoted() / |
| 661 static_cast<double>(in_use() + visitor.bytes_promoted())) |
| 662 * 100.0; |
| 658 OS::PrintErr("Scavenge[%d]: %"Pd64"us (%"Pd"K -> %"Pd"K, %"Pd"K)\n" | 663 OS::PrintErr("Scavenge[%d]: %"Pd64"us (%"Pd"K -> %"Pd"K, %"Pd"K)\n" |
| 659 "Promoted %"Pd"K\n", | 664 "Surviving %"Pd"K %.1f%%\n" |
| 665 "Promoted survivors %"Pd"K %.1f%%\n", |
| 660 count_, | 666 count_, |
| 661 timer.TotalElapsedTime(), | 667 timer.TotalElapsedTime(), |
| 662 (in_use_before + KB2) / KB, | 668 (in_use_before + KB2) / KB, |
| 663 (in_use() + KB2) / KB, | 669 (in_use() + KB2) / KB, |
| 664 (capacity() + KB2) / KB, | 670 (capacity() + KB2) / KB, |
| 665 (visitor.bytes_promoted() + KB2) / KB); | 671 (in_use() + visitor.bytes_promoted() + KB2) / KB, |
| 672 survival, |
| 673 (visitor.bytes_promoted() + KB2) / KB, |
| 674 promoted); |
| 666 } | 675 } |
| 667 | 676 |
| 668 if (FLAG_verify_after_gc) { | 677 if (FLAG_verify_after_gc) { |
| 669 OS::PrintErr("Verifying after Scavenge..."); | 678 OS::PrintErr("Verifying after Scavenge..."); |
| 670 heap_->Verify(); | 679 heap_->Verify(); |
| 671 OS::PrintErr(" done.\n"); | 680 OS::PrintErr(" done.\n"); |
| 672 } | 681 } |
| 673 | 682 |
| 674 count_++; | 683 count_++; |
| 675 // Done scavenging. Reset the marker. | 684 // Done scavenging. Reset the marker. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 697 PeerTable::iterator it = peer_table_.find(raw_obj); | 706 PeerTable::iterator it = peer_table_.find(raw_obj); |
| 698 return (it == peer_table_.end()) ? NULL : it->second; | 707 return (it == peer_table_.end()) ? NULL : it->second; |
| 699 } | 708 } |
| 700 | 709 |
| 701 | 710 |
| 702 int64_t Scavenger::PeerCount() const { | 711 int64_t Scavenger::PeerCount() const { |
| 703 return static_cast<int64_t>(peer_table_.size()); | 712 return static_cast<int64_t>(peer_table_.size()); |
| 704 } | 713 } |
| 705 | 714 |
| 706 } // namespace dart | 715 } // namespace dart |
| OLD | NEW |