Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: test/unittests/compiler/node-test-utils.cc

Issue 1123213002: [turbofan] Connect non-terminating loops via Terminate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 "control", control_matcher_, listener)); 316 "control", control_matcher_, listener));
317 } 317 }
318 318
319 private: 319 private:
320 const Matcher<Node*> value_matcher_; 320 const Matcher<Node*> value_matcher_;
321 const Matcher<Node*> effect_matcher_; 321 const Matcher<Node*> effect_matcher_;
322 const Matcher<Node*> control_matcher_; 322 const Matcher<Node*> control_matcher_;
323 }; 323 };
324 324
325 325
326 class IsTerminateMatcher final : public NodeMatcher {
327 public:
328 IsTerminateMatcher(const Matcher<Node*>& effect_matcher,
329 const Matcher<Node*>& control_matcher)
330 : NodeMatcher(IrOpcode::kTerminate),
331 effect_matcher_(effect_matcher),
332 control_matcher_(control_matcher) {}
333
334 void DescribeTo(std::ostream* os) const final {
335 NodeMatcher::DescribeTo(os);
336 *os << " whose effect (";
337 effect_matcher_.DescribeTo(os);
338 *os << ") and control (";
339 control_matcher_.DescribeTo(os);
340 *os << ")";
341 }
342
343 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
344 return (NodeMatcher::MatchAndExplain(node, listener) &&
345 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
346 effect_matcher_, listener) &&
347 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
348 "control", control_matcher_, listener));
349 }
350
351 private:
352 const Matcher<Node*> effect_matcher_;
353 const Matcher<Node*> control_matcher_;
354 };
355
356
326 template <typename T> 357 template <typename T>
327 class IsConstantMatcher final : public NodeMatcher { 358 class IsConstantMatcher final : public NodeMatcher {
328 public: 359 public:
329 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) 360 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher)
330 : NodeMatcher(opcode), value_matcher_(value_matcher) {} 361 : NodeMatcher(opcode), value_matcher_(value_matcher) {}
331 362
332 void DescribeTo(std::ostream* os) const final { 363 void DescribeTo(std::ostream* os) const final {
333 NodeMatcher::DescribeTo(os); 364 NodeMatcher::DescribeTo(os);
334 *os << " whose value ("; 365 *os << " whose value (";
335 value_matcher_.DescribeTo(os); 366 value_matcher_.DescribeTo(os);
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 "input", input_matcher_, listener)); 1313 "input", input_matcher_, listener));
1283 } 1314 }
1284 1315
1285 private: 1316 private:
1286 const Matcher<Node*> input_matcher_; 1317 const Matcher<Node*> input_matcher_;
1287 }; 1318 };
1288 1319
1289 } // namespace 1320 } // namespace
1290 1321
1291 1322
1292 Matcher<Node*> IsAlways() {
1293 return MakeMatcher(new NodeMatcher(IrOpcode::kAlways));
1294 }
1295
1296
1297 Matcher<Node*> IsEnd(const Matcher<Node*>& control_matcher) { 1323 Matcher<Node*> IsEnd(const Matcher<Node*>& control_matcher) {
1298 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control_matcher)); 1324 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control_matcher));
1299 } 1325 }
1300 1326
1301 1327
1302 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher, 1328 Matcher<Node*> IsBranch(const Matcher<Node*>& value_matcher,
1303 const Matcher<Node*>& control_matcher) { 1329 const Matcher<Node*>& control_matcher) {
1304 return MakeMatcher(new IsBranchMatcher(value_matcher, control_matcher)); 1330 return MakeMatcher(new IsBranchMatcher(value_matcher, control_matcher));
1305 } 1331 }
1306 1332
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 1408
1383 1409
1384 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher, 1410 Matcher<Node*> IsReturn(const Matcher<Node*>& value_matcher,
1385 const Matcher<Node*>& effect_matcher, 1411 const Matcher<Node*>& effect_matcher,
1386 const Matcher<Node*>& control_matcher) { 1412 const Matcher<Node*>& control_matcher) {
1387 return MakeMatcher( 1413 return MakeMatcher(
1388 new IsReturnMatcher(value_matcher, effect_matcher, control_matcher)); 1414 new IsReturnMatcher(value_matcher, effect_matcher, control_matcher));
1389 } 1415 }
1390 1416
1391 1417
1418 Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher,
1419 const Matcher<Node*>& control_matcher) {
1420 return MakeMatcher(new IsTerminateMatcher(effect_matcher, control_matcher));
1421 }
1422
1423
1392 Matcher<Node*> IsExternalConstant( 1424 Matcher<Node*> IsExternalConstant(
1393 const Matcher<ExternalReference>& value_matcher) { 1425 const Matcher<ExternalReference>& value_matcher) {
1394 return MakeMatcher(new IsConstantMatcher<ExternalReference>( 1426 return MakeMatcher(new IsConstantMatcher<ExternalReference>(
1395 IrOpcode::kExternalConstant, value_matcher)); 1427 IrOpcode::kExternalConstant, value_matcher));
1396 } 1428 }
1397 1429
1398 1430
1399 Matcher<Node*> IsHeapConstant( 1431 Matcher<Node*> IsHeapConstant(
1400 const Matcher<Unique<HeapObject> >& value_matcher) { 1432 const Matcher<Unique<HeapObject> >& value_matcher) {
1401 return MakeMatcher(new IsConstantMatcher<Unique<HeapObject> >( 1433 return MakeMatcher(new IsConstantMatcher<Unique<HeapObject> >(
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 IS_UNOP_MATCHER(NumberToInt32) 1770 IS_UNOP_MATCHER(NumberToInt32)
1739 IS_UNOP_MATCHER(NumberToUint32) 1771 IS_UNOP_MATCHER(NumberToUint32)
1740 IS_UNOP_MATCHER(ObjectIsSmi) 1772 IS_UNOP_MATCHER(ObjectIsSmi)
1741 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) 1773 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi)
1742 IS_UNOP_MATCHER(Word32Clz) 1774 IS_UNOP_MATCHER(Word32Clz)
1743 #undef IS_UNOP_MATCHER 1775 #undef IS_UNOP_MATCHER
1744 1776
1745 } // namespace compiler 1777 } // namespace compiler
1746 } // namespace internal 1778 } // namespace internal
1747 } // namespace v8 1779 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | test/unittests/compiler/scheduler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698