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/compilation-cache.h" | 7 #include "src/compilation-cache.h" |
8 #include "src/counters.h" | 8 #include "src/counters.h" |
9 #include "src/heap/heap-inl.h" | 9 #include "src/heap/heap-inl.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 if (!feedback_metadata->is_empty()) { | 546 if (!feedback_metadata->is_empty()) { |
547 RecordFixedArrayHelper(sfi, feedback_metadata, | 547 RecordFixedArrayHelper(sfi, feedback_metadata, |
548 TYPE_FEEDBACK_METADATA_SUB_TYPE, 0); | 548 TYPE_FEEDBACK_METADATA_SUB_TYPE, 0); |
549 } | 549 } |
550 | 550 |
551 if (!sfi->OptimizedCodeMapIsCleared()) { | 551 if (!sfi->OptimizedCodeMapIsCleared()) { |
552 FixedArray* optimized_code_map = sfi->optimized_code_map(); | 552 FixedArray* optimized_code_map = sfi->optimized_code_map(); |
553 RecordFixedArrayHelper(sfi, optimized_code_map, OPTIMIZED_CODE_MAP_SUB_TYPE, | 553 RecordFixedArrayHelper(sfi, optimized_code_map, OPTIMIZED_CODE_MAP_SUB_TYPE, |
554 0); | 554 0); |
555 // Optimized code map should be small, so skip accounting. | 555 // Optimized code map should be small, so skip accounting. |
556 int len = optimized_code_map->length(); | |
557 for (int i = SharedFunctionInfo::kEntriesStart; i < len; | |
558 i += SharedFunctionInfo::kEntryLength) { | |
559 Object* slot = | |
560 optimized_code_map->get(i + SharedFunctionInfo::kLiteralsOffset); | |
561 LiteralsArray* literals = nullptr; | |
562 if (slot->IsWeakCell()) { | |
563 WeakCell* cell = WeakCell::cast(slot); | |
564 if (!cell->cleared()) { | |
565 literals = LiteralsArray::cast(cell->value()); | |
566 } | |
567 } else { | |
568 literals = LiteralsArray::cast(slot); | |
569 } | |
570 if (literals != nullptr) { | |
571 RecordFixedArrayHelper(sfi, literals, LITERALS_ARRAY_SUB_TYPE, 0); | |
572 RecordFixedArrayHelper(sfi, literals->feedback_vector(), | |
573 TYPE_FEEDBACK_VECTOR_SUB_TYPE, 0); | |
574 } | |
575 } | |
576 } | 556 } |
577 } | 557 } |
578 | 558 |
579 void ObjectStatsCollector::RecordJSFunctionDetails(JSFunction* function) { | 559 void ObjectStatsCollector::RecordJSFunctionDetails(JSFunction* function) { |
580 LiteralsArray* literals = function->literals(); | 560 LiteralsArray* literals = function->literals(); |
581 RecordFixedArrayHelper(function, literals, LITERALS_ARRAY_SUB_TYPE, 0); | 561 RecordFixedArrayHelper(function, literals, LITERALS_ARRAY_SUB_TYPE, 0); |
582 RecordFixedArrayHelper(function, literals->feedback_vector(), | 562 RecordFixedArrayHelper(function, literals->feedback_vector(), |
583 TYPE_FEEDBACK_VECTOR_SUB_TYPE, 0); | 563 TYPE_FEEDBACK_VECTOR_SUB_TYPE, 0); |
584 } | 564 } |
585 | 565 |
(...skipping 12 matching lines...) Expand all Loading... |
598 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); | 578 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); |
599 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); | 579 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); |
600 stats_->RecordFixedArraySubTypeStats( | 580 stats_->RecordFixedArraySubTypeStats( |
601 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, | 581 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, |
602 fast_cache->Size(), 0); | 582 fast_cache->Size(), 0); |
603 } | 583 } |
604 } | 584 } |
605 | 585 |
606 } // namespace internal | 586 } // namespace internal |
607 } // namespace v8 | 587 } // namespace v8 |
OLD | NEW |