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_GRAPH_REPLAY_H_ | 5 #ifndef V8_COMPILER_GRAPH_REPLAY_H_ |
6 #define V8_COMPILER_GRAPH_REPLAY_H_ | 6 #define V8_COMPILER_GRAPH_REPLAY_H_ |
7 | 7 |
8 #include "src/compiler/generic-algorithm.h" | |
9 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
10 | 9 |
11 namespace v8 { | 10 namespace v8 { |
12 namespace internal { | 11 namespace internal { |
13 namespace compiler { | 12 namespace compiler { |
14 | 13 |
15 // Forward declarations. | 14 // Forward declarations. |
16 class Graph; | 15 class Graph; |
17 | 16 |
18 // Helper class to print a full replay of a graph. This replay can be used to | 17 // Helper class to print a full replay of a graph. This replay can be used to |
19 // materialize the same graph within a C++ unit test and hence test subsequent | 18 // materialize the same graph within a C++ unit test and hence test subsequent |
20 // optimization passes on a graph without going through the construction steps. | 19 // optimization passes on a graph without going through the construction steps. |
21 class GraphReplayPrinter FINAL : public NullNodeVisitor { | 20 class GraphReplayPrinter { |
22 public: | 21 public: |
23 #ifdef DEBUG | 22 #ifdef DEBUG |
24 static void PrintReplay(Graph* graph); | 23 static void PrintReplay(Graph* graph); |
25 #else | 24 #else |
26 static void PrintReplay(Graph* graph) {} | 25 static void PrintReplay(Graph* graph) {} |
27 #endif | 26 #endif |
28 | 27 |
29 void Pre(Node* node); | |
30 void PostEdge(Node* from, int index, Node* to); | |
31 | |
32 private: | 28 private: |
33 GraphReplayPrinter() {} | 29 GraphReplayPrinter() {} |
34 | 30 |
35 static void PrintReplayOpCreator(const Operator* op); | 31 static void PrintReplayOpCreator(const Operator* op); |
36 | 32 |
37 DISALLOW_COPY_AND_ASSIGN(GraphReplayPrinter); | 33 DISALLOW_COPY_AND_ASSIGN(GraphReplayPrinter); |
38 }; | 34 }; |
39 | 35 |
40 } // namespace compiler | 36 } // namespace compiler |
41 } // namespace internal | 37 } // namespace internal |
42 } // namespace v8 | 38 } // namespace v8 |
43 | 39 |
44 #endif // V8_COMPILER_GRAPH_REPLAY_H_ | 40 #endif // V8_COMPILER_GRAPH_REPLAY_H_ |
OLD | NEW |