| 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 18 matching lines...) Expand all Loading... |
| 29 kLoadKeyed, | 29 kLoadKeyed, |
| 30 kStoreNamedSloppy, | 30 kStoreNamedSloppy, |
| 31 kStoreNamedStrict, | 31 kStoreNamedStrict, |
| 32 kStoreOwnNamed, | 32 kStoreOwnNamed, |
| 33 kStoreKeyedSloppy, | 33 kStoreKeyedSloppy, |
| 34 kStoreKeyedStrict, | 34 kStoreKeyedStrict, |
| 35 kBinaryOp, | 35 kBinaryOp, |
| 36 kCompareOp, | 36 kCompareOp, |
| 37 kToBoolean, | 37 kToBoolean, |
| 38 kStoreDataPropertyInLiteral, | 38 kStoreDataPropertyInLiteral, |
| 39 kTypeProfile, |
| 39 kCreateClosure, | 40 kCreateClosure, |
| 40 kLiteral, | 41 kLiteral, |
| 41 // This is a general purpose slot that occupies one feedback vector element. | 42 // This is a general purpose slot that occupies one feedback vector element. |
| 42 kGeneral, | 43 kGeneral, |
| 43 | 44 |
| 44 kKindsNumber // Last value indicating number of kinds. | 45 kKindsNumber // Last value indicating number of kinds. |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 inline bool IsCallICKind(FeedbackSlotKind kind) { | 48 inline bool IsCallICKind(FeedbackSlotKind kind) { |
| 48 return kind == FeedbackSlotKind::kCall; | 49 return kind == FeedbackSlotKind::kCall; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 144 } |
| 144 | 145 |
| 145 FeedbackSlot AddGeneralSlot() { return AddSlot(FeedbackSlotKind::kGeneral); } | 146 FeedbackSlot AddGeneralSlot() { return AddSlot(FeedbackSlotKind::kGeneral); } |
| 146 | 147 |
| 147 FeedbackSlot AddLiteralSlot() { return AddSlot(FeedbackSlotKind::kLiteral); } | 148 FeedbackSlot AddLiteralSlot() { return AddSlot(FeedbackSlotKind::kLiteral); } |
| 148 | 149 |
| 149 FeedbackSlot AddStoreDataPropertyInLiteralICSlot() { | 150 FeedbackSlot AddStoreDataPropertyInLiteralICSlot() { |
| 150 return AddSlot(FeedbackSlotKind::kStoreDataPropertyInLiteral); | 151 return AddSlot(FeedbackSlotKind::kStoreDataPropertyInLiteral); |
| 151 } | 152 } |
| 152 | 153 |
| 154 FeedbackSlot AddTypeProfileSlot() { |
| 155 DCHECK(true || FLAG_type_profile); |
| 156 return AddSlot(FeedbackSlotKind::kTypeProfile); |
| 157 } |
| 158 |
| 153 #ifdef OBJECT_PRINT | 159 #ifdef OBJECT_PRINT |
| 154 // For gdb debugging. | 160 // For gdb debugging. |
| 155 void Print(); | 161 void Print(); |
| 156 #endif // OBJECT_PRINT | 162 #endif // OBJECT_PRINT |
| 157 | 163 |
| 158 DECLARE_PRINTER(FeedbackVectorSpec) | 164 DECLARE_PRINTER(FeedbackVectorSpec) |
| 159 | 165 |
| 160 private: | 166 private: |
| 161 inline FeedbackSlot AddSlot(FeedbackSlotKind kind); | 167 inline FeedbackSlot AddSlot(FeedbackSlotKind kind); |
| 162 | 168 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 : FeedbackNexus(vector, slot) { | 741 : FeedbackNexus(vector, slot) { |
| 736 DCHECK_EQ(FeedbackSlotKind::kStoreDataPropertyInLiteral, | 742 DCHECK_EQ(FeedbackSlotKind::kStoreDataPropertyInLiteral, |
| 737 vector->GetKind(slot)); | 743 vector->GetKind(slot)); |
| 738 } | 744 } |
| 739 | 745 |
| 740 void ConfigureMonomorphic(Handle<Name> name, Handle<Map> receiver_map); | 746 void ConfigureMonomorphic(Handle<Name> name, Handle<Map> receiver_map); |
| 741 | 747 |
| 742 InlineCacheState StateFromFeedback() const override; | 748 InlineCacheState StateFromFeedback() const override; |
| 743 }; | 749 }; |
| 744 | 750 |
| 751 // For each assignment, store the types seen so far in the feedback. |
| 752 // Feedback is either a Name or an ArrayList with Names. |
| 753 // If we've seen too many types, we consider this feedback |
| 754 // megamorphic and useless. |
| 755 class CollectTypeProfileICNexus : public FeedbackNexus { |
| 756 public: |
| 757 CollectTypeProfileICNexus(Handle<FeedbackVector> vector, FeedbackSlot slot) |
| 758 : FeedbackNexus(vector, slot) { |
| 759 DCHECK_EQ(FeedbackSlotKind::kTypeProfile, vector->GetKind(slot)); |
| 760 } |
| 761 CollectTypeProfileICNexus(FeedbackVector* vector, FeedbackSlot slot) |
| 762 : FeedbackNexus(vector, slot) { |
| 763 DCHECK_EQ(FeedbackSlotKind::kTypeProfile, vector->GetKind(slot)); |
| 764 } |
| 765 |
| 766 void ConfigureMonomorphic(Handle<Name> type); |
| 767 void ConfigurePolymorphic(Handle<Name> type); |
| 768 |
| 769 InlineCacheState StateFromFeedback() const override; |
| 770 }; |
| 771 |
| 745 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); | 772 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); |
| 746 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); | 773 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); |
| 747 | 774 |
| 748 } // namespace internal | 775 } // namespace internal |
| 749 } // namespace v8 | 776 } // namespace v8 |
| 750 | 777 |
| 751 #endif // V8_FEEDBACK_VECTOR_H_ | 778 #endif // V8_FEEDBACK_VECTOR_H_ |
| OLD | NEW |