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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 } | 2035 } |
2033 } | 2036 } |
2034 LOG(isolate, HeapSampleEndEvent("NewSpace", description)); | 2037 LOG(isolate, HeapSampleEndEvent("NewSpace", description)); |
2035 } | 2038 } |
2036 | 2039 |
2037 | 2040 |
2038 void NewSpace::ReportStatistics() { | 2041 void NewSpace::ReportStatistics() { |
2039 #ifdef DEBUG | 2042 #ifdef DEBUG |
2040 if (FLAG_heap_stats) { | 2043 if (FLAG_heap_stats) { |
2041 float pct = static_cast<float>(Available()) / TotalCapacity(); | 2044 float pct = static_cast<float>(Available()) / TotalCapacity(); |
2042 PrintF(" capacity: %" V8PRIdPTR ", available: %" V8PRIdPTR ", %%%d\n", | 2045 PrintF(" capacity: %" V8_PTR_PREFIX |
| 2046 "d" |
| 2047 ", available: %" V8_PTR_PREFIX "d, %%%d\n", |
2043 TotalCapacity(), Available(), static_cast<int>(pct * 100)); | 2048 TotalCapacity(), Available(), static_cast<int>(pct * 100)); |
2044 PrintF("\n Object Histogram:\n"); | 2049 PrintF("\n Object Histogram:\n"); |
2045 for (int i = 0; i <= LAST_TYPE; i++) { | 2050 for (int i = 0; i <= LAST_TYPE; i++) { |
2046 if (allocated_histogram_[i].number() > 0) { | 2051 if (allocated_histogram_[i].number() > 0) { |
2047 PrintF(" %-34s%10d (%10d bytes)\n", allocated_histogram_[i].name(), | 2052 PrintF(" %-34s%10d (%10d bytes)\n", allocated_histogram_[i].name(), |
2048 allocated_histogram_[i].number(), | 2053 allocated_histogram_[i].number(), |
2049 allocated_histogram_[i].bytes()); | 2054 allocated_histogram_[i].bytes()); |
2050 } | 2055 } |
2051 } | 2056 } |
2052 PrintF("\n"); | 2057 PrintF("\n"); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2758 prev_pc <= code->instruction_end()); | 2763 prev_pc <= code->instruction_end()); |
2759 delta += static_cast<int>(code->instruction_end() - prev_pc); | 2764 delta += static_cast<int>(code->instruction_end() - prev_pc); |
2760 EnterComment(isolate, "NoComment", delta); | 2765 EnterComment(isolate, "NoComment", delta); |
2761 } | 2766 } |
2762 } | 2767 } |
2763 } | 2768 } |
2764 | 2769 |
2765 | 2770 |
2766 void PagedSpace::ReportStatistics() { | 2771 void PagedSpace::ReportStatistics() { |
2767 int pct = static_cast<int>(Available() * 100 / Capacity()); | 2772 int pct = static_cast<int>(Available() * 100 / Capacity()); |
2768 PrintF(" capacity: %" V8PRIdPTR ", waste: %" V8PRIdPTR | 2773 PrintF(" capacity: %" V8_PTR_PREFIX |
2769 ", available: %" V8PRIdPTR ", %%%d\n", | 2774 "d" |
| 2775 ", waste: %" V8_PTR_PREFIX |
| 2776 "d" |
| 2777 ", available: %" V8_PTR_PREFIX "d, %%%d\n", |
2770 Capacity(), Waste(), Available(), pct); | 2778 Capacity(), Waste(), Available(), pct); |
2771 | 2779 |
2772 if (heap()->mark_compact_collector()->sweeping_in_progress()) { | 2780 if (heap()->mark_compact_collector()->sweeping_in_progress()) { |
2773 heap()->mark_compact_collector()->EnsureSweepingCompleted(); | 2781 heap()->mark_compact_collector()->EnsureSweepingCompleted(); |
2774 } | 2782 } |
2775 ClearHistograms(heap()->isolate()); | 2783 ClearHistograms(heap()->isolate()); |
2776 HeapObjectIterator obj_it(this); | 2784 HeapObjectIterator obj_it(this); |
2777 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) | 2785 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) |
2778 CollectHistogramInfo(obj); | 2786 CollectHistogramInfo(obj); |
2779 ReportHistogram(heap()->isolate(), true); | 2787 ReportHistogram(heap()->isolate(), true); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3060 void LargeObjectSpace::Print() { | 3068 void LargeObjectSpace::Print() { |
3061 OFStream os(stdout); | 3069 OFStream os(stdout); |
3062 LargeObjectIterator it(this); | 3070 LargeObjectIterator it(this); |
3063 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 3071 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
3064 obj->Print(os); | 3072 obj->Print(os); |
3065 } | 3073 } |
3066 } | 3074 } |
3067 | 3075 |
3068 | 3076 |
3069 void LargeObjectSpace::ReportStatistics() { | 3077 void LargeObjectSpace::ReportStatistics() { |
3070 PrintF(" size: %" V8PRIdPTR "\n", size_); | 3078 PrintF(" size: %" V8_PTR_PREFIX "d\n", size_); |
3071 int num_objects = 0; | 3079 int num_objects = 0; |
3072 ClearHistograms(heap()->isolate()); | 3080 ClearHistograms(heap()->isolate()); |
3073 LargeObjectIterator it(this); | 3081 LargeObjectIterator it(this); |
3074 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 3082 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
3075 num_objects++; | 3083 num_objects++; |
3076 CollectHistogramInfo(obj); | 3084 CollectHistogramInfo(obj); |
3077 } | 3085 } |
3078 | 3086 |
3079 PrintF( | 3087 PrintF( |
3080 " number of objects %d, " | 3088 " number of objects %d, " |
3081 "size of objects %" V8PRIdPTR "\n", | 3089 "size of objects %" V8_PTR_PREFIX "d\n", |
3082 num_objects, objects_size_); | 3090 num_objects, objects_size_); |
3083 if (num_objects > 0) ReportHistogram(heap()->isolate(), false); | 3091 if (num_objects > 0) ReportHistogram(heap()->isolate(), false); |
3084 } | 3092 } |
3085 | 3093 |
3086 | 3094 |
3087 void LargeObjectSpace::CollectCodeStatistics() { | 3095 void LargeObjectSpace::CollectCodeStatistics() { |
3088 Isolate* isolate = heap()->isolate(); | 3096 Isolate* isolate = heap()->isolate(); |
3089 LargeObjectIterator obj_it(this); | 3097 LargeObjectIterator obj_it(this); |
3090 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 3098 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
3091 if (obj->IsAbstractCode()) { | 3099 if (obj->IsAbstractCode()) { |
(...skipping 21 matching lines...) Expand all Loading... |
3113 object->ShortPrint(); | 3121 object->ShortPrint(); |
3114 PrintF("\n"); | 3122 PrintF("\n"); |
3115 } | 3123 } |
3116 printf(" --------------------------------------\n"); | 3124 printf(" --------------------------------------\n"); |
3117 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3125 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3118 } | 3126 } |
3119 | 3127 |
3120 #endif // DEBUG | 3128 #endif // DEBUG |
3121 } // namespace internal | 3129 } // namespace internal |
3122 } // namespace v8 | 3130 } // namespace v8 |
OLD | NEW |