graph-replay.h 1009 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// 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/compiler/node.h"

namespace v8 {
namespace internal {
namespace compiler {

14
// Forward declarations.
15 16 17 18 19
class Graph;

// 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.
20
class GraphReplayPrinter {
21 22 23 24 25 26 27 28 29 30
 public:
#ifdef DEBUG
  static void PrintReplay(Graph* graph);
#else
  static void PrintReplay(Graph* graph) {}
#endif

 private:
  GraphReplayPrinter() {}

31
  static void PrintReplayOpCreator(const Operator* op);
32 33 34

  DISALLOW_COPY_AND_ASSIGN(GraphReplayPrinter);
};
35 36 37 38

}  // namespace compiler
}  // namespace internal
}  // namespace v8
39 40

#endif  // V8_COMPILER_GRAPH_REPLAY_H_