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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/dead-code-elimination.h" | 6 #include "src/compiler/dead-code-elimination.h" |
7 #include "test/unittests/compiler/graph-reducer-unittest.h" | 7 #include "test/unittests/compiler/graph-reducer-unittest.h" |
8 #include "test/unittests/compiler/graph-unittest.h" | 8 #include "test/unittests/compiler/graph-unittest.h" |
9 #include "test/unittests/compiler/node-test-utils.h" | 9 #include "test/unittests/compiler/node-test-utils.h" |
10 #include "testing/gmock-support.h" | 10 #include "testing/gmock-support.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 ASSERT_TRUE(r.Changed()); | 117 ASSERT_TRUE(r.Changed()); |
118 EXPECT_THAT(r.replacement(), IsDead()); | 118 EXPECT_THAT(r.replacement(), IsDead()); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 // ----------------------------------------------------------------------------- | 122 // ----------------------------------------------------------------------------- |
123 // IfException | 123 // IfException |
124 | 124 |
125 | 125 |
126 TEST_F(DeadCodeEliminationTest, IfExceptionWithDeadControlInput) { | 126 TEST_F(DeadCodeEliminationTest, IfExceptionWithDeadControlInput) { |
127 IfExceptionHint const kHints[] = {IfExceptionHint::kLocallyCaught, | 127 Reduction const r = |
128 IfExceptionHint::kLocallyUncaught}; | 128 Reduce(graph()->NewNode(common()->IfException(), graph()->start(), |
129 TRACED_FOREACH(IfExceptionHint, hint, kHints) { | 129 graph()->NewNode(common()->Dead()))); |
130 Reduction const r = | 130 ASSERT_TRUE(r.Changed()); |
131 Reduce(graph()->NewNode(common()->IfException(hint), graph()->start(), | 131 EXPECT_THAT(r.replacement(), IsDead()); |
132 graph()->NewNode(common()->Dead()))); | |
133 ASSERT_TRUE(r.Changed()); | |
134 EXPECT_THAT(r.replacement(), IsDead()); | |
135 } | |
136 } | 132 } |
137 | 133 |
138 | 134 |
139 // ----------------------------------------------------------------------------- | 135 // ----------------------------------------------------------------------------- |
140 // End | 136 // End |
141 | 137 |
142 | 138 |
143 TEST_F(DeadCodeEliminationTest, EndWithDeadAndStart) { | 139 TEST_F(DeadCodeEliminationTest, EndWithDeadAndStart) { |
144 Node* const dead = graph()->NewNode(common()->Dead()); | 140 Node* const dead = graph()->NewNode(common()->Dead()); |
145 Node* const start = graph()->start(); | 141 Node* const start = graph()->start(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 Reduction const r = | 364 Reduction const r = |
369 Reduce(graph()->NewNode(common()->Terminate(), graph()->start(), | 365 Reduce(graph()->NewNode(common()->Terminate(), graph()->start(), |
370 graph()->NewNode(common()->Dead()))); | 366 graph()->NewNode(common()->Dead()))); |
371 ASSERT_TRUE(r.Changed()); | 367 ASSERT_TRUE(r.Changed()); |
372 EXPECT_THAT(r.replacement(), IsDead()); | 368 EXPECT_THAT(r.replacement(), IsDead()); |
373 } | 369 } |
374 | 370 |
375 } // namespace compiler | 371 } // namespace compiler |
376 } // namespace internal | 372 } // namespace internal |
377 } // namespace v8 | 373 } // namespace v8 |
OLD | NEW |