OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/v8.h" | 5 #include "src/v8.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
11 #include "src/compiler/js-operator.h" | 11 #include "src/compiler/js-operator.h" |
12 #include "src/compiler/machine-operator.h" | 12 #include "src/compiler/machine-operator.h" |
13 #include "src/compiler/node.h" | 13 #include "src/compiler/node.h" |
14 #include "src/compiler/operator.h" | 14 #include "src/compiler/operator.h" |
15 #include "src/compiler/schedule.h" | 15 #include "src/compiler/schedule.h" |
16 #include "src/compiler/scheduler.h" | 16 #include "src/compiler/scheduler.h" |
17 #include "src/compiler/source-position.h" | 17 #include "src/compiler/source-position.h" |
18 #include "src/compiler/verifier.h" | 18 #include "src/compiler/verifier.h" |
19 | 19 |
20 using namespace v8::internal; | 20 using namespace v8::internal; |
21 using namespace v8::internal::compiler; | 21 using namespace v8::internal::compiler; |
22 | 22 |
23 static Operator dummy_operator1(IrOpcode::kParameter, Operator::kNoWrite, | 23 static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite, |
24 "dummy", 1, 0, 0, 1, 0, 0); | 24 "dummy", 0, 0, 0, 1, 0, 0); |
25 static Operator dummy_operator6(IrOpcode::kParameter, Operator::kNoWrite, | |
26 "dummy", 6, 0, 0, 1, 0, 0); | |
27 | 25 |
28 | 26 |
29 TEST(NodeWithNullInputReachableFromEnd) { | 27 TEST(NodeWithNullInputReachableFromEnd) { |
30 HandleAndZoneScope scope; | 28 HandleAndZoneScope scope; |
31 Graph graph(scope.main_zone()); | 29 Graph graph(scope.main_zone()); |
32 CommonOperatorBuilder common(scope.main_zone()); | 30 CommonOperatorBuilder common(scope.main_zone()); |
33 | 31 |
34 Node* start = graph.NewNode(common.Start(0)); | 32 Node* start = graph.NewNode(common.Start(0)); |
35 graph.SetStart(start); | 33 graph.SetStart(start); |
36 Node* k = graph.NewNode(common.Int32Constant(0)); | 34 Node* k = graph.NewNode(common.Int32Constant(0)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 99 } |
102 | 100 |
103 | 101 |
104 TEST(NodeNetworkOfDummiesReachableFromEnd) { | 102 TEST(NodeNetworkOfDummiesReachableFromEnd) { |
105 HandleAndZoneScope scope; | 103 HandleAndZoneScope scope; |
106 Graph graph(scope.main_zone()); | 104 Graph graph(scope.main_zone()); |
107 CommonOperatorBuilder common(scope.main_zone()); | 105 CommonOperatorBuilder common(scope.main_zone()); |
108 | 106 |
109 Node* start = graph.NewNode(common.Start(0)); | 107 Node* start = graph.NewNode(common.Start(0)); |
110 graph.SetStart(start); | 108 graph.SetStart(start); |
111 Node* n2 = graph.NewNode(&dummy_operator1, graph.start()); | 109 Node* n2 = graph.NewNode(&dummy_operator, graph.start()); |
112 Node* n3 = graph.NewNode(&dummy_operator1, graph.start()); | 110 Node* n3 = graph.NewNode(&dummy_operator, graph.start()); |
113 Node* n4 = graph.NewNode(&dummy_operator1, n2); | 111 Node* n4 = graph.NewNode(&dummy_operator, n2); |
114 Node* n5 = graph.NewNode(&dummy_operator1, n2); | 112 Node* n5 = graph.NewNode(&dummy_operator, n2); |
115 Node* n6 = graph.NewNode(&dummy_operator1, n3); | 113 Node* n6 = graph.NewNode(&dummy_operator, n3); |
116 Node* n7 = graph.NewNode(&dummy_operator1, n3); | 114 Node* n7 = graph.NewNode(&dummy_operator, n3); |
117 Node* n8 = graph.NewNode(&dummy_operator1, n5); | 115 Node* n8 = graph.NewNode(&dummy_operator, n5); |
118 Node* n9 = graph.NewNode(&dummy_operator1, n5); | 116 Node* n9 = graph.NewNode(&dummy_operator, n5); |
119 Node* n10 = graph.NewNode(&dummy_operator1, n9); | 117 Node* n10 = graph.NewNode(&dummy_operator, n9); |
120 Node* n11 = graph.NewNode(&dummy_operator1, n9); | 118 Node* n11 = graph.NewNode(&dummy_operator, n9); |
121 Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7}; | 119 Node* end_dependencies[6] = {n4, n8, n10, n11, n6, n7}; |
122 Node* end = graph.NewNode(&dummy_operator6, 6, end_dependencies); | 120 Node* end = graph.NewNode(&dummy_operator, 6, end_dependencies); |
123 graph.SetEnd(end); | 121 graph.SetEnd(end); |
124 | 122 |
125 OFStream os(stdout); | 123 OFStream os(stdout); |
126 os << AsDOT(graph); | 124 os << AsDOT(graph); |
127 SourcePositionTable table(&graph); | 125 SourcePositionTable table(&graph); |
128 os << AsJSON(graph, &table); | 126 os << AsJSON(graph, &table); |
129 } | 127 } |
OLD | NEW |