| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/graph-trimmer.h" | 5 #include "src/compiler/graph-trimmer.h" |
| 6 #include "test/unittests/compiler/graph-unittest.h" | 6 #include "test/unittests/compiler/graph-unittest.h" |
| 7 #include "testing/gmock-support.h" | 7 #include "testing/gmock-support.h" |
| 8 | 8 |
| 9 using testing::ElementsAre; | 9 using testing::ElementsAre; |
| 10 using testing::UnorderedElementsAre; | 10 using testing::UnorderedElementsAre; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 void TrimGraph() { | 26 void TrimGraph() { |
| 27 GraphTrimmer trimmer(zone(), graph()); | 27 GraphTrimmer trimmer(zone(), graph()); |
| 28 trimmer.TrimGraph(); | 28 trimmer.TrimGraph(); |
| 29 } | 29 } |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 const Operator kDead0(IrOpcode::kDeadControl, Operator::kNoProperties, "Dead0", | 35 const Operator kDead0(IrOpcode::kDead, Operator::kNoProperties, "Dead0", 0, 0, |
| 36 0, 0, 1, 0, 0, 0); | 36 1, 0, 0, 0); |
| 37 const Operator kLive0(IrOpcode::kDeadControl, Operator::kNoProperties, "Live0", | 37 const Operator kLive0(IrOpcode::kDead, Operator::kNoProperties, "Live0", 0, 0, |
| 38 0, 0, 1, 0, 0, 1); | 38 1, 0, 0, 1); |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 | 42 |
| 43 TEST_F(GraphTrimmerTest, Empty) { | 43 TEST_F(GraphTrimmerTest, Empty) { |
| 44 Node* const start = graph()->NewNode(common()->Start(0)); | 44 Node* const start = graph()->NewNode(common()->Start(0)); |
| 45 Node* const end = graph()->NewNode(common()->End(1), start); | 45 Node* const end = graph()->NewNode(common()->End(1), start); |
| 46 graph()->SetStart(start); | 46 graph()->SetStart(start); |
| 47 graph()->SetEnd(end); | 47 graph()->SetEnd(end); |
| 48 TrimGraph(); | 48 TrimGraph(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 76 Node* const live0 = graph()->NewNode(&kLive0, graph()->start()); | 76 Node* const live0 = graph()->NewNode(&kLive0, graph()->start()); |
| 77 Node* const live1 = graph()->NewNode(&kLive0, graph()->start()); | 77 Node* const live1 = graph()->NewNode(&kLive0, graph()->start()); |
| 78 graph()->SetEnd(graph()->NewNode(common()->End(1), live0)); | 78 graph()->SetEnd(graph()->NewNode(common()->End(1), live0)); |
| 79 TrimGraph(live1); | 79 TrimGraph(live1); |
| 80 EXPECT_THAT(graph()->start()->uses(), UnorderedElementsAre(live0, live1)); | 80 EXPECT_THAT(graph()->start()->uses(), UnorderedElementsAre(live0, live1)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace compiler | 83 } // namespace compiler |
| 84 } // namespace internal | 84 } // namespace internal |
| 85 } // namespace v8 | 85 } // namespace v8 |
| OLD | NEW |