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/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void ObjectStatsCollector::CollectStatistics(HeapObject* obj) { | 164 void ObjectStatsCollector::CollectStatistics(HeapObject* obj) { |
165 Map* map = obj->map(); | 165 Map* map = obj->map(); |
166 | 166 |
167 // Record for the InstanceType. | 167 // Record for the InstanceType. |
168 int object_size = obj->Size(); | 168 int object_size = obj->Size(); |
169 stats_->RecordObjectStats(map->instance_type(), object_size); | 169 stats_->RecordObjectStats(map->instance_type(), object_size); |
170 | 170 |
171 // Record specific sub types where possible. | 171 // Record specific sub types where possible. |
172 if (obj->IsMap()) RecordMapDetails(Map::cast(obj)); | 172 if (obj->IsMap()) RecordMapDetails(Map::cast(obj)); |
| 173 if (obj->IsBytecodeArray()) { |
| 174 RecordBytecodeArrayDetails(BytecodeArray::cast(obj)); |
| 175 } |
173 if (obj->IsCode()) RecordCodeDetails(Code::cast(obj)); | 176 if (obj->IsCode()) RecordCodeDetails(Code::cast(obj)); |
174 if (obj->IsSharedFunctionInfo()) { | 177 if (obj->IsSharedFunctionInfo()) { |
175 RecordSharedFunctionInfoDetails(SharedFunctionInfo::cast(obj)); | 178 RecordSharedFunctionInfoDetails(SharedFunctionInfo::cast(obj)); |
176 } | 179 } |
177 if (obj->IsFixedArray()) RecordFixedArrayDetails(FixedArray::cast(obj)); | 180 if (obj->IsFixedArray()) RecordFixedArrayDetails(FixedArray::cast(obj)); |
178 if (obj->IsJSObject()) RecordJSObjectDetails(JSObject::cast(obj)); | 181 if (obj->IsJSObject()) RecordJSObjectDetails(JSObject::cast(obj)); |
179 if (obj->IsJSWeakCollection()) { | 182 if (obj->IsJSWeakCollection()) { |
180 RecordJSWeakCollectionDetails(JSWeakCollection::cast(obj)); | 183 RecordJSWeakCollectionDetails(JSWeakCollection::cast(obj)); |
181 } | 184 } |
182 if (obj->IsJSCollection()) { | 185 if (obj->IsJSCollection()) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 PrototypeInfo* info = PrototypeInfo::cast(map_obj->prototype_info()); | 380 PrototypeInfo* info = PrototypeInfo::cast(map_obj->prototype_info()); |
378 Object* users = info->prototype_users(); | 381 Object* users = info->prototype_users(); |
379 if (users->IsWeakFixedArray()) { | 382 if (users->IsWeakFixedArray()) { |
380 RecordFixedArrayHelper(map_obj, WeakFixedArray::cast(users), | 383 RecordFixedArrayHelper(map_obj, WeakFixedArray::cast(users), |
381 PROTOTYPE_USERS_SUB_TYPE, 0); | 384 PROTOTYPE_USERS_SUB_TYPE, 0); |
382 } | 385 } |
383 } | 386 } |
384 } | 387 } |
385 } | 388 } |
386 | 389 |
| 390 void ObjectStatsCollector::RecordBytecodeArrayDetails(BytecodeArray* obj) { |
| 391 RecordFixedArrayHelper(obj, obj->constant_pool(), |
| 392 BYTECODE_ARRAY_CONSTANT_POOL_SUB_TYPE, 0); |
| 393 RecordFixedArrayHelper(obj, obj->handler_table(), |
| 394 BYTECODE_ARRAY_HANDLER_TABLE_SUB_TYPE, 0); |
| 395 } |
| 396 |
387 void ObjectStatsCollector::RecordCodeDetails(Code* code) { | 397 void ObjectStatsCollector::RecordCodeDetails(Code* code) { |
388 stats_->RecordCodeSubTypeStats(code->kind(), code->GetAge(), code->Size()); | 398 stats_->RecordCodeSubTypeStats(code->kind(), code->GetAge(), code->Size()); |
389 RecordFixedArrayHelper(code, code->deoptimization_data(), | 399 RecordFixedArrayHelper(code, code->deoptimization_data(), |
390 DEOPTIMIZATION_DATA_SUB_TYPE, 0); | 400 DEOPTIMIZATION_DATA_SUB_TYPE, 0); |
391 RecordFixedArrayHelper(code, code->handler_table(), HANDLER_TABLE_SUB_TYPE, | 401 RecordFixedArrayHelper(code, code->handler_table(), HANDLER_TABLE_SUB_TYPE, |
392 0); | 402 0); |
393 int const mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 403 int const mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
394 for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { | 404 for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { |
395 RelocInfo::Mode mode = it.rinfo()->rmode(); | 405 RelocInfo::Mode mode = it.rinfo()->rmode(); |
396 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 406 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); | 480 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); |
471 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); | 481 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); |
472 stats_->RecordFixedArraySubTypeStats( | 482 stats_->RecordFixedArraySubTypeStats( |
473 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, | 483 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, |
474 fast_cache->Size(), 0); | 484 fast_cache->Size(), 0); |
475 } | 485 } |
476 } | 486 } |
477 | 487 |
478 } // namespace internal | 488 } // namespace internal |
479 } // namespace v8 | 489 } // namespace v8 |
OLD | NEW |