OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 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 | 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 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "graph-tester.h" | 9 #include "graph-tester.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
11 #include "src/compiler/graph.h" | 11 #include "src/compiler/graph.h" |
12 #include "src/compiler/graph-visualizer.h" | |
13 #include "src/compiler/node.h" | 12 #include "src/compiler/node.h" |
14 #include "src/compiler/operator.h" | 13 #include "src/compiler/operator.h" |
| 14 #include "src/compiler/visualizer.h" |
15 | 15 |
16 using namespace v8::internal; | 16 using namespace v8::internal; |
17 using namespace v8::internal::compiler; | 17 using namespace v8::internal::compiler; |
18 | 18 |
19 static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite, | 19 static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite, |
20 "dummy", 0, 0, 0, 1, 0, 0); | 20 "dummy", 0, 0, 0, 1, 0, 0); |
21 | 21 |
22 TEST(TestPrintNodeGraphToNodeGraphviz) { | 22 TEST(TestPrintNodeGraphToNodeGraphviz) { |
23 GraphWithStartNodeTester graph; | 23 GraphWithStartNodeTester graph; |
24 Node* n2 = graph.NewNode(&dummy_operator, graph.start()); | 24 Node* n2 = graph.NewNode(&dummy_operator, graph.start()); |
25 Node* n3 = graph.NewNode(&dummy_operator, graph.start()); | 25 Node* n3 = graph.NewNode(&dummy_operator, graph.start()); |
26 Node* n4 = graph.NewNode(&dummy_operator, n2); | 26 Node* n4 = graph.NewNode(&dummy_operator, n2); |
27 Node* n5 = graph.NewNode(&dummy_operator, n2); | 27 Node* n5 = graph.NewNode(&dummy_operator, n2); |
28 Node* n6 = graph.NewNode(&dummy_operator, n3); | 28 Node* n6 = graph.NewNode(&dummy_operator, n3); |
29 Node* n7 = graph.NewNode(&dummy_operator, n3); | 29 Node* n7 = graph.NewNode(&dummy_operator, n3); |
30 Node* n8 = graph.NewNode(&dummy_operator, n5); | 30 Node* n8 = graph.NewNode(&dummy_operator, n5); |
31 Node* n9 = graph.NewNode(&dummy_operator, n5); | 31 Node* n9 = graph.NewNode(&dummy_operator, n5); |
32 Node* n10 = graph.NewNode(&dummy_operator, n9); | 32 Node* n10 = graph.NewNode(&dummy_operator, n9); |
33 Node* n11 = graph.NewNode(&dummy_operator, n9); | 33 Node* n11 = graph.NewNode(&dummy_operator, n9); |
34 Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7}; | 34 Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7}; |
35 Node* n12 = graph.NewNode(&dummy_operator, 6, end_dependencies); | 35 Node* n12 = graph.NewNode(&dummy_operator, 6, end_dependencies); |
36 graph.SetEnd(n12); | 36 graph.SetEnd(n12); |
37 | 37 |
38 OFStream os(stdout); | 38 OFStream os(stdout); |
39 os << AsDOT(graph); | 39 os << AsDOT(graph); |
40 } | 40 } |
OLD | NEW |