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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 new_space_.AddGCTime(delta); | 724 new_space_.AddGCTime(delta); |
725 new_space_.IncrementCollections(); | 725 new_space_.IncrementCollections(); |
726 } else { | 726 } else { |
727 old_space_.AddGCTime(delta); | 727 old_space_.AddGCTime(delta); |
728 old_space_.IncrementCollections(); | 728 old_space_.IncrementCollections(); |
729 } | 729 } |
730 stats_.after_.new_ = new_space_.GetCurrentUsage(); | 730 stats_.after_.new_ = new_space_.GetCurrentUsage(); |
731 stats_.after_.old_ = old_space_.GetCurrentUsage(); | 731 stats_.after_.old_ = old_space_.GetCurrentUsage(); |
732 ASSERT((space == kNew && gc_new_space_in_progress_) || | 732 ASSERT((space == kNew && gc_new_space_in_progress_) || |
733 (space == kOld && gc_old_space_in_progress_)); | 733 (space == kOld && gc_old_space_in_progress_)); |
| 734 #ifndef PRODUCT |
734 if (FLAG_support_service && Service::gc_stream.enabled()) { | 735 if (FLAG_support_service && Service::gc_stream.enabled()) { |
735 ServiceEvent event(Isolate::Current(), ServiceEvent::kGC); | 736 ServiceEvent event(Isolate::Current(), ServiceEvent::kGC); |
736 event.set_gc_stats(&stats_); | 737 event.set_gc_stats(&stats_); |
737 Service::HandleEvent(&event); | 738 Service::HandleEvent(&event); |
738 } | 739 } |
| 740 #endif // !PRODUCT |
739 } | 741 } |
740 | 742 |
741 | 743 |
742 void Heap::PrintStats() { | 744 void Heap::PrintStats() { |
743 if (!FLAG_verbose_gc) return; | 745 if (!FLAG_verbose_gc) return; |
744 | 746 |
745 if ((FLAG_verbose_gc_hdr != 0) && | 747 if ((FLAG_verbose_gc_hdr != 0) && |
746 (((stats_.num_ - 1) % FLAG_verbose_gc_hdr) == 0)) { | 748 (((stats_.num_ - 1) % FLAG_verbose_gc_hdr) == 0)) { |
747 OS::PrintErr("[ GC | space | count | start | gc time | " | 749 OS::PrintErr("[ GC | space | count | start | gc time | " |
748 "new gen (KB) | old gen (KB) | timers | data ]\n" | 750 "new gen (KB) | old gen (KB) | timers | data ]\n" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 Dart::vm_isolate()->heap()->WriteProtect(false); | 874 Dart::vm_isolate()->heap()->WriteProtect(false); |
873 } | 875 } |
874 | 876 |
875 | 877 |
876 WritableVMIsolateScope::~WritableVMIsolateScope() { | 878 WritableVMIsolateScope::~WritableVMIsolateScope() { |
877 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 879 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
878 Dart::vm_isolate()->heap()->WriteProtect(true); | 880 Dart::vm_isolate()->heap()->WriteProtect(true); |
879 } | 881 } |
880 | 882 |
881 } // namespace dart | 883 } // namespace dart |
OLD | NEW |