| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); | 73 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); |
| 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 // static | 83 |
| 84 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) { | 84 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) const { |
| 85 DCHECK(slot.ToInt() < slot_count()); |
| 85 return kReservedIndexCount + slot.ToInt(); | 86 return kReservedIndexCount + slot.ToInt(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 | 89 |
| 89 // 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 |
| 90 // should know what kind she expects. | 91 // should know what kind she expects. |
| 91 // static | 92 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) const { |
| 92 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { | 93 DCHECK(index >= kReservedIndexCount && index < length()); |
| 93 DCHECK(index >= kReservedIndexCount); | |
| 94 return FeedbackVectorSlot(index - kReservedIndexCount); | 94 return FeedbackVectorSlot(index - kReservedIndexCount); |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { | 98 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { |
| 99 return get(GetIndex(slot)); | 99 return get(GetIndex(slot)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, | 103 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; | 181 int index = vector()->GetIndex(slot()) + 1; |
| 182 vector()->set(index, feedback_extra, mode); | 182 vector()->set(index, feedback_extra, mode); |
| 183 } | 183 } |
| 184 | 184 |
| 185 | 185 |
| 186 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 186 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
| 187 } // namespace internal | 187 } // namespace internal |
| 188 } // namespace v8 | 188 } // namespace v8 |
| 189 | 189 |
| 190 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 190 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
| OLD | NEW |