Chromium Code Reviews| Index: src/type-feedback-vector-inl.h |
| diff --git a/src/type-feedback-vector-inl.h b/src/type-feedback-vector-inl.h |
| index fed28b671e5d3c3555b56fa22f1eae8fdb5fcdf7..55a8af9443ddd308d98aa8bb840112aac8e43e4a 100644 |
| --- a/src/type-feedback-vector-inl.h |
| +++ b/src/type-feedback-vector-inl.h |
| @@ -81,35 +81,6 @@ FeedbackVectorSlotKind TypeFeedbackVector::GetKind( |
| } |
| -int TypeFeedbackVector::ic_with_type_info_count() { |
| - return length() > 0 ? Smi::cast(get(kWithTypesIndex))->value() : 0; |
| -} |
| - |
| - |
| -void TypeFeedbackVector::change_ic_with_type_info_count(int delta) { |
| - if (delta == 0) return; |
| - int value = ic_with_type_info_count() + delta; |
| - // Could go negative because of the debugger. |
| - if (value >= 0) { |
| - set(kWithTypesIndex, Smi::FromInt(value)); |
| - } |
| -} |
| - |
| - |
| -int TypeFeedbackVector::ic_generic_count() { |
| - return length() > 0 ? Smi::cast(get(kGenericCountIndex))->value() : 0; |
| -} |
| - |
| - |
| -void TypeFeedbackVector::change_ic_generic_count(int delta) { |
| - if (delta == 0) return; |
| - int value = ic_generic_count() + delta; |
| - if (value >= 0) { |
| - set(kGenericCountIndex, Smi::FromInt(value)); |
| - } |
| -} |
| - |
| - |
| int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) const { |
| DCHECK(slot.ToInt() < slot_count()); |
| return kReservedIndexCount + slot.ToInt(); |
| @@ -135,6 +106,34 @@ void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, |
| } |
| +void TypeFeedbackVector::compute_counts(int* with_type_info, int* generic) { |
|
Benedikt Meurer
2015/12/09 07:23:02
ComputeCounts
mvstanton
2015/12/09 07:37:31
Done.
|
| + Object* uninitialized_sentinel = |
| + TypeFeedbackVector::RawUninitializedSentinel(GetIsolate()); |
| + Object* megamorphic_sentinel = |
| + *TypeFeedbackVector::MegamorphicSentinel(GetIsolate()); |
| + int with = 0; |
| + int gen = 0; |
| + TypeFeedbackMetadataIterator iter(metadata()); |
| + while (iter.HasNext()) { |
| + FeedbackVectorSlot slot = iter.Next(); |
| + FeedbackVectorSlotKind kind = iter.kind(); |
| + |
| + Object* obj = Get(slot); |
| + if (obj != uninitialized_sentinel && |
| + kind != FeedbackVectorSlotKind::GENERAL) { |
| + if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) { |
| + with++; |
| + } else if (obj == megamorphic_sentinel) { |
| + gen++; |
| + } |
| + } |
| + } |
| + |
| + *with_type_info = with; |
| + *generic = gen; |
| +} |
| + |
| + |
| Handle<Object> TypeFeedbackVector::UninitializedSentinel(Isolate* isolate) { |
| return isolate->factory()->uninitialized_symbol(); |
| } |