Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "src/v8.h" | |
| 6 #include "test/cctest/cctest.h" | |
| 7 | |
| 8 #include "src/compiler/common-operator.h" | |
| 9 #include "src/compiler/generic-node-inl.h" | |
| 10 #include "src/compiler/generic-node.h" | |
| 11 #include "src/compiler/graph.h" | |
| 12 #include "src/compiler/graph-visualizer.h" | |
| 13 #include "src/compiler/js-operator.h" | |
| 14 #include "src/compiler/machine-operator.h" | |
| 15 #include "src/compiler/node.h" | |
| 16 #include "src/compiler/operator.h" | |
| 17 #include "src/compiler/schedule.h" | |
| 18 #include "src/compiler/scheduler.h" | |
| 19 #include "src/compiler/verifier.h" | |
| 20 | |
| 21 using namespace v8::internal; | |
| 22 using namespace v8::internal::compiler; | |
| 23 | |
| 24 TEST(NodeWithNullInputReachableFromEnd) { | |
| 25 HandleAndZoneScope scope; | |
| 26 Graph graph(scope.main_zone()); | |
| 27 CommonOperatorBuilder common(scope.main_zone()); | |
| 28 | |
| 29 Node* start = graph.NewNode(common.Start(0)); | |
| 30 graph.SetStart(start); | |
| 31 Node* k = graph.NewNode(common.Int32Constant(0)); | |
| 32 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | |
| 33 phi->ReplaceInput(0, NULL); | |
| 34 graph.SetEnd(phi); | |
| 35 | |
| 36 OFStream os(stdout); | |
| 37 os << AsDOT(graph); | |
| 38 os << AsJSON(graph); | |
| 39 } | |
| 40 | |
| 41 | |
| 42 TEST(NodeWithNullControlReachableFromEnd) { | |
| 43 HandleAndZoneScope scope; | |
| 44 Graph graph(scope.main_zone()); | |
| 45 CommonOperatorBuilder common(scope.main_zone()); | |
| 46 | |
| 47 Node* start = graph.NewNode(common.Start(0)); | |
| 48 graph.SetStart(start); | |
| 49 Node* k = graph.NewNode(common.Int32Constant(0)); | |
| 50 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | |
| 51 phi->ReplaceInput(1, NULL); | |
| 52 graph.SetEnd(phi); | |
| 53 | |
| 54 OFStream os(stdout); | |
| 55 os << AsDOT(graph); | |
| 56 os << AsJSON(graph); | |
| 57 } | |
| 58 | |
| 59 | |
| 60 TEST(NodeWithNullInputReachableFromStart) { | |
| 61 HandleAndZoneScope scope; | |
| 62 Graph graph(scope.main_zone()); | |
| 63 CommonOperatorBuilder common(scope.main_zone()); | |
| 64 | |
| 65 Node* start = graph.NewNode(common.Start(0)); | |
| 66 graph.SetStart(start); | |
| 67 Node* k = graph.NewNode(common.Int32Constant(0)); | |
| 68 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | |
| 69 phi->ReplaceInput(0, NULL); | |
| 70 graph.SetEnd(start); | |
| 71 | |
| 72 OFStream os(stdout); | |
| 73 os << AsDOT(graph); | |
| 74 os << AsJSON(graph); | |
| 75 } | |
| 76 | |
| 77 | |
| 78 TEST(NodeWithNullControlReachableFromStart) { | |
| 79 HandleAndZoneScope scope; | |
| 80 Graph graph(scope.main_zone()); | |
| 81 CommonOperatorBuilder common(scope.main_zone()); | |
| 82 | |
| 83 Node* start = graph.NewNode(common.Start(0)); | |
| 84 graph.SetStart(start); | |
| 85 Node* k = graph.NewNode(common.Int32Constant(0)); | |
| 86 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start); | |
| 87 phi->ReplaceInput(1, NULL); | |
|
Michael Starzinger
2014/11/03 17:16:43
nit: It doesn't seem like this phi is reachable fr
| |
| 88 graph.SetEnd(start); | |
| 89 | |
| 90 OFStream os(stdout); | |
| 91 os << AsDOT(graph); | |
| 92 os << AsJSON(graph); | |
| 93 } | |
| OLD | NEW |