Chromium Code Reviews| Index: test/cctest/compiler/graph-builder.h | 
| diff --git a/test/cctest/compiler/graph-builder.h b/test/cctest/compiler/graph-builder.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..b83c474ba55233294997e21e0b3d04913f409404 | 
| --- /dev/null | 
| +++ b/test/cctest/compiler/graph-builder.h | 
| @@ -0,0 +1,82 @@ | 
| +// Copyright 2013 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_BUILDER_H_ | 
| +#define V8_COMPILER_GRAPH_BUILDER_H_ | 
| 
 
Michael Starzinger
2015/02/02 18:08:24
This entire file looks like a remnant.
 
titzer
2015/02/02 18:26:48
Done.
 
 | 
| + | 
| +#include "src/v8.h" | 
| + | 
| +#include "src/allocation.h" | 
| +#include "src/compiler/common-operator.h" | 
| +#include "src/compiler/graph.h" | 
| +#include "src/compiler/node.h" | 
| + | 
| +namespace v8 { | 
| +namespace internal { | 
| +namespace compiler { | 
| + | 
| +// A common base class for anything that creates nodes in a graph. | 
| +class GraphBuilder { | 
| + public: | 
| + GraphBuilder(Isolate* isolate, Graph* graph) | 
| + : isolate_(isolate), graph_(graph) {} | 
| + virtual ~GraphBuilder() {} | 
| + | 
| + Node* NewNode(const Operator* op, bool incomplete = false) { | 
| + return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, Node* n1) { | 
| + return MakeNode(op, 1, &n1, false); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, Node* n1, Node* n2) { | 
| + Node* buffer[] = {n1, n2}; | 
| + return MakeNode(op, arraysize(buffer), buffer, false); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) { | 
| + Node* buffer[] = {n1, n2, n3}; | 
| + return MakeNode(op, arraysize(buffer), buffer, false); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) { | 
| + Node* buffer[] = {n1, n2, n3, n4}; | 
| + return MakeNode(op, arraysize(buffer), buffer, false); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, | 
| + Node* n5) { | 
| + Node* buffer[] = {n1, n2, n3, n4, n5}; | 
| + return MakeNode(op, arraysize(buffer), buffer, false); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, | 
| + Node* n5, Node* n6) { | 
| + Node* nodes[] = {n1, n2, n3, n4, n5, n6}; | 
| + return MakeNode(op, arraysize(nodes), nodes, false); | 
| + } | 
| + | 
| + Node* NewNode(const Operator* op, int value_input_count, Node** value_inputs, | 
| + bool incomplete = false) { | 
| + return MakeNode(op, value_input_count, value_inputs, incomplete); | 
| + } | 
| + | 
| + Isolate* isolate() const { return isolate_; } | 
| + Graph* graph() const { return graph_; } | 
| + | 
| + protected: | 
| + // Base implementation used by all factory methods. | 
| + virtual Node* MakeNode(const Operator* op, int value_input_count, | 
| + Node** value_inputs, bool incomplete) = 0; | 
| + | 
| + private: | 
| + Isolate* isolate_; | 
| + Graph* graph_; | 
| +}; | 
| +} | 
| +} | 
| +} // namespace v8::internal::compiler | 
| + | 
| +#endif // V8_COMPILER_GRAPH_BUILDER_H__ |