OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 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 "test/unittests/compiler/node-test-utils.h" | 5 #include "test/unittests/compiler/node-test-utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 *os << "), index ("; | 1204 *os << "), index ("; |
1205 index_matcher_.DescribeTo(os); | 1205 index_matcher_.DescribeTo(os); |
1206 *os << "), effect ("; | 1206 *os << "), effect ("; |
1207 effect_matcher_.DescribeTo(os); | 1207 effect_matcher_.DescribeTo(os); |
1208 *os << ") and control ("; | 1208 *os << ") and control ("; |
1209 control_matcher_.DescribeTo(os); | 1209 control_matcher_.DescribeTo(os); |
1210 *os << ")"; | 1210 *os << ")"; |
1211 } | 1211 } |
1212 | 1212 |
1213 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 1213 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1214 Node* effect_node = nullptr; |
| 1215 Node* control_node = nullptr; |
| 1216 if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) { |
| 1217 effect_node = NodeProperties::GetEffectInput(node); |
| 1218 } |
| 1219 if (NodeProperties::FirstControlIndex(node) < node->InputCount()) { |
| 1220 control_node = NodeProperties::GetControlInput(node); |
| 1221 } |
1214 return (NodeMatcher::MatchAndExplain(node, listener) && | 1222 return (NodeMatcher::MatchAndExplain(node, listener) && |
1215 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", | 1223 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", |
1216 rep_matcher_, listener) && | 1224 rep_matcher_, listener) && |
1217 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 1225 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
1218 base_matcher_, listener) && | 1226 base_matcher_, listener) && |
1219 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 1227 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
1220 "index", index_matcher_, listener) && | 1228 "index", index_matcher_, listener) && |
1221 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 1229 PrintMatchAndExplain(effect_node, "effect", effect_matcher_, |
1222 effect_matcher_, listener) && | 1230 listener) && |
1223 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 1231 PrintMatchAndExplain(control_node, "control", control_matcher_, |
1224 "control", control_matcher_, listener)); | 1232 listener)); |
1225 } | 1233 } |
1226 | 1234 |
1227 private: | 1235 private: |
1228 const Matcher<LoadRepresentation> rep_matcher_; | 1236 const Matcher<LoadRepresentation> rep_matcher_; |
1229 const Matcher<Node*> base_matcher_; | 1237 const Matcher<Node*> base_matcher_; |
1230 const Matcher<Node*> index_matcher_; | 1238 const Matcher<Node*> index_matcher_; |
1231 const Matcher<Node*> effect_matcher_; | 1239 const Matcher<Node*> effect_matcher_; |
1232 const Matcher<Node*> control_matcher_; | 1240 const Matcher<Node*> control_matcher_; |
1233 }; | 1241 }; |
1234 | 1242 |
(...skipping 25 matching lines...) Expand all Loading... |
1260 *os << "), value ("; | 1268 *os << "), value ("; |
1261 value_matcher_.DescribeTo(os); | 1269 value_matcher_.DescribeTo(os); |
1262 *os << "), effect ("; | 1270 *os << "), effect ("; |
1263 effect_matcher_.DescribeTo(os); | 1271 effect_matcher_.DescribeTo(os); |
1264 *os << ") and control ("; | 1272 *os << ") and control ("; |
1265 control_matcher_.DescribeTo(os); | 1273 control_matcher_.DescribeTo(os); |
1266 *os << ")"; | 1274 *os << ")"; |
1267 } | 1275 } |
1268 | 1276 |
1269 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 1277 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1278 Node* effect_node = nullptr; |
| 1279 Node* control_node = nullptr; |
| 1280 if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) { |
| 1281 effect_node = NodeProperties::GetEffectInput(node); |
| 1282 } |
| 1283 if (NodeProperties::FirstControlIndex(node) < node->InputCount()) { |
| 1284 control_node = NodeProperties::GetControlInput(node); |
| 1285 } |
1270 return (NodeMatcher::MatchAndExplain(node, listener) && | 1286 return (NodeMatcher::MatchAndExplain(node, listener) && |
1271 PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep", | 1287 PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep", |
1272 rep_matcher_, listener) && | 1288 rep_matcher_, listener) && |
1273 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 1289 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
1274 base_matcher_, listener) && | 1290 base_matcher_, listener) && |
1275 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 1291 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
1276 "index", index_matcher_, listener) && | 1292 "index", index_matcher_, listener) && |
1277 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 1293 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
1278 "value", value_matcher_, listener) && | 1294 "value", value_matcher_, listener) && |
1279 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 1295 PrintMatchAndExplain(effect_node, "effect", effect_matcher_, |
1280 effect_matcher_, listener) && | 1296 listener) && |
1281 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 1297 PrintMatchAndExplain(control_node, "control", control_matcher_, |
1282 "control", control_matcher_, listener)); | 1298 listener)); |
1283 } | 1299 } |
1284 | 1300 |
1285 private: | 1301 private: |
1286 const Matcher<StoreRepresentation> rep_matcher_; | 1302 const Matcher<StoreRepresentation> rep_matcher_; |
1287 const Matcher<Node*> base_matcher_; | 1303 const Matcher<Node*> base_matcher_; |
1288 const Matcher<Node*> index_matcher_; | 1304 const Matcher<Node*> index_matcher_; |
1289 const Matcher<Node*> value_matcher_; | 1305 const Matcher<Node*> value_matcher_; |
1290 const Matcher<Node*> effect_matcher_; | 1306 const Matcher<Node*> effect_matcher_; |
1291 const Matcher<Node*> control_matcher_; | 1307 const Matcher<Node*> control_matcher_; |
1292 }; | 1308 }; |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 IS_UNOP_MATCHER(Float64ExtractHighWord32) | 2105 IS_UNOP_MATCHER(Float64ExtractHighWord32) |
2090 IS_UNOP_MATCHER(NumberToInt32) | 2106 IS_UNOP_MATCHER(NumberToInt32) |
2091 IS_UNOP_MATCHER(NumberToUint32) | 2107 IS_UNOP_MATCHER(NumberToUint32) |
2092 IS_UNOP_MATCHER(ObjectIsSmi) | 2108 IS_UNOP_MATCHER(ObjectIsSmi) |
2093 IS_UNOP_MATCHER(Word32Clz) | 2109 IS_UNOP_MATCHER(Word32Clz) |
2094 #undef IS_UNOP_MATCHER | 2110 #undef IS_UNOP_MATCHER |
2095 | 2111 |
2096 } // namespace compiler | 2112 } // namespace compiler |
2097 } // namespace internal | 2113 } // namespace internal |
2098 } // namespace v8 | 2114 } // namespace v8 |
OLD | NEW |