| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return length() - kReservedIndexCount; | 71 return length() - kReservedIndexCount; |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { | 75 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { |
| 76 return is_empty() ? TypeFeedbackMetadata::cast(GetHeap()->empty_fixed_array()) | 76 return is_empty() ? TypeFeedbackMetadata::cast(GetHeap()->empty_fixed_array()) |
| 77 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); | 77 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 // static | |
| 82 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) { | |
| 83 return kReservedIndexCount + slot.ToInt(); | |
| 84 } | |
| 85 | |
| 86 | |
| 87 // Conversion from an integer index to either a slot or an ic slot. The caller | 81 // Conversion from an integer index to either a slot or an ic slot. The caller |
| 88 // should know what kind she expects. | 82 // should know what kind she expects. |
| 89 // static | 83 // static |
| 90 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { | 84 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { |
| 91 DCHECK(index >= kReservedIndexCount); | 85 DCHECK(index >= kReservedIndexCount); |
| 92 return FeedbackVectorSlot(index - kReservedIndexCount); | 86 return FeedbackVectorSlot(index - kReservedIndexCount); |
| 93 } | 87 } |
| 94 | 88 |
| 95 | 89 |
| 96 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { | 90 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 int index = vector()->GetIndex(slot()) + 1; | 184 int index = vector()->GetIndex(slot()) + 1; |
| 191 vector()->set(index, feedback_extra, mode); | 185 vector()->set(index, feedback_extra, mode); |
| 192 } | 186 } |
| 193 | 187 |
| 194 | 188 |
| 195 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 189 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
| 196 } // namespace internal | 190 } // namespace internal |
| 197 } // namespace v8 | 191 } // namespace v8 |
| 198 | 192 |
| 199 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 193 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
| OLD | NEW |