| 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/compiler/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
| 7 #include "src/compiler/graph-visualizer.h" | 7 #include "src/compiler/graph-visualizer.h" |
| 8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 | 27 |
| 28 TEST(NodeWithNullInputReachableFromEnd) { | 28 TEST(NodeWithNullInputReachableFromEnd) { |
| 29 HandleAndZoneScope scope; | 29 HandleAndZoneScope scope; |
| 30 Graph graph(scope.main_zone()); | 30 Graph graph(scope.main_zone()); |
| 31 CommonOperatorBuilder common(scope.main_zone()); | 31 CommonOperatorBuilder common(scope.main_zone()); |
| 32 | 32 |
| 33 Node* start = graph.NewNode(common.Start(0)); | 33 Node* start = graph.NewNode(common.Start(0)); |
| 34 graph.SetStart(start); | 34 graph.SetStart(start); |
| 35 Node* k = graph.NewNode(common.Int32Constant(0)); | 35 Node* k = graph.NewNode(common.Int32Constant(0)); |
| 36 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | 36 Node* phi = |
| 37 graph.NewNode(common.Phi(MachineRepresentation::kTagged, 1), k, start); |
| 37 phi->ReplaceInput(0, NULL); | 38 phi->ReplaceInput(0, NULL); |
| 38 graph.SetEnd(phi); | 39 graph.SetEnd(phi); |
| 39 | 40 |
| 40 OFStream os(stdout); | 41 OFStream os(stdout); |
| 41 os << AsDOT(graph); | 42 os << AsDOT(graph); |
| 42 SourcePositionTable table(&graph); | 43 SourcePositionTable table(&graph); |
| 43 os << AsJSON(graph, &table); | 44 os << AsJSON(graph, &table); |
| 44 } | 45 } |
| 45 | 46 |
| 46 | 47 |
| 47 TEST(NodeWithNullControlReachableFromEnd) { | 48 TEST(NodeWithNullControlReachableFromEnd) { |
| 48 HandleAndZoneScope scope; | 49 HandleAndZoneScope scope; |
| 49 Graph graph(scope.main_zone()); | 50 Graph graph(scope.main_zone()); |
| 50 CommonOperatorBuilder common(scope.main_zone()); | 51 CommonOperatorBuilder common(scope.main_zone()); |
| 51 | 52 |
| 52 Node* start = graph.NewNode(common.Start(0)); | 53 Node* start = graph.NewNode(common.Start(0)); |
| 53 graph.SetStart(start); | 54 graph.SetStart(start); |
| 54 Node* k = graph.NewNode(common.Int32Constant(0)); | 55 Node* k = graph.NewNode(common.Int32Constant(0)); |
| 55 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | 56 Node* phi = |
| 57 graph.NewNode(common.Phi(MachineRepresentation::kTagged, 1), k, start); |
| 56 phi->ReplaceInput(1, NULL); | 58 phi->ReplaceInput(1, NULL); |
| 57 graph.SetEnd(phi); | 59 graph.SetEnd(phi); |
| 58 | 60 |
| 59 OFStream os(stdout); | 61 OFStream os(stdout); |
| 60 os << AsDOT(graph); | 62 os << AsDOT(graph); |
| 61 SourcePositionTable table(&graph); | 63 SourcePositionTable table(&graph); |
| 62 os << AsJSON(graph, &table); | 64 os << AsJSON(graph, &table); |
| 63 } | 65 } |
| 64 | 66 |
| 65 | 67 |
| 66 TEST(NodeWithNullInputReachableFromStart) { | 68 TEST(NodeWithNullInputReachableFromStart) { |
| 67 HandleAndZoneScope scope; | 69 HandleAndZoneScope scope; |
| 68 Graph graph(scope.main_zone()); | 70 Graph graph(scope.main_zone()); |
| 69 CommonOperatorBuilder common(scope.main_zone()); | 71 CommonOperatorBuilder common(scope.main_zone()); |
| 70 | 72 |
| 71 Node* start = graph.NewNode(common.Start(0)); | 73 Node* start = graph.NewNode(common.Start(0)); |
| 72 graph.SetStart(start); | 74 graph.SetStart(start); |
| 73 Node* k = graph.NewNode(common.Int32Constant(0)); | 75 Node* k = graph.NewNode(common.Int32Constant(0)); |
| 74 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | 76 Node* phi = |
| 77 graph.NewNode(common.Phi(MachineRepresentation::kTagged, 1), k, start); |
| 75 phi->ReplaceInput(0, NULL); | 78 phi->ReplaceInput(0, NULL); |
| 76 graph.SetEnd(start); | 79 graph.SetEnd(start); |
| 77 | 80 |
| 78 OFStream os(stdout); | 81 OFStream os(stdout); |
| 79 os << AsDOT(graph); | 82 os << AsDOT(graph); |
| 80 SourcePositionTable table(&graph); | 83 SourcePositionTable table(&graph); |
| 81 os << AsJSON(graph, &table); | 84 os << AsJSON(graph, &table); |
| 82 } | 85 } |
| 83 | 86 |
| 84 | 87 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 126 |
| 124 OFStream os(stdout); | 127 OFStream os(stdout); |
| 125 os << AsDOT(graph); | 128 os << AsDOT(graph); |
| 126 SourcePositionTable table(&graph); | 129 SourcePositionTable table(&graph); |
| 127 os << AsJSON(graph, &table); | 130 os << AsJSON(graph, &table); |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace compiler | 133 } // namespace compiler |
| 131 } // namespace internal | 134 } // namespace internal |
| 132 } // namespace v8 | 135 } // namespace v8 |
| OLD | NEW |