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 #include "src/heap/object-stats.h" | 5 #include "src/heap/object-stats.h" |
6 | 6 |
7 #include "src/counters.h" | 7 #include "src/counters.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/utils.h" | 10 #include "src/utils.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Heap* heap = map->GetHeap(); | 180 Heap* heap = map->GetHeap(); |
181 Map* map_obj = Map::cast(obj); | 181 Map* map_obj = Map::cast(obj); |
182 DCHECK(map->instance_type() == MAP_TYPE); | 182 DCHECK(map->instance_type() == MAP_TYPE); |
183 DescriptorArray* array = map_obj->instance_descriptors(); | 183 DescriptorArray* array = map_obj->instance_descriptors(); |
184 if (map_obj->owns_descriptors() && array != heap->empty_descriptor_array()) { | 184 if (map_obj->owns_descriptors() && array != heap->empty_descriptor_array()) { |
185 int fixed_array_size = array->Size(); | 185 int fixed_array_size = array->Size(); |
186 heap->object_stats_->RecordFixedArraySubTypeStats(DESCRIPTOR_ARRAY_SUB_TYPE, | 186 heap->object_stats_->RecordFixedArraySubTypeStats(DESCRIPTOR_ARRAY_SUB_TYPE, |
187 fixed_array_size); | 187 fixed_array_size); |
188 } | 188 } |
189 if (map_obj->has_code_cache()) { | 189 if (map_obj->has_code_cache()) { |
190 CodeCache* cache = CodeCache::cast(map_obj->code_cache()); | 190 FixedArray* cache = FixedArray::cast(map_obj->code_cache()); |
191 heap->object_stats_->RecordFixedArraySubTypeStats( | 191 heap->object_stats_->RecordFixedArraySubTypeStats(MAP_CODE_CACHE_SUB_TYPE, |
192 MAP_CODE_CACHE_SUB_TYPE, cache->default_cache()->Size()); | 192 cache->Size()); |
193 if (!cache->normal_type_cache()->IsUndefined()) { | |
194 heap->object_stats_->RecordFixedArraySubTypeStats( | |
195 MAP_CODE_CACHE_SUB_TYPE, | |
196 FixedArray::cast(cache->normal_type_cache())->Size()); | |
197 } | |
198 } | 193 } |
199 VisitBase(kVisitMap, map, obj); | 194 VisitBase(kVisitMap, map, obj); |
200 } | 195 } |
201 | 196 |
202 | 197 |
203 template <> | 198 template <> |
204 void ObjectStatsVisitor::Visit<ObjectStatsVisitor::kVisitCode>( | 199 void ObjectStatsVisitor::Visit<ObjectStatsVisitor::kVisitCode>( |
205 Map* map, HeapObject* obj) { | 200 Map* map, HeapObject* obj) { |
206 Heap* heap = map->GetHeap(); | 201 Heap* heap = map->GetHeap(); |
207 int object_size = obj->Size(); | 202 int object_size = obj->Size(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // Copy the original visitor table to make call-through possible. After we | 238 // Copy the original visitor table to make call-through possible. After we |
244 // preserved a copy locally, we patch the original table to call us. | 239 // preserved a copy locally, we patch the original table to call us. |
245 table_.CopyFrom(original); | 240 table_.CopyFrom(original); |
246 #define COUNT_FUNCTION(id) original->Register(kVisit##id, Visit<kVisit##id>); | 241 #define COUNT_FUNCTION(id) original->Register(kVisit##id, Visit<kVisit##id>); |
247 VISITOR_ID_LIST(COUNT_FUNCTION) | 242 VISITOR_ID_LIST(COUNT_FUNCTION) |
248 #undef COUNT_FUNCTION | 243 #undef COUNT_FUNCTION |
249 } | 244 } |
250 | 245 |
251 } // namespace internal | 246 } // namespace internal |
252 } // namespace v8 | 247 } // namespace v8 |
OLD | NEW |