OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/heap.h" | 5 #include "vm/heap.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 } | 686 } |
687 #endif // PRODUCT | 687 #endif // PRODUCT |
688 | 688 |
689 | 689 |
690 void Heap::RecordBeforeGC(Space space, GCReason reason) { | 690 void Heap::RecordBeforeGC(Space space, GCReason reason) { |
691 ASSERT((space == kNew && gc_new_space_in_progress_) || | 691 ASSERT((space == kNew && gc_new_space_in_progress_) || |
692 (space == kOld && gc_old_space_in_progress_)); | 692 (space == kOld && gc_old_space_in_progress_)); |
693 stats_.num_++; | 693 stats_.num_++; |
694 stats_.space_ = space; | 694 stats_.space_ = space; |
695 stats_.reason_ = reason; | 695 stats_.reason_ = reason; |
696 stats_.before_.micros_ = OS::GetCurrentTimeMicros(); | 696 stats_.before_.micros_ = OS::GetCurrentMonotonicMicros(); |
697 stats_.before_.new_ = new_space_.GetCurrentUsage(); | 697 stats_.before_.new_ = new_space_.GetCurrentUsage(); |
698 stats_.before_.old_ = old_space_.GetCurrentUsage(); | 698 stats_.before_.old_ = old_space_.GetCurrentUsage(); |
699 stats_.times_[0] = 0; | 699 stats_.times_[0] = 0; |
700 stats_.times_[1] = 0; | 700 stats_.times_[1] = 0; |
701 stats_.times_[2] = 0; | 701 stats_.times_[2] = 0; |
702 stats_.times_[3] = 0; | 702 stats_.times_[3] = 0; |
703 stats_.data_[0] = 0; | 703 stats_.data_[0] = 0; |
704 stats_.data_[1] = 0; | 704 stats_.data_[1] = 0; |
705 stats_.data_[2] = 0; | 705 stats_.data_[2] = 0; |
706 stats_.data_[3] = 0; | 706 stats_.data_[3] = 0; |
707 } | 707 } |
708 | 708 |
709 | 709 |
710 void Heap::RecordAfterGC(Space space) { | 710 void Heap::RecordAfterGC(Space space) { |
711 stats_.after_.micros_ = OS::GetCurrentTimeMicros(); | 711 stats_.after_.micros_ = OS::GetCurrentMonotonicMicros(); |
712 int64_t delta = stats_.after_.micros_ - stats_.before_.micros_; | 712 int64_t delta = stats_.after_.micros_ - stats_.before_.micros_; |
713 if (stats_.space_ == kNew) { | 713 if (stats_.space_ == kNew) { |
714 new_space_.AddGCTime(delta); | 714 new_space_.AddGCTime(delta); |
715 new_space_.IncrementCollections(); | 715 new_space_.IncrementCollections(); |
716 } else { | 716 } else { |
717 old_space_.AddGCTime(delta); | 717 old_space_.AddGCTime(delta); |
718 old_space_.IncrementCollections(); | 718 old_space_.IncrementCollections(); |
719 } | 719 } |
720 stats_.after_.new_ = new_space_.GetCurrentUsage(); | 720 stats_.after_.new_ = new_space_.GetCurrentUsage(); |
721 stats_.after_.old_ = old_space_.GetCurrentUsage(); | 721 stats_.after_.old_ = old_space_.GetCurrentUsage(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 Dart::vm_isolate()->heap()->WriteProtect(false); | 843 Dart::vm_isolate()->heap()->WriteProtect(false); |
844 } | 844 } |
845 | 845 |
846 | 846 |
847 WritableVMIsolateScope::~WritableVMIsolateScope() { | 847 WritableVMIsolateScope::~WritableVMIsolateScope() { |
848 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 848 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
849 Dart::vm_isolate()->heap()->WriteProtect(true); | 849 Dart::vm_isolate()->heap()->WriteProtect(true); |
850 } | 850 } |
851 | 851 |
852 } // namespace dart | 852 } // namespace dart |
OLD | NEW |