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 } |
554 } | 574 } |
555 } | 575 } |
556 | 576 |
557 void ObjectStatsCollector::RecordJSFunctionDetails(JSFunction* function) { | 577 void ObjectStatsCollector::RecordJSFunctionDetails(JSFunction* function) { |
558 LiteralsArray* literals = function->literals(); | 578 LiteralsArray* literals = function->literals(); |
559 RecordFixedArrayHelper(function, literals, LITERALS_ARRAY_SUB_TYPE, 0); | 579 RecordFixedArrayHelper(function, literals, LITERALS_ARRAY_SUB_TYPE, 0); |
560 RecordFixedArrayHelper(function, literals->feedback_vector(), | 580 RecordFixedArrayHelper(function, literals->feedback_vector(), |
561 TYPE_FEEDBACK_VECTOR_SUB_TYPE, 0); | 581 TYPE_FEEDBACK_VECTOR_SUB_TYPE, 0); |
562 } | 582 } |
563 | 583 |
(...skipping 12 matching lines...) Expand all Loading... |
576 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); | 596 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); |
577 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); | 597 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); |
578 stats_->RecordFixedArraySubTypeStats( | 598 stats_->RecordFixedArraySubTypeStats( |
579 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, | 599 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, |
580 fast_cache->Size(), 0); | 600 fast_cache->Size(), 0); |
581 } | 601 } |
582 } | 602 } |
583 | 603 |
584 } // namespace internal | 604 } // namespace internal |
585 } // namespace v8 | 605 } // namespace v8 |
OLD | NEW |