summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/graph-replay.h
blob: cc186d77c94a0aa9e1c956fda75d1b72dd0821ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_GRAPH_REPLAY_H_
#define V8_COMPILER_GRAPH_REPLAY_H_

#include "src/v8.h"

#include "src/compiler/node.h"

namespace v8 {
namespace internal {
namespace compiler {

class Graph;
class Operator;

// Helper class to print a full replay of a graph. This replay can be used to
// materialize the same graph within a C++ unit test and hence test subsequent
// optimization passes on a graph without going through the construction steps.
class GraphReplayPrinter : public NullNodeVisitor {
 public:
#ifdef DEBUG
  static void PrintReplay(Graph* graph);
#else
  static void PrintReplay(Graph* graph) {}
#endif

  GenericGraphVisit::Control Pre(Node* node);
  void PostEdge(Node* from, int index, Node* to);

 private:
  GraphReplayPrinter() {}

  static void PrintReplayOpCreator(Operator* op);

  DISALLOW_COPY_AND_ASSIGN(GraphReplayPrinter);
};
}
}
}  // namespace v8::internal::compiler

#endif  // V8_COMPILER_GRAPH_REPLAY_H_