| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_HEAP_OBJECT_STATS_H_ | 5 #ifndef V8_HEAP_OBJECT_STATS_H_ |
| 6 #define V8_HEAP_OBJECT_STATS_H_ | 6 #define V8_HEAP_OBJECT_STATS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 Isolate* isolate(); | 93 Isolate* isolate(); |
| 94 Heap* heap() { return heap_; } | 94 Heap* heap() { return heap_; } |
| 95 | 95 |
| 96 private: | 96 private: |
| 97 static const int kFirstBucketShift = 5; // <=32 | 97 static const int kFirstBucketShift = 5; // <=32 |
| 98 static const int kLastBucketShift = 19; // >512k | 98 static const int kLastBucketShift = 19; // >512k |
| 99 static const int kFirstBucket = 1 << kFirstBucketShift; | 99 static const int kFirstBucket = 1 << kFirstBucketShift; |
| 100 static const int kLastBucket = 1 << kLastBucketShift; | 100 static const int kLastBucket = 1 << kLastBucketShift; |
| 101 static const int kNumberOfBuckets = kLastBucketShift - kFirstBucketShift + 1; | 101 static const int kNumberOfBuckets = kLastBucketShift - kFirstBucketShift + 1; |
| 102 | 102 |
| 103 void PrintKeyAndId(const char* key, int gc_count); |
| 104 // The following functions are excluded from inline to reduce the overall |
| 105 // binary size of VB. On x64 this save around 80KB. |
| 106 V8_NOINLINE void PrintInstanceTypeJSON(const char* key, int gc_count, |
| 107 const char* name, int index); |
| 108 V8_NOINLINE void DumpInstanceTypeData(std::stringstream& stream, |
| 109 const char* name, int index); |
| 110 |
| 103 int HistogramIndexFromSize(size_t size) { | 111 int HistogramIndexFromSize(size_t size) { |
| 104 if (size == 0) return 0; | 112 if (size == 0) return 0; |
| 105 int idx = static_cast<int>(base::ieee754::log2(static_cast<double>(size))) - | 113 int idx = static_cast<int>(base::ieee754::log2(static_cast<double>(size))) - |
| 106 kFirstBucketShift; | 114 kFirstBucketShift; |
| 107 return idx < 0 ? 0 : idx; | 115 return idx < 0 ? 0 : idx; |
| 108 } | 116 } |
| 109 | 117 |
| 110 Heap* heap_; | 118 Heap* heap_; |
| 111 // Object counts and used memory by InstanceType. | 119 // Object counts and used memory by InstanceType. |
| 112 size_t object_counts_[OBJECT_STATS_COUNT]; | 120 size_t object_counts_[OBJECT_STATS_COUNT]; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 Heap* heap_; | 162 Heap* heap_; |
| 155 ObjectStats* stats_; | 163 ObjectStats* stats_; |
| 156 | 164 |
| 157 friend class ObjectStatsCollector::CompilationCacheTableVisitor; | 165 friend class ObjectStatsCollector::CompilationCacheTableVisitor; |
| 158 }; | 166 }; |
| 159 | 167 |
| 160 } // namespace internal | 168 } // namespace internal |
| 161 } // namespace v8 | 169 } // namespace v8 |
| 162 | 170 |
| 163 #endif // V8_HEAP_OBJECT_STATS_H_ | 171 #endif // V8_HEAP_OBJECT_STATS_H_ |
| OLD | NEW |