| Index: test/unittests/compiler/node-properties-unittest.cc
|
| diff --git a/test/unittests/compiler/node-properties-unittest.cc b/test/unittests/compiler/node-properties-unittest.cc
|
| index d6d80738160963f50222cab39ae127324a32afd3..bb471bd01e5f80f270a34dd30d694c1c3f1e6d00 100644
|
| --- a/test/unittests/compiler/node-properties-unittest.cc
|
| +++ b/test/unittests/compiler/node-properties-unittest.cc
|
| @@ -7,6 +7,7 @@
|
| #include "test/unittests/test-utils.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
|
|
| +using testing::AnyOf;
|
| using testing::IsNull;
|
|
|
| namespace v8 {
|
| @@ -27,6 +28,32 @@ TEST_F(NodePropertiesTest, FindProjection) {
|
| EXPECT_THAT(NodeProperties::FindProjection(start, 1234567890), IsNull());
|
| }
|
|
|
| +
|
| +TEST_F(NodePropertiesTest, CollectControlProjections_Branch) {
|
| + Node* result[2];
|
| + CommonOperatorBuilder common(zone());
|
| + Node* branch = Node::New(zone(), 1, common.Branch(), 0, nullptr, false);
|
| + Node* if_false = Node::New(zone(), 2, common.IfFalse(), 1, &branch, false);
|
| + Node* if_true = Node::New(zone(), 3, common.IfTrue(), 1, &branch, false);
|
| + NodeProperties::CollectControlProjections(branch, result, arraysize(result));
|
| + EXPECT_EQ(if_true, result[0]);
|
| + EXPECT_EQ(if_false, result[1]);
|
| +}
|
| +
|
| +
|
| +TEST_F(NodePropertiesTest, CollectControlProjections_Switch) {
|
| + Node* result[3];
|
| + CommonOperatorBuilder common(zone());
|
| + Node* sw = Node::New(zone(), 1, common.Switch(3), 0, nullptr, false);
|
| + Node* if_default = Node::New(zone(), 2, common.IfDefault(), 1, &sw, false);
|
| + Node* if_value1 = Node::New(zone(), 3, common.IfValue(1), 1, &sw, false);
|
| + Node* if_value2 = Node::New(zone(), 4, common.IfValue(2), 1, &sw, false);
|
| + NodeProperties::CollectControlProjections(sw, result, arraysize(result));
|
| + EXPECT_THAT(result[0], AnyOf(if_value1, if_value2));
|
| + EXPECT_THAT(result[1], AnyOf(if_value1, if_value2));
|
| + EXPECT_EQ(if_default, result[2]);
|
| +}
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|