| OLD | NEW |
| 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_COMPILER_CONTROL_EQUIVALENCE_H_ | 5 #ifndef V8_COMPILER_CONTROL_EQUIVALENCE_H_ |
| 6 #define V8_COMPILER_CONTROL_EQUIVALENCE_H_ | 6 #define V8_COMPILER_CONTROL_EQUIVALENCE_H_ |
| 7 | 7 |
| 8 #include "src/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // / \ to D have been visited, we pop N and call VisitPost(N). | 117 // / \ to D have been visited, we pop N and call VisitPost(N). |
| 118 // | 118 // |
| 119 // This will yield a true spanning tree (without cross or forward edges) and | 119 // This will yield a true spanning tree (without cross or forward edges) and |
| 120 // also discover proper back edges in both directions. | 120 // also discover proper back edges in both directions. |
| 121 void RunUndirectedDFS(Node* exit); | 121 void RunUndirectedDFS(Node* exit); |
| 122 | 122 |
| 123 void DetermineParticipationEnqueue(ZoneQueue<Node*>& queue, Node* node); | 123 void DetermineParticipationEnqueue(ZoneQueue<Node*>& queue, Node* node); |
| 124 void DetermineParticipation(Node* exit); | 124 void DetermineParticipation(Node* exit); |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 NodeData* GetData(Node* node) { return &node_data_[node->id()]; } | 127 NodeData* GetData(Node* node) { |
| 128 size_t const index = node->id(); |
| 129 if (index >= node_data_.size()) node_data_.resize(index + 1, EmptyData()); |
| 130 return &node_data_[index]; |
| 131 } |
| 128 int NewClassNumber() { return class_number_++; } | 132 int NewClassNumber() { return class_number_++; } |
| 129 int NewDFSNumber() { return dfs_number_++; } | 133 int NewDFSNumber() { return dfs_number_++; } |
| 130 | 134 |
| 131 // Template used to initialize per-node data. | 135 // Template used to initialize per-node data. |
| 132 NodeData EmptyData() { | 136 NodeData EmptyData() { |
| 133 return {kInvalidClass, 0, false, false, false, BracketList(zone_)}; | 137 return {kInvalidClass, 0, false, false, false, BracketList(zone_)}; |
| 134 } | 138 } |
| 135 | 139 |
| 136 // Accessors for the DFS number stored within the per-node data. | 140 // Accessors for the DFS number stored within the per-node data. |
| 137 size_t GetNumber(Node* node) { return GetData(node)->dfs_number; } | 141 size_t GetNumber(Node* node) { return GetData(node)->dfs_number; } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 165 int dfs_number_; // Generates new DFS pre-order numbers on demand. | 169 int dfs_number_; // Generates new DFS pre-order numbers on demand. |
| 166 int class_number_; // Generates new equivalence class numbers on demand. | 170 int class_number_; // Generates new equivalence class numbers on demand. |
| 167 Data node_data_; // Per-node data stored as a side-table. | 171 Data node_data_; // Per-node data stored as a side-table. |
| 168 }; | 172 }; |
| 169 | 173 |
| 170 } // namespace compiler | 174 } // namespace compiler |
| 171 } // namespace internal | 175 } // namespace internal |
| 172 } // namespace v8 | 176 } // namespace v8 |
| 173 | 177 |
| 174 #endif // V8_COMPILER_CONTROL_EQUIVALENCE_H_ | 178 #endif // V8_COMPILER_CONTROL_EQUIVALENCE_H_ |
| OLD | NEW |