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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 AbandonBumpAllocation(); | 664 AbandonBumpAllocation(); |
665 } | 665 } |
666 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 666 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
667 if (!it.page()->embedder_allocated()) { | 667 if (!it.page()->embedder_allocated()) { |
668 it.page()->WriteProtect(read_only); | 668 it.page()->WriteProtect(read_only); |
669 } | 669 } |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 | 673 |
| 674 #ifndef PRODUCT |
674 void PageSpace::PrintToJSONObject(JSONObject* object) const { | 675 void PageSpace::PrintToJSONObject(JSONObject* object) const { |
675 if (!FLAG_support_service) { | 676 if (!FLAG_support_service) { |
676 return; | 677 return; |
677 } | 678 } |
678 Isolate* isolate = Isolate::Current(); | 679 Isolate* isolate = Isolate::Current(); |
679 ASSERT(isolate != NULL); | 680 ASSERT(isolate != NULL); |
680 JSONObject space(object, "old"); | 681 JSONObject space(object, "old"); |
681 space.AddProperty("type", "HeapSpace"); | 682 space.AddProperty("type", "HeapSpace"); |
682 space.AddProperty("name", "old"); | 683 space.AddProperty("name", "old"); |
683 space.AddProperty("vmName", "PageSpace"); | 684 space.AddProperty("vmName", "PageSpace"); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 for (HeapPage* page = exec_pages_; page != NULL; page = page->next()) { | 748 for (HeapPage* page = exec_pages_; page != NULL; page = page->next()) { |
748 JSONObject page_container(&all_pages); | 749 JSONObject page_container(&all_pages); |
749 page_container.AddPropertyF("objectStart", | 750 page_container.AddPropertyF("objectStart", |
750 "0x%" Px "", page->object_start()); | 751 "0x%" Px "", page->object_start()); |
751 JSONArray page_map(&page_container, "objects"); | 752 JSONArray page_map(&page_container, "objects"); |
752 HeapMapAsJSONVisitor printer(&page_map); | 753 HeapMapAsJSONVisitor printer(&page_map); |
753 page->VisitObjects(&printer); | 754 page->VisitObjects(&printer); |
754 } | 755 } |
755 } | 756 } |
756 } | 757 } |
| 758 #endif // PRODUCT |
757 | 759 |
758 | 760 |
759 bool PageSpace::ShouldCollectCode() { | 761 bool PageSpace::ShouldCollectCode() { |
760 // Try to collect code if enough time has passed since the last attempt. | 762 // Try to collect code if enough time has passed since the last attempt. |
761 const int64_t start = OS::GetCurrentTimeMicros(); | 763 const int64_t start = OS::GetCurrentTimeMicros(); |
762 const int64_t last_code_collection_in_us = | 764 const int64_t last_code_collection_in_us = |
763 page_space_controller_.last_code_collection_in_us(); | 765 page_space_controller_.last_code_collection_in_us(); |
764 | 766 |
765 if ((start - last_code_collection_in_us) > | 767 if ((start - last_code_collection_in_us) > |
766 FLAG_code_collection_interval_in_us) { | 768 FLAG_code_collection_interval_in_us) { |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 return 0; | 1220 return 0; |
1219 } else { | 1221 } else { |
1220 ASSERT(total_time >= gc_time); | 1222 ASSERT(total_time >= gc_time); |
1221 int result = static_cast<int>((static_cast<double>(gc_time) / | 1223 int result = static_cast<int>((static_cast<double>(gc_time) / |
1222 static_cast<double>(total_time)) * 100); | 1224 static_cast<double>(total_time)) * 100); |
1223 return result; | 1225 return result; |
1224 } | 1226 } |
1225 } | 1227 } |
1226 | 1228 |
1227 } // namespace dart | 1229 } // namespace dart |
OLD | NEW |