OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_NODE_H_ | 5 #ifndef V8_COMPILER_NODE_H_ |
6 #define V8_COMPILER_NODE_H_ | 6 #define V8_COMPILER_NODE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // during compilation, e.g. during lowering passes. Other information that | 47 // during compilation, e.g. during lowering passes. Other information that |
48 // needs to be associated with Nodes during compilation must be stored | 48 // needs to be associated with Nodes during compilation must be stored |
49 // out-of-line indexed by the Node's id. | 49 // out-of-line indexed by the Node's id. |
50 class Node : public GenericNode<NodeData, Node> { | 50 class Node : public GenericNode<NodeData, Node> { |
51 public: | 51 public: |
52 Node(GenericGraphBase* graph, int input_count) | 52 Node(GenericGraphBase* graph, int input_count) |
53 : GenericNode<NodeData, Node>(graph, input_count) {} | 53 : GenericNode<NodeData, Node>(graph, input_count) {} |
54 | 54 |
55 void Initialize(Operator* op) { set_op(op); } | 55 void Initialize(Operator* op) { set_op(op); } |
56 | 56 |
57 void CollectProjections( | 57 void CollectProjections(ZoneVector<Node*>* projections); |
58 std::vector<Node*, zone_allocator<Node*> >* projections); | |
59 Node* FindProjection(int32_t projection_index); | 58 Node* FindProjection(int32_t projection_index); |
60 }; | 59 }; |
61 | 60 |
62 OStream& operator<<(OStream& os, const Node& n); | 61 OStream& operator<<(OStream& os, const Node& n); |
63 | 62 |
64 typedef GenericGraphVisit::NullNodeVisitor<NodeData, Node> NullNodeVisitor; | 63 typedef GenericGraphVisit::NullNodeVisitor<NodeData, Node> NullNodeVisitor; |
65 | 64 |
66 typedef zone_allocator<Node*> NodePtrZoneAllocator; | 65 typedef std::set<Node*, std::less<Node*>, zone_allocator<Node*> > NodeSet; |
67 | |
68 typedef std::set<Node*, std::less<Node*>, NodePtrZoneAllocator> NodeSet; | |
69 typedef NodeSet::iterator NodeSetIter; | 66 typedef NodeSet::iterator NodeSetIter; |
70 typedef NodeSet::reverse_iterator NodeSetRIter; | 67 typedef NodeSet::reverse_iterator NodeSetRIter; |
71 | 68 |
72 typedef std::deque<Node*, NodePtrZoneAllocator> NodeDeque; | 69 typedef ZoneVector<Node*> NodeVector; |
73 typedef NodeDeque::iterator NodeDequeIter; | |
74 | |
75 typedef std::vector<Node*, NodePtrZoneAllocator> NodeVector; | |
76 typedef NodeVector::iterator NodeVectorIter; | 70 typedef NodeVector::iterator NodeVectorIter; |
77 typedef NodeVector::reverse_iterator NodeVectorRIter; | 71 typedef NodeVector::reverse_iterator NodeVectorRIter; |
78 | 72 |
79 typedef zone_allocator<NodeVector> ZoneNodeVectorAllocator; | 73 typedef ZoneVector<NodeVector> NodeVectorVector; |
80 typedef std::vector<NodeVector, ZoneNodeVectorAllocator> NodeVectorVector; | |
81 typedef NodeVectorVector::iterator NodeVectorVectorIter; | 74 typedef NodeVectorVector::iterator NodeVectorVectorIter; |
82 typedef NodeVectorVector::reverse_iterator NodeVectorVectorRIter; | 75 typedef NodeVectorVector::reverse_iterator NodeVectorVectorRIter; |
83 | 76 |
84 typedef Node::Uses::iterator UseIter; | 77 typedef Node::Uses::iterator UseIter; |
85 typedef Node::Inputs::iterator InputIter; | 78 typedef Node::Inputs::iterator InputIter; |
86 | 79 |
87 // Helper to extract parameters from Operator1<*> nodes. | 80 // Helper to extract parameters from Operator1<*> nodes. |
88 template <typename T> | 81 template <typename T> |
89 static inline T OpParameter(Node* node) { | 82 static inline T OpParameter(Node* node) { |
90 return reinterpret_cast<Operator1<T>*>(node->op())->parameter(); | 83 return reinterpret_cast<Operator1<T>*>(node->op())->parameter(); |
91 } | 84 } |
92 } | 85 } |
93 } | 86 } |
94 } // namespace v8::internal::compiler | 87 } // namespace v8::internal::compiler |
95 | 88 |
96 #endif // V8_COMPILER_NODE_H_ | 89 #endif // V8_COMPILER_NODE_H_ |
OLD | NEW |