OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
6 #define V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 6 #define V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
7 | 7 |
8 #include "src/type-feedback-vector.h" | 8 #include "src/type-feedback-vector.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return false; | 70 return false; |
71 | 71 |
72 case FeedbackVectorSlotKind::KINDS_NUMBER: | 72 case FeedbackVectorSlotKind::KINDS_NUMBER: |
73 break; | 73 break; |
74 } | 74 } |
75 UNREACHABLE(); | 75 UNREACHABLE(); |
76 return false; | 76 return false; |
77 } | 77 } |
78 | 78 |
79 bool TypeFeedbackVector::is_empty() const { | 79 bool TypeFeedbackVector::is_empty() const { |
80 if (length() == 0) return true; | 80 return length() == kReservedIndexCount; |
81 DCHECK(length() > kReservedIndexCount); | |
82 return false; | |
83 } | 81 } |
84 | 82 |
85 | |
86 int TypeFeedbackVector::slot_count() const { | 83 int TypeFeedbackVector::slot_count() const { |
87 if (length() == 0) return 0; | |
88 DCHECK(length() > kReservedIndexCount); | |
89 return length() - kReservedIndexCount; | 84 return length() - kReservedIndexCount; |
90 } | 85 } |
91 | 86 |
92 | 87 |
93 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { | 88 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { |
94 return is_empty() ? TypeFeedbackMetadata::cast(GetHeap()->empty_fixed_array()) | 89 return TypeFeedbackMetadata::cast(get(kMetadataIndex)); |
95 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); | 90 } |
| 91 |
| 92 int TypeFeedbackVector::invocation_count() const { |
| 93 return Smi::cast(get(kInvocationCountIndex))->value(); |
96 } | 94 } |
97 | 95 |
98 // Conversion from an integer index to either a slot or an ic slot. | 96 // Conversion from an integer index to either a slot or an ic slot. |
99 // static | 97 // static |
100 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { | 98 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { |
101 DCHECK(index >= kReservedIndexCount); | 99 DCHECK(index >= kReservedIndexCount); |
102 return FeedbackVectorSlot(index - kReservedIndexCount); | 100 return FeedbackVectorSlot(index - kReservedIndexCount); |
103 } | 101 } |
104 | 102 |
105 | 103 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 int index = vector()->GetIndex(slot()) + 1; | 198 int index = vector()->GetIndex(slot()) + 1; |
201 vector()->set(index, feedback_extra, mode); | 199 vector()->set(index, feedback_extra, mode); |
202 } | 200 } |
203 | 201 |
204 | 202 |
205 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 203 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
206 } // namespace internal | 204 } // namespace internal |
207 } // namespace v8 | 205 } // namespace v8 |
208 | 206 |
209 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 207 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
OLD | NEW |