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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 case CompareOperationFeedback::kSignedSmall: | 141 case CompareOperationFeedback::kSignedSmall: |
142 return CompareOperationHint::kSignedSmall; | 142 return CompareOperationHint::kSignedSmall; |
143 case CompareOperationFeedback::kNumber: | 143 case CompareOperationFeedback::kNumber: |
144 return CompareOperationHint::kNumber; | 144 return CompareOperationHint::kNumber; |
145 default: | 145 default: |
146 return CompareOperationHint::kAny; | 146 return CompareOperationHint::kAny; |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic, | 150 void TypeFeedbackVector::ComputeCounts(int* with_type_info, int* generic, |
| 151 int* vector_ic_count, |
151 bool code_is_interpreted) { | 152 bool code_is_interpreted) { |
152 Object* uninitialized_sentinel = | 153 Object* uninitialized_sentinel = |
153 TypeFeedbackVector::RawUninitializedSentinel(GetIsolate()); | 154 TypeFeedbackVector::RawUninitializedSentinel(GetIsolate()); |
154 Object* megamorphic_sentinel = | 155 Object* megamorphic_sentinel = |
155 *TypeFeedbackVector::MegamorphicSentinel(GetIsolate()); | 156 *TypeFeedbackVector::MegamorphicSentinel(GetIsolate()); |
156 int with = 0; | 157 int with = 0; |
157 int gen = 0; | 158 int gen = 0; |
| 159 int total = 0; |
158 TypeFeedbackMetadataIterator iter(metadata()); | 160 TypeFeedbackMetadataIterator iter(metadata()); |
159 while (iter.HasNext()) { | 161 while (iter.HasNext()) { |
160 FeedbackVectorSlot slot = iter.Next(); | 162 FeedbackVectorSlot slot = iter.Next(); |
161 FeedbackVectorSlotKind kind = iter.kind(); | 163 FeedbackVectorSlotKind kind = iter.kind(); |
162 | 164 |
163 Object* obj = Get(slot); | 165 Object* obj = Get(slot); |
164 if (obj != uninitialized_sentinel && | 166 if (kind == FeedbackVectorSlotKind::GENERAL) { |
165 kind != FeedbackVectorSlotKind::GENERAL) { | 167 continue; |
| 168 } |
| 169 total++; |
| 170 |
| 171 if (obj != uninitialized_sentinel) { |
166 if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC || | 172 if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC || |
167 kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) { | 173 kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) { |
168 // If we are not running interpreted code, we need to ignore | 174 // If we are not running interpreted code, we need to ignore |
169 // the special ic slots for binaryop/compare used by the | 175 // the special ic slots for binaryop/compare used by the |
170 // interpreter. | 176 // interpreter. |
171 // TODO(mvstanton): Remove code_is_interpreted when full code | 177 // TODO(mvstanton): Remove code_is_interpreted when full code |
172 // is retired from service. | 178 // is retired from service. |
173 if (!code_is_interpreted) continue; | 179 if (!code_is_interpreted) continue; |
174 | 180 |
175 DCHECK(obj->IsSmi()); | 181 DCHECK(obj->IsSmi()); |
(...skipping 19 matching lines...) Expand all Loading... |
195 } else if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) { | 201 } else if (obj->IsWeakCell() || obj->IsFixedArray() || obj->IsString()) { |
196 with++; | 202 with++; |
197 } else if (obj == megamorphic_sentinel) { | 203 } else if (obj == megamorphic_sentinel) { |
198 gen++; | 204 gen++; |
199 } | 205 } |
200 } | 206 } |
201 } | 207 } |
202 | 208 |
203 *with_type_info = with; | 209 *with_type_info = with; |
204 *generic = gen; | 210 *generic = gen; |
| 211 *vector_ic_count = total; |
205 } | 212 } |
206 | 213 |
207 Handle<Symbol> TypeFeedbackVector::UninitializedSentinel(Isolate* isolate) { | 214 Handle<Symbol> TypeFeedbackVector::UninitializedSentinel(Isolate* isolate) { |
208 return isolate->factory()->uninitialized_symbol(); | 215 return isolate->factory()->uninitialized_symbol(); |
209 } | 216 } |
210 | 217 |
211 Handle<Symbol> TypeFeedbackVector::MegamorphicSentinel(Isolate* isolate) { | 218 Handle<Symbol> TypeFeedbackVector::MegamorphicSentinel(Isolate* isolate) { |
212 return isolate->factory()->megamorphic_symbol(); | 219 return isolate->factory()->megamorphic_symbol(); |
213 } | 220 } |
214 | 221 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 int index = vector()->GetIndex(slot()) + 1; | 270 int index = vector()->GetIndex(slot()) + 1; |
264 vector()->set(index, feedback_extra, mode); | 271 vector()->set(index, feedback_extra, mode); |
265 } | 272 } |
266 | 273 |
267 | 274 |
268 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 275 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
269 } // namespace internal | 276 } // namespace internal |
270 } // namespace v8 | 277 } // namespace v8 |
271 | 278 |
272 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 279 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
OLD | NEW |