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/globals.h" | 8 #include "src/globals.h" |
9 #include "src/type-feedback-vector.h" | 9 #include "src/type-feedback-vector.h" |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 return TypeFeedbackMetadata::cast(get(kMetadataIndex)); | 75 return TypeFeedbackMetadata::cast(get(kMetadataIndex)); |
76 } | 76 } |
77 | 77 |
78 int TypeFeedbackVector::invocation_count() const { | 78 int TypeFeedbackVector::invocation_count() const { |
79 return Smi::cast(get(kInvocationCountIndex))->value(); | 79 return Smi::cast(get(kInvocationCountIndex))->value(); |
80 } | 80 } |
81 | 81 |
82 // Conversion from an integer index to either a slot or an ic slot. | 82 // Conversion from an integer index to either a slot or an ic slot. |
83 // static | 83 // static |
84 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { | 84 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) { |
85 DCHECK(index >= kReservedIndexCount); | 85 DCHECK_GE(index, kReservedIndexCount); |
86 return FeedbackVectorSlot(index - kReservedIndexCount); | 86 return FeedbackVectorSlot(index - kReservedIndexCount); |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { | 90 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { |
91 return get(GetIndex(slot)); | 91 return get(GetIndex(slot)); |
92 } | 92 } |
93 | 93 |
94 | 94 |
95 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, | 95 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 FeedbackVectorSlot slot = iter.Next(); | 152 FeedbackVectorSlot slot = iter.Next(); |
153 FeedbackVectorSlotKind kind = iter.kind(); | 153 FeedbackVectorSlotKind kind = iter.kind(); |
154 | 154 |
155 Object* const obj = Get(slot); | 155 Object* const obj = Get(slot); |
156 switch (kind) { | 156 switch (kind) { |
157 case FeedbackVectorSlotKind::CALL_IC: | 157 case FeedbackVectorSlotKind::CALL_IC: |
158 case FeedbackVectorSlotKind::LOAD_IC: | 158 case FeedbackVectorSlotKind::LOAD_IC: |
159 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: | 159 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: |
160 case FeedbackVectorSlotKind::KEYED_LOAD_IC: | 160 case FeedbackVectorSlotKind::KEYED_LOAD_IC: |
161 case FeedbackVectorSlotKind::STORE_IC: | 161 case FeedbackVectorSlotKind::STORE_IC: |
162 case FeedbackVectorSlotKind::KEYED_STORE_IC: { | 162 case FeedbackVectorSlotKind::KEYED_STORE_IC: |
| 163 case FeedbackVectorSlotKind::STORE_DATA_PROPERTY_IN_LITERAL_IC: { |
163 if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) { | 164 if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) { |
164 with++; | 165 with++; |
165 } else if (obj == megamorphic_sentinel) { | 166 } else if (obj == megamorphic_sentinel) { |
166 gen++; | 167 gen++; |
167 } | 168 } |
168 total++; | 169 total++; |
169 break; | 170 break; |
170 } | 171 } |
171 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: | 172 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: |
172 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: { | 173 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 int index = vector()->GetIndex(slot()) + 1; | 272 int index = vector()->GetIndex(slot()) + 1; |
272 vector()->set(index, feedback_extra, mode); | 273 vector()->set(index, feedback_extra, mode); |
273 } | 274 } |
274 | 275 |
275 | 276 |
276 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 277 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
277 } // namespace internal | 278 } // namespace internal |
278 } // namespace v8 | 279 } // namespace v8 |
279 | 280 |
280 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 281 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
OLD | NEW |