| 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 MicrosecondsToMilliseconds(stats_.times_[2]), | 830 MicrosecondsToMilliseconds(stats_.times_[2]), |
| 831 MicrosecondsToMilliseconds(stats_.times_[3]), | 831 MicrosecondsToMilliseconds(stats_.times_[3]), |
| 832 stats_.data_[0], | 832 stats_.data_[0], |
| 833 stats_.data_[1], | 833 stats_.data_[1], |
| 834 stats_.data_[2], | 834 stats_.data_[2], |
| 835 stats_.data_[3]); | 835 stats_.data_[3]); |
| 836 } | 836 } |
| 837 | 837 |
| 838 | 838 |
| 839 void Heap::PrintStatsToTimeline(TimelineEventScope* event) { | 839 void Heap::PrintStatsToTimeline(TimelineEventScope* event) { |
| 840 #if !defined(PRODUCT) |
| 840 if ((event == NULL) || !event->enabled()) { | 841 if ((event == NULL) || !event->enabled()) { |
| 841 return; | 842 return; |
| 842 } | 843 } |
| 843 event->SetNumArguments(12); | 844 event->SetNumArguments(12); |
| 844 event->FormatArgument(0, | 845 event->FormatArgument(0, |
| 845 "Before.New.Used (kB)", | 846 "Before.New.Used (kB)", |
| 846 "%" Pd "", | 847 "%" Pd "", |
| 847 RoundWordsToKB(stats_.before_.new_.used_in_words)); | 848 RoundWordsToKB(stats_.before_.new_.used_in_words)); |
| 848 event->FormatArgument(1, | 849 event->FormatArgument(1, |
| 849 "After.New.Used (kB)", | 850 "After.New.Used (kB)", |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 "%" Pd "", | 885 "%" Pd "", |
| 885 RoundWordsToKB(stats_.after_.new_.external_in_words)); | 886 RoundWordsToKB(stats_.after_.new_.external_in_words)); |
| 886 event->FormatArgument(10, | 887 event->FormatArgument(10, |
| 887 "Before.Old.External (kB)", | 888 "Before.Old.External (kB)", |
| 888 "%" Pd "", | 889 "%" Pd "", |
| 889 RoundWordsToKB(stats_.before_.old_.external_in_words)); | 890 RoundWordsToKB(stats_.before_.old_.external_in_words)); |
| 890 event->FormatArgument(11, | 891 event->FormatArgument(11, |
| 891 "After.Old.External (kB)", | 892 "After.Old.External (kB)", |
| 892 "%" Pd "", | 893 "%" Pd "", |
| 893 RoundWordsToKB(stats_.after_.old_.external_in_words)); | 894 RoundWordsToKB(stats_.after_.old_.external_in_words)); |
| 895 #endif // !defined(PRODUCT) |
| 894 } | 896 } |
| 895 | 897 |
| 896 | 898 |
| 897 NoHeapGrowthControlScope::NoHeapGrowthControlScope() | 899 NoHeapGrowthControlScope::NoHeapGrowthControlScope() |
| 898 : StackResource(Thread::Current()) { | 900 : StackResource(Thread::Current()) { |
| 899 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 901 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 900 current_growth_controller_state_ = heap->GrowthControlState(); | 902 current_growth_controller_state_ = heap->GrowthControlState(); |
| 901 heap->DisableGrowthControl(); | 903 heap->DisableGrowthControl(); |
| 902 } | 904 } |
| 903 | 905 |
| 904 | 906 |
| 905 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 907 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 906 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 908 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 907 heap->SetGrowthControlState(current_growth_controller_state_); | 909 heap->SetGrowthControlState(current_growth_controller_state_); |
| 908 } | 910 } |
| 909 | 911 |
| 910 | 912 |
| 911 WritableVMIsolateScope::WritableVMIsolateScope(Thread* thread) | 913 WritableVMIsolateScope::WritableVMIsolateScope(Thread* thread) |
| 912 : StackResource(thread) { | 914 : StackResource(thread) { |
| 913 Dart::vm_isolate()->heap()->WriteProtect(false); | 915 Dart::vm_isolate()->heap()->WriteProtect(false); |
| 914 } | 916 } |
| 915 | 917 |
| 916 | 918 |
| 917 WritableVMIsolateScope::~WritableVMIsolateScope() { | 919 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 918 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 920 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 919 Dart::vm_isolate()->heap()->WriteProtect(true); | 921 Dart::vm_isolate()->heap()->WriteProtect(true); |
| 920 } | 922 } |
| 921 | 923 |
| 922 } // namespace dart | 924 } // namespace dart |
| OLD | NEW |