Index: src/feedback-vector.h |
diff --git a/src/feedback-vector.h b/src/feedback-vector.h |
index 9ac146d5113dbf70a325f2ac7a5d6b2b226b329e..a2fabb3bc18bbf66531c0dee344b405aac02e94c 100644 |
--- a/src/feedback-vector.h |
+++ b/src/feedback-vector.h |
@@ -36,6 +36,7 @@ enum class FeedbackSlotKind { |
kCompareOp, |
kToBoolean, |
kStoreDataPropertyInLiteral, |
+ kTypeProfile, |
kCreateClosure, |
kLiteral, |
// This is a general purpose slot that occupies one feedback vector element. |
@@ -150,6 +151,11 @@ class FeedbackVectorSpecBase { |
return AddSlot(FeedbackSlotKind::kStoreDataPropertyInLiteral); |
} |
+ FeedbackSlot AddTypeProfileSlot() { |
+ DCHECK(true || FLAG_type_profile); |
+ return AddSlot(FeedbackSlotKind::kTypeProfile); |
+ } |
+ |
#ifdef OBJECT_PRINT |
// For gdb debugging. |
void Print(); |
@@ -742,6 +748,27 @@ class StoreDataPropertyInLiteralICNexus : public FeedbackNexus { |
InlineCacheState StateFromFeedback() const override; |
}; |
+// For each assignment, store the types seen so far in the feedback. |
+// Feedback is either a Name or an ArrayList with Names. |
+// If we've seen too many types, we consider this feedback |
+// megamorphic and useless. |
+class CollectTypeProfileICNexus : public FeedbackNexus { |
+ public: |
+ CollectTypeProfileICNexus(Handle<FeedbackVector> vector, FeedbackSlot slot) |
+ : FeedbackNexus(vector, slot) { |
+ DCHECK_EQ(FeedbackSlotKind::kTypeProfile, vector->GetKind(slot)); |
+ } |
+ CollectTypeProfileICNexus(FeedbackVector* vector, FeedbackSlot slot) |
+ : FeedbackNexus(vector, slot) { |
+ DCHECK_EQ(FeedbackSlotKind::kTypeProfile, vector->GetKind(slot)); |
+ } |
+ |
+ void ConfigureMonomorphic(Handle<Name> type); |
+ void ConfigurePolymorphic(Handle<Name> type); |
+ |
+ InlineCacheState StateFromFeedback() const override; |
+}; |
+ |
inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); |
inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); |