OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/full-codegen/full-codegen.h" | 9 #include "src/full-codegen/full-codegen.h" |
10 #include "src/heap/slot-set.h" | 10 #include "src/heap/slot-set.h" |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 } | 875 } |
876 } | 876 } |
877 UNREACHABLE(); | 877 UNREACHABLE(); |
878 } | 878 } |
879 | 879 |
880 | 880 |
881 #ifdef DEBUG | 881 #ifdef DEBUG |
882 void MemoryAllocator::ReportStatistics() { | 882 void MemoryAllocator::ReportStatistics() { |
883 intptr_t size = Size(); | 883 intptr_t size = Size(); |
884 float pct = static_cast<float>(capacity_ - size) / capacity_; | 884 float pct = static_cast<float>(capacity_ - size) / capacity_; |
885 PrintF(" capacity: %" V8PRIdPTR ", used: %" V8PRIdPTR | 885 PrintF(" capacity: %" V8_PTR_PREFIX |
| 886 "d" |
| 887 ", used: %" V8_PTR_PREFIX |
| 888 "d" |
886 ", available: %%%d\n\n", | 889 ", available: %%%d\n\n", |
887 capacity_, size, static_cast<int>(pct * 100)); | 890 capacity_, size, static_cast<int>(pct * 100)); |
888 } | 891 } |
889 #endif | 892 #endif |
890 | 893 |
891 | 894 |
892 int MemoryAllocator::CodePageGuardStartOffset() { | 895 int MemoryAllocator::CodePageGuardStartOffset() { |
893 // We are guarding code pages: the first OS page after the header | 896 // We are guarding code pages: the first OS page after the header |
894 // will be protected as non-writable. | 897 // will be protected as non-writable. |
895 return RoundUp(Page::kObjectStartOffset, base::OS::CommitPageSize()); | 898 return RoundUp(Page::kObjectStartOffset, base::OS::CommitPageSize()); |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 } | 2055 } |
2053 } | 2056 } |
2054 LOG(isolate, HeapSampleEndEvent("NewSpace", description)); | 2057 LOG(isolate, HeapSampleEndEvent("NewSpace", description)); |
2055 } | 2058 } |
2056 | 2059 |
2057 | 2060 |
2058 void NewSpace::ReportStatistics() { | 2061 void NewSpace::ReportStatistics() { |
2059 #ifdef DEBUG | 2062 #ifdef DEBUG |
2060 if (FLAG_heap_stats) { | 2063 if (FLAG_heap_stats) { |
2061 float pct = static_cast<float>(Available()) / TotalCapacity(); | 2064 float pct = static_cast<float>(Available()) / TotalCapacity(); |
2062 PrintF(" capacity: %" V8PRIdPTR ", available: %" V8PRIdPTR ", %%%d\n", | 2065 PrintF(" capacity: %" V8_PTR_PREFIX |
| 2066 "d" |
| 2067 ", available: %" V8_PTR_PREFIX "d, %%%d\n", |
2063 TotalCapacity(), Available(), static_cast<int>(pct * 100)); | 2068 TotalCapacity(), Available(), static_cast<int>(pct * 100)); |
2064 PrintF("\n Object Histogram:\n"); | 2069 PrintF("\n Object Histogram:\n"); |
2065 for (int i = 0; i <= LAST_TYPE; i++) { | 2070 for (int i = 0; i <= LAST_TYPE; i++) { |
2066 if (allocated_histogram_[i].number() > 0) { | 2071 if (allocated_histogram_[i].number() > 0) { |
2067 PrintF(" %-34s%10d (%10d bytes)\n", allocated_histogram_[i].name(), | 2072 PrintF(" %-34s%10d (%10d bytes)\n", allocated_histogram_[i].name(), |
2068 allocated_histogram_[i].number(), | 2073 allocated_histogram_[i].number(), |
2069 allocated_histogram_[i].bytes()); | 2074 allocated_histogram_[i].bytes()); |
2070 } | 2075 } |
2071 } | 2076 } |
2072 PrintF("\n"); | 2077 PrintF("\n"); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 prev_pc <= code->instruction_end()); | 2783 prev_pc <= code->instruction_end()); |
2779 delta += static_cast<int>(code->instruction_end() - prev_pc); | 2784 delta += static_cast<int>(code->instruction_end() - prev_pc); |
2780 EnterComment(isolate, "NoComment", delta); | 2785 EnterComment(isolate, "NoComment", delta); |
2781 } | 2786 } |
2782 } | 2787 } |
2783 } | 2788 } |
2784 | 2789 |
2785 | 2790 |
2786 void PagedSpace::ReportStatistics() { | 2791 void PagedSpace::ReportStatistics() { |
2787 int pct = static_cast<int>(Available() * 100 / Capacity()); | 2792 int pct = static_cast<int>(Available() * 100 / Capacity()); |
2788 PrintF(" capacity: %" V8PRIdPTR ", waste: %" V8PRIdPTR | 2793 PrintF(" capacity: %" V8_PTR_PREFIX |
2789 ", available: %" V8PRIdPTR ", %%%d\n", | 2794 "d" |
| 2795 ", waste: %" V8_PTR_PREFIX |
| 2796 "d" |
| 2797 ", available: %" V8_PTR_PREFIX "d, %%%d\n", |
2790 Capacity(), Waste(), Available(), pct); | 2798 Capacity(), Waste(), Available(), pct); |
2791 | 2799 |
2792 if (heap()->mark_compact_collector()->sweeping_in_progress()) { | 2800 if (heap()->mark_compact_collector()->sweeping_in_progress()) { |
2793 heap()->mark_compact_collector()->EnsureSweepingCompleted(); | 2801 heap()->mark_compact_collector()->EnsureSweepingCompleted(); |
2794 } | 2802 } |
2795 ClearHistograms(heap()->isolate()); | 2803 ClearHistograms(heap()->isolate()); |
2796 HeapObjectIterator obj_it(this); | 2804 HeapObjectIterator obj_it(this); |
2797 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) | 2805 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) |
2798 CollectHistogramInfo(obj); | 2806 CollectHistogramInfo(obj); |
2799 ReportHistogram(heap()->isolate(), true); | 2807 ReportHistogram(heap()->isolate(), true); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 void LargeObjectSpace::Print() { | 3083 void LargeObjectSpace::Print() { |
3076 OFStream os(stdout); | 3084 OFStream os(stdout); |
3077 LargeObjectIterator it(this); | 3085 LargeObjectIterator it(this); |
3078 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 3086 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
3079 obj->Print(os); | 3087 obj->Print(os); |
3080 } | 3088 } |
3081 } | 3089 } |
3082 | 3090 |
3083 | 3091 |
3084 void LargeObjectSpace::ReportStatistics() { | 3092 void LargeObjectSpace::ReportStatistics() { |
3085 PrintF(" size: %" V8PRIdPTR "\n", size_); | 3093 PrintF(" size: %" V8_PTR_PREFIX "d\n", size_); |
3086 int num_objects = 0; | 3094 int num_objects = 0; |
3087 ClearHistograms(heap()->isolate()); | 3095 ClearHistograms(heap()->isolate()); |
3088 LargeObjectIterator it(this); | 3096 LargeObjectIterator it(this); |
3089 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 3097 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
3090 num_objects++; | 3098 num_objects++; |
3091 CollectHistogramInfo(obj); | 3099 CollectHistogramInfo(obj); |
3092 } | 3100 } |
3093 | 3101 |
3094 PrintF( | 3102 PrintF( |
3095 " number of objects %d, " | 3103 " number of objects %d, " |
3096 "size of objects %" V8PRIdPTR "\n", | 3104 "size of objects %" V8_PTR_PREFIX "d\n", |
3097 num_objects, objects_size_); | 3105 num_objects, objects_size_); |
3098 if (num_objects > 0) ReportHistogram(heap()->isolate(), false); | 3106 if (num_objects > 0) ReportHistogram(heap()->isolate(), false); |
3099 } | 3107 } |
3100 | 3108 |
3101 | 3109 |
3102 void LargeObjectSpace::CollectCodeStatistics() { | 3110 void LargeObjectSpace::CollectCodeStatistics() { |
3103 Isolate* isolate = heap()->isolate(); | 3111 Isolate* isolate = heap()->isolate(); |
3104 LargeObjectIterator obj_it(this); | 3112 LargeObjectIterator obj_it(this); |
3105 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 3113 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
3106 if (obj->IsAbstractCode()) { | 3114 if (obj->IsAbstractCode()) { |
(...skipping 21 matching lines...) Expand all Loading... |
3128 object->ShortPrint(); | 3136 object->ShortPrint(); |
3129 PrintF("\n"); | 3137 PrintF("\n"); |
3130 } | 3138 } |
3131 printf(" --------------------------------------\n"); | 3139 printf(" --------------------------------------\n"); |
3132 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3140 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3133 } | 3141 } |
3134 | 3142 |
3135 #endif // DEBUG | 3143 #endif // DEBUG |
3136 } // namespace internal | 3144 } // namespace internal |
3137 } // namespace v8 | 3145 } // namespace v8 |
OLD | NEW |