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