OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_COMPILER_JS_TYPE_FEEDBACK_H_ | 5 #ifndef V8_COMPILER_JS_TYPE_FEEDBACK_H_ |
6 #define V8_COMPILER_JS_TYPE_FEEDBACK_H_ | 6 #define V8_COMPILER_JS_TYPE_FEEDBACK_H_ |
7 | 7 |
8 #include "src/utils.h" | 8 #include "src/utils.h" |
9 | 9 |
10 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 namespace compiler { | 22 namespace compiler { |
23 | 23 |
24 // Stores type feedback information for nodes in the graph in a separate | 24 // Stores type feedback information for nodes in the graph in a separate |
25 // data structure. | 25 // data structure. |
26 class JSTypeFeedbackTable : public ZoneObject { | 26 class JSTypeFeedbackTable : public ZoneObject { |
27 public: | 27 public: |
28 explicit JSTypeFeedbackTable(Zone* zone); | 28 explicit JSTypeFeedbackTable(Zone* zone); |
29 | 29 |
30 void Record(Node* node, TypeFeedbackId id); | 30 void Record(Node* node, TypeFeedbackId id); |
31 void Record(Node* node, FeedbackVectorICSlot slot); | 31 void Record(Node* node, FeedbackVectorSlot slot); |
32 | 32 |
33 private: | 33 private: |
34 friend class JSTypeFeedbackSpecializer; | 34 friend class JSTypeFeedbackSpecializer; |
35 typedef std::map<NodeId, TypeFeedbackId, std::less<NodeId>, | 35 typedef std::map<NodeId, TypeFeedbackId, std::less<NodeId>, |
36 zone_allocator<TypeFeedbackId> > TypeFeedbackIdMap; | 36 zone_allocator<TypeFeedbackId> > TypeFeedbackIdMap; |
37 typedef std::map<NodeId, FeedbackVectorICSlot, std::less<NodeId>, | 37 typedef std::map<NodeId, FeedbackVectorSlot, std::less<NodeId>, |
38 zone_allocator<FeedbackVectorICSlot> > | 38 zone_allocator<FeedbackVectorSlot> > FeedbackVectorSlotMap; |
39 FeedbackVectorICSlotMap; | |
40 | 39 |
41 TypeFeedbackIdMap type_feedback_id_map_; | 40 TypeFeedbackIdMap type_feedback_id_map_; |
42 FeedbackVectorICSlotMap feedback_vector_ic_slot_map_; | 41 FeedbackVectorSlotMap feedback_vector_slot_map_; |
43 | 42 |
44 TypeFeedbackId FindTypeFeedbackId(Node* node) { | 43 TypeFeedbackId FindTypeFeedbackId(Node* node) { |
45 TypeFeedbackIdMap::const_iterator it = | 44 TypeFeedbackIdMap::const_iterator it = |
46 type_feedback_id_map_.find(node->id()); | 45 type_feedback_id_map_.find(node->id()); |
47 return it == type_feedback_id_map_.end() ? TypeFeedbackId::None() | 46 return it == type_feedback_id_map_.end() ? TypeFeedbackId::None() |
48 : it->second; | 47 : it->second; |
49 } | 48 } |
50 | 49 |
51 FeedbackVectorICSlot FindFeedbackVectorICSlot(Node* node) { | 50 FeedbackVectorSlot FindFeedbackVectorSlot(Node* node) { |
52 FeedbackVectorICSlotMap::const_iterator it = | 51 FeedbackVectorSlotMap::const_iterator it = |
53 feedback_vector_ic_slot_map_.find(node->id()); | 52 feedback_vector_slot_map_.find(node->id()); |
54 return it == feedback_vector_ic_slot_map_.end() | 53 return it == feedback_vector_slot_map_.end() ? FeedbackVectorSlot::Invalid() |
55 ? FeedbackVectorICSlot::Invalid() | 54 : it->second; |
56 : it->second; | |
57 } | 55 } |
58 }; | 56 }; |
59 | 57 |
60 | 58 |
61 // Specializes a graph to the type feedback recorded in the | 59 // Specializes a graph to the type feedback recorded in the |
62 // {js_type_feedback} provided to the constructor. | 60 // {js_type_feedback} provided to the constructor. |
63 class JSTypeFeedbackSpecializer : public AdvancedReducer { | 61 class JSTypeFeedbackSpecializer : public AdvancedReducer { |
64 public: | 62 public: |
65 enum DeoptimizationMode { kDeoptimizationEnabled, kDeoptimizationDisabled }; | 63 enum DeoptimizationMode { kDeoptimizationEnabled, kDeoptimizationDisabled }; |
66 | 64 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 Node* effect, Node* control, Node** success, Node** fail); | 108 Node* effect, Node* control, Node** success, Node** fail); |
111 | 109 |
112 Node* GetFrameStateBefore(Node* node); | 110 Node* GetFrameStateBefore(Node* node); |
113 }; | 111 }; |
114 | 112 |
115 } // namespace compiler | 113 } // namespace compiler |
116 } // namespace internal | 114 } // namespace internal |
117 } // namespace v8 | 115 } // namespace v8 |
118 | 116 |
119 #endif | 117 #endif |
OLD | NEW |