5 #ifndef V8_COMPILER_CONTROL_EQUIVALENCE_H_ 6 #define V8_COMPILER_CONTROL_EQUIVALENCE_H_ 8 #include "src/base/compiler-specific.h" 9 #include "src/compiler/graph.h" 10 #include "src/compiler/node.h" 11 #include "src/globals.h" 12 #include "src/zone/zone-containers.h" 34 :
public NON_EXPORTED_BASE(ZoneObject) {
41 node_data_(graph->NodeCount(), zone) {}
52 size_t ClassOf(
Node* node) {
53 DCHECK_NE(kInvalidClass, GetClass(node));
54 return GetClass(node);
58 static const size_t kInvalidClass =
static_cast<size_t>(-1);
59 typedef enum { kInputDirection, kUseDirection } DFSDirection;
62 DFSDirection direction;
72 struct DFSStackEntry {
73 DFSDirection direction;
74 Node::InputEdges::iterator input;
75 Node::UseEdges::iterator use;
84 explicit NodeData(
Zone* zone)
85 : class_number(kInvalidClass),
100 void VisitPre(
Node* node);
103 void VisitMid(
Node* node, DFSDirection direction);
106 void VisitPost(
Node* node,
Node* parent_node, DFSDirection direction);
109 void VisitBackedge(
Node* from,
Node* to, DFSDirection direction);
125 void RunUndirectedDFS(
Node* exit);
128 void DetermineParticipation(
Node* exit);
131 NodeData* GetData(
Node* node) {
132 size_t const index = node->id();
133 if (index >= node_data_.size()) node_data_.resize(index + 1);
134 return node_data_[index];
136 void AllocateData(
Node* node) {
137 size_t const index = node->id();
138 if (index >= node_data_.size()) node_data_.resize(index + 1);
139 node_data_[index] =
new (zone_) NodeData(zone_);
142 int NewClassNumber() {
return class_number_++; }
143 int NewDFSNumber() {
return dfs_number_++; }
145 bool Participates(
Node* node) {
return GetData(node) !=
nullptr; }
148 size_t GetClass(
Node* node) {
return GetData(node)->class_number; }
149 void SetClass(
Node* node,
size_t number) {
150 DCHECK(Participates(node));
151 GetData(node)->class_number = number;
156 DCHECK(Participates(node));
157 return GetData(node)->blist;
160 DCHECK(Participates(node));
161 GetData(node)->blist = list;
170 void BracketListDelete(
BracketList& blist,
Node* to, DFSDirection direction);
184 #endif // V8_COMPILER_CONTROL_EQUIVALENCE_H_