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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 FeedbackVectorSlotKind TypeFeedbackVector::GetKind( | 77 FeedbackVectorSlotKind TypeFeedbackVector::GetKind( |
78 FeedbackVectorSlot slot) const { | 78 FeedbackVectorSlot slot) const { |
79 DCHECK(!is_empty()); | 79 DCHECK(!is_empty()); |
80 return metadata()->GetKind(slot); | 80 return metadata()->GetKind(slot); |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) const { | 84 // static |
85 DCHECK(slot.ToInt() < slot_count()); | 85 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) { |
86 return kReservedIndexCount + slot.ToInt(); | 86 return kReservedIndexCount + slot.ToInt(); |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 // Conversion from an integer index to either a slot or an ic slot. The caller | 90 // Conversion from an integer index to either a slot or an ic slot. The caller |
91 // should know what kind she expects. | 91 // should know what kind she expects. |
92 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) const { | 92 // static |
93 DCHECK(index >= kReservedIndexCount && index < length()); | 93 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { |
| 94 DCHECK(index >= kReservedIndexCount); |
94 return FeedbackVectorSlot(index - kReservedIndexCount); | 95 return FeedbackVectorSlot(index - kReservedIndexCount); |
95 } | 96 } |
96 | 97 |
97 | 98 |
98 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { | 99 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { |
99 return get(GetIndex(slot)); | 100 return get(GetIndex(slot)); |
100 } | 101 } |
101 | 102 |
102 | 103 |
103 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, | 104 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int index = vector()->GetIndex(slot()) + 1; | 182 int index = vector()->GetIndex(slot()) + 1; |
182 vector()->set(index, feedback_extra, mode); | 183 vector()->set(index, feedback_extra, mode); |
183 } | 184 } |
184 | 185 |
185 | 186 |
186 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 187 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
187 } // namespace internal | 188 } // namespace internal |
188 } // namespace v8 | 189 } // namespace v8 |
189 | 190 |
190 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 191 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
OLD | NEW |