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/node-properties.h" | 6 #include "src/compiler/node-properties.h" |
7 #include "test/unittests/test-utils.h" | 7 #include "test/unittests/test-utils.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 | 9 |
10 using testing::AnyOf; | 10 using testing::AnyOf; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Node* if_true = Node::New(zone(), 3, common.IfTrue(), 1, &branch, false); | 97 Node* if_true = Node::New(zone(), 3, common.IfTrue(), 1, &branch, false); |
98 NodeProperties::CollectControlProjections(branch, result, arraysize(result)); | 98 NodeProperties::CollectControlProjections(branch, result, arraysize(result)); |
99 EXPECT_EQ(if_true, result[0]); | 99 EXPECT_EQ(if_true, result[0]); |
100 EXPECT_EQ(if_false, result[1]); | 100 EXPECT_EQ(if_false, result[1]); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 TEST_F(NodePropertiesTest, CollectControlProjections_Call) { | 104 TEST_F(NodePropertiesTest, CollectControlProjections_Call) { |
105 Node* result[2]; | 105 Node* result[2]; |
106 CommonOperatorBuilder common(zone()); | 106 CommonOperatorBuilder common(zone()); |
| 107 IfExceptionHint h = IfExceptionHint::kLocallyUncaught; |
107 Node* call = Node::New(zone(), 1, &kMockCallOperator, 0, nullptr, false); | 108 Node* call = Node::New(zone(), 1, &kMockCallOperator, 0, nullptr, false); |
108 Node* if_ex = Node::New(zone(), 2, common.IfException(), 1, &call, false); | 109 Node* if_ex = Node::New(zone(), 2, common.IfException(h), 1, &call, false); |
109 Node* if_ok = Node::New(zone(), 3, common.IfSuccess(), 1, &call, false); | 110 Node* if_ok = Node::New(zone(), 3, common.IfSuccess(), 1, &call, false); |
110 NodeProperties::CollectControlProjections(call, result, arraysize(result)); | 111 NodeProperties::CollectControlProjections(call, result, arraysize(result)); |
111 EXPECT_EQ(if_ok, result[0]); | 112 EXPECT_EQ(if_ok, result[0]); |
112 EXPECT_EQ(if_ex, result[1]); | 113 EXPECT_EQ(if_ex, result[1]); |
113 } | 114 } |
114 | 115 |
115 | 116 |
116 TEST_F(NodePropertiesTest, CollectControlProjections_Switch) { | 117 TEST_F(NodePropertiesTest, CollectControlProjections_Switch) { |
117 Node* result[3]; | 118 Node* result[3]; |
118 CommonOperatorBuilder common(zone()); | 119 CommonOperatorBuilder common(zone()); |
119 Node* sw = Node::New(zone(), 1, common.Switch(3), 0, nullptr, false); | 120 Node* sw = Node::New(zone(), 1, common.Switch(3), 0, nullptr, false); |
120 Node* if_default = Node::New(zone(), 2, common.IfDefault(), 1, &sw, false); | 121 Node* if_default = Node::New(zone(), 2, common.IfDefault(), 1, &sw, false); |
121 Node* if_value1 = Node::New(zone(), 3, common.IfValue(1), 1, &sw, false); | 122 Node* if_value1 = Node::New(zone(), 3, common.IfValue(1), 1, &sw, false); |
122 Node* if_value2 = Node::New(zone(), 4, common.IfValue(2), 1, &sw, false); | 123 Node* if_value2 = Node::New(zone(), 4, common.IfValue(2), 1, &sw, false); |
123 NodeProperties::CollectControlProjections(sw, result, arraysize(result)); | 124 NodeProperties::CollectControlProjections(sw, result, arraysize(result)); |
124 EXPECT_THAT(result[0], AnyOf(if_value1, if_value2)); | 125 EXPECT_THAT(result[0], AnyOf(if_value1, if_value2)); |
125 EXPECT_THAT(result[1], AnyOf(if_value1, if_value2)); | 126 EXPECT_THAT(result[1], AnyOf(if_value1, if_value2)); |
126 EXPECT_EQ(if_default, result[2]); | 127 EXPECT_EQ(if_default, result[2]); |
127 } | 128 } |
128 | 129 |
129 } // namespace compiler | 130 } // namespace compiler |
130 } // namespace internal | 131 } // namespace internal |
131 } // namespace v8 | 132 } // namespace v8 |
OLD | NEW |