OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_GRAPH_BUILDER_H_ | |
6 #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.
| |
7 | |
8 #include "src/v8.h" | |
9 | |
10 #include "src/allocation.h" | |
11 #include "src/compiler/common-operator.h" | |
12 #include "src/compiler/graph.h" | |
13 #include "src/compiler/node.h" | |
14 | |
15 namespace v8 { | |
16 namespace internal { | |
17 namespace compiler { | |
18 | |
19 // A common base class for anything that creates nodes in a graph. | |
20 class GraphBuilder { | |
21 public: | |
22 GraphBuilder(Isolate* isolate, Graph* graph) | |
23 : isolate_(isolate), graph_(graph) {} | |
24 virtual ~GraphBuilder() {} | |
25 | |
26 Node* NewNode(const Operator* op, bool incomplete = false) { | |
27 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); | |
28 } | |
29 | |
30 Node* NewNode(const Operator* op, Node* n1) { | |
31 return MakeNode(op, 1, &n1, false); | |
32 } | |
33 | |
34 Node* NewNode(const Operator* op, Node* n1, Node* n2) { | |
35 Node* buffer[] = {n1, n2}; | |
36 return MakeNode(op, arraysize(buffer), buffer, false); | |
37 } | |
38 | |
39 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) { | |
40 Node* buffer[] = {n1, n2, n3}; | |
41 return MakeNode(op, arraysize(buffer), buffer, false); | |
42 } | |
43 | |
44 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) { | |
45 Node* buffer[] = {n1, n2, n3, n4}; | |
46 return MakeNode(op, arraysize(buffer), buffer, false); | |
47 } | |
48 | |
49 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, | |
50 Node* n5) { | |
51 Node* buffer[] = {n1, n2, n3, n4, n5}; | |
52 return MakeNode(op, arraysize(buffer), buffer, false); | |
53 } | |
54 | |
55 Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, | |
56 Node* n5, Node* n6) { | |
57 Node* nodes[] = {n1, n2, n3, n4, n5, n6}; | |
58 return MakeNode(op, arraysize(nodes), nodes, false); | |
59 } | |
60 | |
61 Node* NewNode(const Operator* op, int value_input_count, Node** value_inputs, | |
62 bool incomplete = false) { | |
63 return MakeNode(op, value_input_count, value_inputs, incomplete); | |
64 } | |
65 | |
66 Isolate* isolate() const { return isolate_; } | |
67 Graph* graph() const { return graph_; } | |
68 | |
69 protected: | |
70 // Base implementation used by all factory methods. | |
71 virtual Node* MakeNode(const Operator* op, int value_input_count, | |
72 Node** value_inputs, bool incomplete) = 0; | |
73 | |
74 private: | |
75 Isolate* isolate_; | |
76 Graph* graph_; | |
77 }; | |
78 } | |
79 } | |
80 } // namespace v8::internal::compiler | |
81 | |
82 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | |
OLD | NEW |