Chromium Code Reviews| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 #endif | 165 #endif |
| 166 page_space_controller_(heap, | 166 page_space_controller_(heap, |
| 167 FLAG_old_gen_growth_space_ratio, | 167 FLAG_old_gen_growth_space_ratio, |
| 168 FLAG_old_gen_growth_rate, | 168 FLAG_old_gen_growth_rate, |
| 169 FLAG_old_gen_growth_time_ratio), | 169 FLAG_old_gen_growth_time_ratio), |
| 170 gc_time_micros_(0), | 170 gc_time_micros_(0), |
| 171 collections_(0) { | 171 collections_(0) { |
| 172 } | 172 } |
| 173 | 173 |
| 174 | 174 |
| 175 PageSpace::~PageSpace() { | 175 PageSpace::~PageSpace() { |
|
koda
2015/07/16 14:09:04
... actually, we should probably move this into a
| |
| 176 { | 176 { |
| 177 MonitorLocker ml(tasks_lock()); | 177 MonitorLocker ml(tasks_lock()); |
| 178 while (tasks() > 0) { | 178 while (tasks() > 0) { |
| 179 ml.Wait(); | 179 ml.Wait(); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 FreePages(pages_); | 182 FreePages(pages_); |
| 183 FreePages(exec_pages_); | 183 FreePages(exec_pages_); |
| 184 FreePages(large_pages_); | 184 FreePages(large_pages_); |
| 185 delete pages_lock_; | 185 delete pages_lock_; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 if (read_only) { | 628 if (read_only) { |
| 629 // Avoid MakeIterable trying to write to the heap. | 629 // Avoid MakeIterable trying to write to the heap. |
| 630 AbandonBumpAllocation(); | 630 AbandonBumpAllocation(); |
| 631 } | 631 } |
| 632 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { | 632 for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) { |
| 633 it.page()->WriteProtect(read_only); | 633 it.page()->WriteProtect(read_only); |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 void PageSpace::PrintToJSONObject(JSONObject* object) { | 638 void PageSpace::PrintToJSONObject(JSONObject* object) const { |
| 639 Isolate* isolate = Isolate::Current(); | 639 Isolate* isolate = Isolate::Current(); |
| 640 ASSERT(isolate != NULL); | 640 ASSERT(isolate != NULL); |
| 641 JSONObject space(object, "old"); | 641 JSONObject space(object, "old"); |
| 642 space.AddProperty("type", "HeapSpace"); | 642 space.AddProperty("type", "HeapSpace"); |
| 643 space.AddProperty("name", "old"); | 643 space.AddProperty("name", "old"); |
| 644 space.AddProperty("vmName", "PageSpace"); | 644 space.AddProperty("vmName", "PageSpace"); |
| 645 space.AddProperty("collections", collections()); | 645 space.AddProperty("collections", collections()); |
| 646 space.AddProperty("used", UsedInWords() * kWordSize); | 646 space.AddProperty("used", UsedInWords() * kWordSize); |
| 647 space.AddProperty("capacity", CapacityInWords() * kWordSize); | 647 space.AddProperty("capacity", CapacityInWords() * kWordSize); |
| 648 space.AddProperty("external", ExternalInWords() * kWordSize); | 648 space.AddProperty("external", ExternalInWords() * kWordSize); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 667 : ObjectVisitor(NULL), array_(array) {} | 667 : ObjectVisitor(NULL), array_(array) {} |
| 668 virtual void VisitObject(RawObject* obj) { | 668 virtual void VisitObject(RawObject* obj) { |
| 669 array_->AddValue(obj->Size() / kObjectAlignment); | 669 array_->AddValue(obj->Size() / kObjectAlignment); |
| 670 array_->AddValue(obj->GetClassId()); | 670 array_->AddValue(obj->GetClassId()); |
| 671 } | 671 } |
| 672 private: | 672 private: |
| 673 JSONArray* array_; | 673 JSONArray* array_; |
| 674 }; | 674 }; |
| 675 | 675 |
| 676 | 676 |
| 677 void PageSpace::PrintHeapMapToJSONStream(Isolate* isolate, JSONStream* stream) { | 677 void PageSpace::PrintHeapMapToJSONStream( |
| 678 Isolate* isolate, JSONStream* stream) const { | |
| 678 JSONObject heap_map(stream); | 679 JSONObject heap_map(stream); |
| 679 heap_map.AddProperty("type", "HeapMap"); | 680 heap_map.AddProperty("type", "HeapMap"); |
| 680 heap_map.AddProperty("freeClassId", | 681 heap_map.AddProperty("freeClassId", |
| 681 static_cast<intptr_t>(kFreeListElement)); | 682 static_cast<intptr_t>(kFreeListElement)); |
| 682 heap_map.AddProperty("unitSizeBytes", | 683 heap_map.AddProperty("unitSizeBytes", |
| 683 static_cast<intptr_t>(kObjectAlignment)); | 684 static_cast<intptr_t>(kObjectAlignment)); |
| 684 heap_map.AddProperty("pageSizeBytes", kPageSizeInWords * kWordSize); | 685 heap_map.AddProperty("pageSizeBytes", kPageSizeInWords * kWordSize); |
| 685 { | 686 { |
| 686 JSONObject class_list(&heap_map, "classList"); | 687 JSONObject class_list(&heap_map, "classList"); |
| 687 isolate->class_table()->PrintToJSONObject(&class_list); | 688 isolate->class_table()->PrintToJSONObject(&class_list); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1137 return 0; | 1138 return 0; |
| 1138 } else { | 1139 } else { |
| 1139 ASSERT(total_time >= gc_time); | 1140 ASSERT(total_time >= gc_time); |
| 1140 int result = static_cast<int>((static_cast<double>(gc_time) / | 1141 int result = static_cast<int>((static_cast<double>(gc_time) / |
| 1141 static_cast<double>(total_time)) * 100); | 1142 static_cast<double>(total_time)) * 100); |
| 1142 return result; | 1143 return result; |
| 1143 } | 1144 } |
| 1144 } | 1145 } |
| 1145 | 1146 |
| 1146 } // namespace dart | 1147 } // namespace dart |
| OLD | NEW |