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/pages.h" | 5 #include "vm/pages.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/compiler_stats.h" | 8 #include "vm/compiler_stats.h" |
9 #include "vm/gc_marker.h" | 9 #include "vm/gc_marker.h" |
10 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 } | 666 } |
667 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 667 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
668 if ((it.page()->type() != HeapPage::kExecutable) || include_code_pages) { | 668 if ((it.page()->type() != HeapPage::kExecutable) || include_code_pages) { |
669 it.page()->WriteProtect(read_only); | 669 it.page()->WriteProtect(read_only); |
670 } | 670 } |
671 } | 671 } |
672 } | 672 } |
673 | 673 |
674 | 674 |
675 void PageSpace::PrintToJSONObject(JSONObject* object) const { | 675 void PageSpace::PrintToJSONObject(JSONObject* object) const { |
| 676 if (!FLAG_support_service) { |
| 677 return; |
| 678 } |
676 Isolate* isolate = Isolate::Current(); | 679 Isolate* isolate = Isolate::Current(); |
677 ASSERT(isolate != NULL); | 680 ASSERT(isolate != NULL); |
678 JSONObject space(object, "old"); | 681 JSONObject space(object, "old"); |
679 space.AddProperty("type", "HeapSpace"); | 682 space.AddProperty("type", "HeapSpace"); |
680 space.AddProperty("name", "old"); | 683 space.AddProperty("name", "old"); |
681 space.AddProperty("vmName", "PageSpace"); | 684 space.AddProperty("vmName", "PageSpace"); |
682 space.AddProperty("collections", collections()); | 685 space.AddProperty("collections", collections()); |
683 space.AddProperty64("used", UsedInWords() * kWordSize); | 686 space.AddProperty64("used", UsedInWords() * kWordSize); |
684 space.AddProperty64("capacity", CapacityInWords() * kWordSize); | 687 space.AddProperty64("capacity", CapacityInWords() * kWordSize); |
685 space.AddProperty64("external", ExternalInWords() * kWordSize); | 688 space.AddProperty64("external", ExternalInWords() * kWordSize); |
(...skipping 20 matching lines...) Expand all Loading... |
706 array_->AddValue(obj->Size() / kObjectAlignment); | 709 array_->AddValue(obj->Size() / kObjectAlignment); |
707 array_->AddValue(obj->GetClassId()); | 710 array_->AddValue(obj->GetClassId()); |
708 } | 711 } |
709 private: | 712 private: |
710 JSONArray* array_; | 713 JSONArray* array_; |
711 }; | 714 }; |
712 | 715 |
713 | 716 |
714 void PageSpace::PrintHeapMapToJSONStream( | 717 void PageSpace::PrintHeapMapToJSONStream( |
715 Isolate* isolate, JSONStream* stream) const { | 718 Isolate* isolate, JSONStream* stream) const { |
| 719 if (!FLAG_support_service) { |
| 720 return; |
| 721 } |
716 JSONObject heap_map(stream); | 722 JSONObject heap_map(stream); |
717 heap_map.AddProperty("type", "HeapMap"); | 723 heap_map.AddProperty("type", "HeapMap"); |
718 heap_map.AddProperty("freeClassId", | 724 heap_map.AddProperty("freeClassId", |
719 static_cast<intptr_t>(kFreeListElement)); | 725 static_cast<intptr_t>(kFreeListElement)); |
720 heap_map.AddProperty("unitSizeBytes", | 726 heap_map.AddProperty("unitSizeBytes", |
721 static_cast<intptr_t>(kObjectAlignment)); | 727 static_cast<intptr_t>(kObjectAlignment)); |
722 heap_map.AddProperty("pageSizeBytes", kPageSizeInWords * kWordSize); | 728 heap_map.AddProperty("pageSizeBytes", kPageSizeInWords * kWordSize); |
723 { | 729 { |
724 JSONObject class_list(&heap_map, "classList"); | 730 JSONObject class_list(&heap_map, "classList"); |
725 isolate->class_table()->PrintToJSONObject(&class_list); | 731 isolate->class_table()->PrintToJSONObject(&class_list); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 return 0; | 1225 return 0; |
1220 } else { | 1226 } else { |
1221 ASSERT(total_time >= gc_time); | 1227 ASSERT(total_time >= gc_time); |
1222 int result = static_cast<int>((static_cast<double>(gc_time) / | 1228 int result = static_cast<int>((static_cast<double>(gc_time) / |
1223 static_cast<double>(total_time)) * 100); | 1229 static_cast<double>(total_time)) * 100); |
1224 return result; | 1230 return result; |
1225 } | 1231 } |
1226 } | 1232 } |
1227 | 1233 |
1228 } // namespace dart | 1234 } // namespace dart |
OLD | NEW |