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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DCHECK(obj->IsTypeFeedbackVector()); | 48 DCHECK(obj->IsTypeFeedbackVector()); |
49 return reinterpret_cast<TypeFeedbackVector*>(obj); | 49 return reinterpret_cast<TypeFeedbackVector*>(obj); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 int TypeFeedbackMetadata::GetSlotSize(FeedbackVectorSlotKind kind) { | 53 int TypeFeedbackMetadata::GetSlotSize(FeedbackVectorSlotKind kind) { |
54 DCHECK_NE(FeedbackVectorSlotKind::INVALID, kind); | 54 DCHECK_NE(FeedbackVectorSlotKind::INVALID, kind); |
55 DCHECK_NE(FeedbackVectorSlotKind::KINDS_NUMBER, kind); | 55 DCHECK_NE(FeedbackVectorSlotKind::KINDS_NUMBER, kind); |
56 if (kind == FeedbackVectorSlotKind::GENERAL || | 56 if (kind == FeedbackVectorSlotKind::GENERAL || |
57 kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC || | 57 kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC || |
58 kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC) { | 58 kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC || |
| 59 kind == FeedbackVectorSlotKind::CREATE_CLOSURE) { |
59 return 1; | 60 return 1; |
60 } | 61 } |
61 | 62 |
62 return 2; | 63 return 2; |
63 } | 64 } |
64 | 65 |
| 66 bool TypeFeedbackMetadata::SlotRequiresParameter(FeedbackVectorSlotKind kind) { |
| 67 switch (kind) { |
| 68 case FeedbackVectorSlotKind::CREATE_CLOSURE: |
| 69 return true; |
| 70 |
| 71 case FeedbackVectorSlotKind::CALL_IC: |
| 72 case FeedbackVectorSlotKind::LOAD_IC: |
| 73 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: |
| 74 case FeedbackVectorSlotKind::KEYED_LOAD_IC: |
| 75 case FeedbackVectorSlotKind::STORE_IC: |
| 76 case FeedbackVectorSlotKind::KEYED_STORE_IC: |
| 77 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC: |
| 78 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: |
| 79 case FeedbackVectorSlotKind::STORE_DATA_PROPERTY_IN_LITERAL_IC: |
| 80 case FeedbackVectorSlotKind::GENERAL: |
| 81 case FeedbackVectorSlotKind::INVALID: |
| 82 return false; |
| 83 |
| 84 case FeedbackVectorSlotKind::KINDS_NUMBER: |
| 85 break; |
| 86 } |
| 87 UNREACHABLE(); |
| 88 return false; |
| 89 } |
| 90 |
65 bool TypeFeedbackVector::is_empty() const { | 91 bool TypeFeedbackVector::is_empty() const { |
66 return length() == kReservedIndexCount; | 92 return length() == kReservedIndexCount; |
67 } | 93 } |
68 | 94 |
69 int TypeFeedbackVector::slot_count() const { | 95 int TypeFeedbackVector::slot_count() const { |
70 return length() - kReservedIndexCount; | 96 return length() - kReservedIndexCount; |
71 } | 97 } |
72 | 98 |
73 | 99 |
74 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { | 100 TypeFeedbackMetadata* TypeFeedbackVector::metadata() const { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (hint == BinaryOperationHint::kAny) { | 218 if (hint == BinaryOperationHint::kAny) { |
193 gen++; | 219 gen++; |
194 } else if (hint != BinaryOperationHint::kNone) { | 220 } else if (hint != BinaryOperationHint::kNone) { |
195 with++; | 221 with++; |
196 } | 222 } |
197 } | 223 } |
198 total++; | 224 total++; |
199 } | 225 } |
200 break; | 226 break; |
201 } | 227 } |
| 228 case FeedbackVectorSlotKind::CREATE_CLOSURE: |
202 case FeedbackVectorSlotKind::GENERAL: | 229 case FeedbackVectorSlotKind::GENERAL: |
203 break; | 230 break; |
204 case FeedbackVectorSlotKind::INVALID: | 231 case FeedbackVectorSlotKind::INVALID: |
205 case FeedbackVectorSlotKind::KINDS_NUMBER: | 232 case FeedbackVectorSlotKind::KINDS_NUMBER: |
206 UNREACHABLE(); | 233 UNREACHABLE(); |
207 break; | 234 break; |
208 } | 235 } |
209 } | 236 } |
210 | 237 |
211 *with_type_info = with; | 238 *with_type_info = with; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 int index = vector()->GetIndex(slot()) + 1; | 299 int index = vector()->GetIndex(slot()) + 1; |
273 vector()->set(index, feedback_extra, mode); | 300 vector()->set(index, feedback_extra, mode); |
274 } | 301 } |
275 | 302 |
276 | 303 |
277 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 304 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
278 } // namespace internal | 305 } // namespace internal |
279 } // namespace v8 | 306 } // namespace v8 |
280 | 307 |
281 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 308 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
OLD | NEW |