Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: src/feedback-vector.h

Issue 2707873002: Collect type profile for DevTools. (Closed)
Patch Set: Add documentation and sprinkle consts around. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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(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
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 type of the value in the collection of types
752 // in the feedback vector.
753 class CollectTypeProfileNexus : public FeedbackNexus {
754 public:
755 CollectTypeProfileNexus(Handle<FeedbackVector> vector, FeedbackSlot slot)
756 : FeedbackNexus(vector, slot) {
757 DCHECK_EQ(FeedbackSlotKind::kTypeProfile, vector->GetKind(slot));
758 }
759 CollectTypeProfileNexus(FeedbackVector* vector, FeedbackSlot slot)
760 : FeedbackNexus(vector, slot) {
761 DCHECK_EQ(FeedbackSlotKind::kTypeProfile, vector->GetKind(slot));
762 }
763
764 // Add a type to the list of types.
765 void Collect(Handle<Name> type);
766
767 // Dump the types to stdout.
768 // TODO(franzih): pass this information to the debugger protocol instead of
769 // stdout.
770 void Print() const;
771
772 InlineCacheState StateFromFeedback() const override;
773 };
774
745 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback); 775 inline BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback);
746 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback); 776 inline CompareOperationHint CompareOperationHintFromFeedback(int type_feedback);
747 777
748 } // namespace internal 778 } // namespace internal
749 } // namespace v8 779 } // namespace v8
750 780
751 #endif // V8_FEEDBACK_VECTOR_H_ 781 #endif // V8_FEEDBACK_VECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698