OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_FEEDBACK_VECTOR_H_ | 5 #ifndef V8_FEEDBACK_VECTOR_H_ |
6 #define V8_FEEDBACK_VECTOR_H_ | 6 #define V8_FEEDBACK_VECTOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/base/logging.h" | 10 #include "src/base/logging.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 inline bool IsStoreOwnICKind(FeedbackSlotKind kind) { | 70 inline bool IsStoreOwnICKind(FeedbackSlotKind kind) { |
71 return kind == FeedbackSlotKind::kStoreOwnNamed; | 71 return kind == FeedbackSlotKind::kStoreOwnNamed; |
72 } | 72 } |
73 | 73 |
74 inline bool IsKeyedStoreICKind(FeedbackSlotKind kind) { | 74 inline bool IsKeyedStoreICKind(FeedbackSlotKind kind) { |
75 return kind == FeedbackSlotKind::kStoreKeyedSloppy || | 75 return kind == FeedbackSlotKind::kStoreKeyedSloppy || |
76 kind == FeedbackSlotKind::kStoreKeyedStrict; | 76 kind == FeedbackSlotKind::kStoreKeyedStrict; |
77 } | 77 } |
78 | 78 |
| 79 inline bool IsTypeProfileKind(FeedbackSlotKind kind) { |
| 80 return kind == FeedbackSlotKind::kTypeProfile; |
| 81 } |
| 82 |
79 inline TypeofMode GetTypeofModeFromSlotKind(FeedbackSlotKind kind) { | 83 inline TypeofMode GetTypeofModeFromSlotKind(FeedbackSlotKind kind) { |
80 DCHECK(IsLoadGlobalICKind(kind)); | 84 DCHECK(IsLoadGlobalICKind(kind)); |
81 return (kind == FeedbackSlotKind::kLoadGlobalInsideTypeof) | 85 return (kind == FeedbackSlotKind::kLoadGlobalInsideTypeof) |
82 ? INSIDE_TYPEOF | 86 ? INSIDE_TYPEOF |
83 : NOT_INSIDE_TYPEOF; | 87 : NOT_INSIDE_TYPEOF; |
84 } | 88 } |
85 | 89 |
86 inline LanguageMode GetLanguageModeFromSlotKind(FeedbackSlotKind kind) { | 90 inline LanguageMode GetLanguageModeFromSlotKind(FeedbackSlotKind kind) { |
87 DCHECK(IsStoreICKind(kind) || IsStoreOwnICKind(kind) || | 91 DCHECK(IsStoreICKind(kind) || IsStoreOwnICKind(kind) || |
88 IsKeyedStoreICKind(kind)); | 92 IsKeyedStoreICKind(kind)); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 312 |
309 // Conversion from an integer index to the underlying array to a slot. | 313 // Conversion from an integer index to the underlying array to a slot. |
310 static inline FeedbackSlot ToSlot(int index); | 314 static inline FeedbackSlot ToSlot(int index); |
311 inline Object* Get(FeedbackSlot slot) const; | 315 inline Object* Get(FeedbackSlot slot) const; |
312 inline void Set(FeedbackSlot slot, Object* value, | 316 inline void Set(FeedbackSlot slot, Object* value, |
313 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 317 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
314 | 318 |
315 // Returns slot kind for given slot. | 319 // Returns slot kind for given slot. |
316 FeedbackSlotKind GetKind(FeedbackSlot slot) const; | 320 FeedbackSlotKind GetKind(FeedbackSlot slot) const; |
317 | 321 |
| 322 FeedbackSlot GetTypeProfileSlot() const; |
| 323 |
318 static Handle<FeedbackVector> New(Isolate* isolate, | 324 static Handle<FeedbackVector> New(Isolate* isolate, |
319 Handle<SharedFunctionInfo> shared); | 325 Handle<SharedFunctionInfo> shared); |
320 | 326 |
321 static Handle<FeedbackVector> Copy(Isolate* isolate, | 327 static Handle<FeedbackVector> Copy(Isolate* isolate, |
322 Handle<FeedbackVector> vector); | 328 Handle<FeedbackVector> vector); |
323 | 329 |
324 #define DEFINE_SLOT_KIND_PREDICATE(Name) \ | 330 #define DEFINE_SLOT_KIND_PREDICATE(Name) \ |
325 bool Name(FeedbackSlot slot) const { return Name##Kind(GetKind(slot)); } | 331 bool Name(FeedbackSlot slot) const { return Name##Kind(GetKind(slot)); } |
326 | 332 |
327 DEFINE_SLOT_KIND_PREDICATE(IsCallIC) | 333 DEFINE_SLOT_KIND_PREDICATE(IsCallIC) |
328 DEFINE_SLOT_KIND_PREDICATE(IsLoadIC) | 334 DEFINE_SLOT_KIND_PREDICATE(IsLoadIC) |
329 DEFINE_SLOT_KIND_PREDICATE(IsLoadGlobalIC) | 335 DEFINE_SLOT_KIND_PREDICATE(IsLoadGlobalIC) |
330 DEFINE_SLOT_KIND_PREDICATE(IsKeyedLoadIC) | 336 DEFINE_SLOT_KIND_PREDICATE(IsKeyedLoadIC) |
331 DEFINE_SLOT_KIND_PREDICATE(IsStoreIC) | 337 DEFINE_SLOT_KIND_PREDICATE(IsStoreIC) |
332 DEFINE_SLOT_KIND_PREDICATE(IsStoreOwnIC) | 338 DEFINE_SLOT_KIND_PREDICATE(IsStoreOwnIC) |
333 DEFINE_SLOT_KIND_PREDICATE(IsKeyedStoreIC) | 339 DEFINE_SLOT_KIND_PREDICATE(IsKeyedStoreIC) |
| 340 DEFINE_SLOT_KIND_PREDICATE(IsTypeProfile) |
334 #undef DEFINE_SLOT_KIND_PREDICATE | 341 #undef DEFINE_SLOT_KIND_PREDICATE |
335 | 342 |
336 // Returns typeof mode encoded into kind of given slot. | 343 // Returns typeof mode encoded into kind of given slot. |
337 inline TypeofMode GetTypeofMode(FeedbackSlot slot) const { | 344 inline TypeofMode GetTypeofMode(FeedbackSlot slot) const { |
338 return GetTypeofModeFromSlotKind(GetKind(slot)); | 345 return GetTypeofModeFromSlotKind(GetKind(slot)); |
339 } | 346 } |
340 | 347 |
341 // Returns language mode encoded into kind of given slot. | 348 // Returns language mode encoded into kind of given slot. |
342 inline LanguageMode GetLanguageMode(FeedbackSlot slot) const { | 349 inline LanguageMode GetLanguageMode(FeedbackSlot slot) const { |
343 return GetLanguageModeFromSlotKind(GetKind(slot)); | 350 return GetLanguageModeFromSlotKind(GetKind(slot)); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 InlineCacheState StateFromFeedback() const override; | 781 InlineCacheState StateFromFeedback() const override; |
775 }; | 782 }; |
776 | 783 |
777 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); | 784 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); |
778 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); | 785 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); |
779 | 786 |
780 } // namespace internal | 787 } // namespace internal |
781 } // namespace v8 | 788 } // namespace v8 |
782 | 789 |
783 #endif // V8_FEEDBACK_VECTOR_H_ | 790 #endif // V8_FEEDBACK_VECTOR_H_ |
OLD | NEW |