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_GRAPH_H_ | 5 #ifndef V8_COMPILER_GRAPH_H_ |
6 #define V8_COMPILER_GRAPH_H_ | 6 #define V8_COMPILER_GRAPH_H_ |
7 | 7 |
8 #include "src/zone.h" | 8 #include "src/zone.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class GraphDecorator; | 16 class GraphDecorator; |
17 class Node; | 17 class Node; |
18 class Operator; | 18 class Operator; |
19 | 19 |
20 | 20 |
21 // Marks are used during traversal of the graph to distinguish states of nodes. | 21 // Marks are used during traversal of the graph to distinguish states of nodes. |
22 // Each node has a mark which is a monotonically increasing integer, and a | 22 // Each node has a mark which is a monotonically increasing integer, and a |
23 // {NodeMarker} has a range of values that indicate states of a node. | 23 // {NodeMarker} has a range of values that indicate states of a node. |
24 typedef uint32_t Mark; | 24 typedef uint32_t Mark; |
25 | 25 |
26 | 26 |
27 // NodeIds are identifying numbers for nodes that can be used to index auxiliary | 27 // NodeIds are identifying numbers for nodes that can be used to index auxiliary |
28 // out-of-line data associated with each node. | 28 // out-of-line data associated with each node. |
29 typedef int32_t NodeId; | 29 typedef uint32_t NodeId; |
30 | 30 |
31 | 31 |
32 class Graph : public ZoneObject { | 32 class Graph : public ZoneObject { |
33 public: | 33 public: |
34 explicit Graph(Zone* zone); | 34 explicit Graph(Zone* zone); |
35 | 35 |
36 // Base implementation used by all factory methods. | 36 // Base implementation used by all factory methods. |
37 Node* NewNode(const Operator* op, int input_count, Node** inputs, | 37 Node* NewNode(const Operator* op, int input_count, Node** inputs, |
38 bool incomplete = false); | 38 bool incomplete = false); |
39 | 39 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 template <class Visitor> | 83 template <class Visitor> |
84 inline void VisitNodeInputsFromEnd(Visitor* visitor); | 84 inline void VisitNodeInputsFromEnd(Visitor* visitor); |
85 | 85 |
86 Zone* zone() const { return zone_; } | 86 Zone* zone() const { return zone_; } |
87 Node* start() const { return start_; } | 87 Node* start() const { return start_; } |
88 Node* end() const { return end_; } | 88 Node* end() const { return end_; } |
89 | 89 |
90 void SetStart(Node* start) { start_ = start; } | 90 void SetStart(Node* start) { start_ = start; } |
91 void SetEnd(Node* end) { end_ = end; } | 91 void SetEnd(Node* end) { end_ = end; } |
92 | 92 |
93 int NodeCount() const { return next_node_id_; } | 93 size_t NodeCount() const { return next_node_id_; } |
94 | 94 |
95 void Decorate(Node* node, bool incomplete); | 95 void Decorate(Node* node, bool incomplete); |
96 void AddDecorator(GraphDecorator* decorator); | 96 void AddDecorator(GraphDecorator* decorator); |
97 void RemoveDecorator(GraphDecorator* decorator); | 97 void RemoveDecorator(GraphDecorator* decorator); |
98 | 98 |
99 private: | 99 private: |
100 friend class NodeMarkerBase; | 100 friend class NodeMarkerBase; |
101 | 101 |
102 inline NodeId NextNodeId(); | 102 inline NodeId NextNodeId(); |
103 | 103 |
(...skipping 14 matching lines...) Expand all Loading... |
118 public: | 118 public: |
119 virtual ~GraphDecorator() {} | 119 virtual ~GraphDecorator() {} |
120 virtual void Decorate(Node* node, bool incomplete) = 0; | 120 virtual void Decorate(Node* node, bool incomplete) = 0; |
121 }; | 121 }; |
122 | 122 |
123 } // namespace compiler | 123 } // namespace compiler |
124 } // namespace internal | 124 } // namespace internal |
125 } // namespace v8 | 125 } // namespace v8 |
126 | 126 |
127 #endif // V8_COMPILER_GRAPH_H_ | 127 #endif // V8_COMPILER_GRAPH_H_ |
OLD | NEW |