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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 array_->AddValue(obj->GetClassId()); | 661 array_->AddValue(obj->GetClassId()); |
662 } | 662 } |
663 private: | 663 private: |
664 JSONArray* array_; | 664 JSONArray* array_; |
665 }; | 665 }; |
666 | 666 |
667 | 667 |
668 void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { | 668 void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { |
669 JSONObject heap_map(stream); | 669 JSONObject heap_map(stream); |
670 heap_map.AddProperty("type", "HeapMap"); | 670 heap_map.AddProperty("type", "HeapMap"); |
671 heap_map.AddProperty("id", "heapmap"); | 671 heap_map.AddProperty("freeClassId", |
672 heap_map.AddProperty("free_class_id", | |
673 static_cast<intptr_t>(kFreeListElement)); | 672 static_cast<intptr_t>(kFreeListElement)); |
674 heap_map.AddProperty("unit_size_bytes", | 673 heap_map.AddProperty("unitSizeBytes", |
675 static_cast<intptr_t>(kObjectAlignment)); | 674 static_cast<intptr_t>(kObjectAlignment)); |
676 heap_map.AddProperty("page_size_bytes", kPageSizeInWords * kWordSize); | 675 heap_map.AddProperty("pageSizeBytes", kPageSizeInWords * kWordSize); |
677 { | 676 { |
678 JSONObject class_list(&heap_map, "class_list"); | 677 JSONObject class_list(&heap_map, "classList"); |
679 isolate->class_table()->PrintToJSONObject(&class_list); | 678 isolate->class_table()->PrintToJSONObject(&class_list); |
680 } | 679 } |
681 { | 680 { |
682 // "pages" is an array [page0, page1, ..., pageN], each page of the form | 681 // "pages" is an array [page0, page1, ..., pageN], each page of the form |
683 // {"object_start": "0x...", "objects": [size, class id, size, ...]} | 682 // {"object_start": "0x...", "objects": [size, class id, size, ...]} |
684 // TODO(19445): Use ExclusivePageIterator once HeapMap supports large pages. | 683 // TODO(19445): Use ExclusivePageIterator once HeapMap supports large pages. |
685 MutexLocker ml(pages_lock_); | 684 MutexLocker ml(pages_lock_); |
686 MakeIterable(); | 685 MakeIterable(); |
687 NoSafepointScope no_safepoint; | 686 NoSafepointScope no_safepoint; |
688 JSONArray all_pages(&heap_map, "pages"); | 687 JSONArray all_pages(&heap_map, "pages"); |
689 for (HeapPage* page = pages_; page != NULL; page = page->next()) { | 688 for (HeapPage* page = pages_; page != NULL; page = page->next()) { |
690 JSONObject page_container(&all_pages); | 689 JSONObject page_container(&all_pages); |
691 page_container.AddPropertyF("object_start", | 690 page_container.AddPropertyF("objectStart", |
692 "0x%" Px "", page->object_start()); | 691 "0x%" Px "", page->object_start()); |
693 JSONArray page_map(&page_container, "objects"); | 692 JSONArray page_map(&page_container, "objects"); |
694 HeapMapAsJSONVisitor printer(&page_map); | 693 HeapMapAsJSONVisitor printer(&page_map); |
695 page->VisitObjects(&printer); | 694 page->VisitObjects(&printer); |
696 } | 695 } |
697 for (HeapPage* page = exec_pages_; page != NULL; page = page->next()) { | 696 for (HeapPage* page = exec_pages_; page != NULL; page = page->next()) { |
698 JSONObject page_container(&all_pages); | 697 JSONObject page_container(&all_pages); |
699 page_container.AddPropertyF("object_start", | 698 page_container.AddPropertyF("objectStart", |
700 "0x%" Px "", page->object_start()); | 699 "0x%" Px "", page->object_start()); |
701 JSONArray page_map(&page_container, "objects"); | 700 JSONArray page_map(&page_container, "objects"); |
702 HeapMapAsJSONVisitor printer(&page_map); | 701 HeapMapAsJSONVisitor printer(&page_map); |
703 page->VisitObjects(&printer); | 702 page->VisitObjects(&printer); |
704 } | 703 } |
705 } | 704 } |
706 } | 705 } |
707 | 706 |
708 | 707 |
709 bool PageSpace::ShouldCollectCode() { | 708 bool PageSpace::ShouldCollectCode() { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 return 0; | 1128 return 0; |
1130 } else { | 1129 } else { |
1131 ASSERT(total_time >= gc_time); | 1130 ASSERT(total_time >= gc_time); |
1132 int result = static_cast<int>((static_cast<double>(gc_time) / | 1131 int result = static_cast<int>((static_cast<double>(gc_time) / |
1133 static_cast<double>(total_time)) * 100); | 1132 static_cast<double>(total_time)) * 100); |
1134 return result; | 1133 return result; |
1135 } | 1134 } |
1136 } | 1135 } |
1137 | 1136 |
1138 } // namespace dart | 1137 } // namespace dart |
OLD | NEW |