| 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" |
| 11 #include "src/compiler/js-operator.h" | 11 #include "src/compiler/js-operator.h" |
| 12 #include "src/compiler/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
| 13 #include "src/compiler/simplified-operator.h" | 13 #include "src/compiler/simplified-operator.h" |
| 14 #include "src/unique.h" | 14 #include "src/unique.h" |
| 15 | 15 |
| 16 using testing::_; | 16 using testing::_; |
| 17 using testing::MakeMatcher; | 17 using testing::MakeMatcher; |
| 18 using testing::MatcherInterface; | 18 using testing::MatcherInterface; |
| 19 using testing::MatchResultListener; | 19 using testing::MatchResultListener; |
| 20 using testing::StringMatchResultListener; | 20 using testing::StringMatchResultListener; |
| 21 | 21 |
| 22 namespace v8 { | 22 namespace v8 { |
| 23 namespace internal { | 23 namespace internal { |
| 24 |
| 25 bool operator==(Handle<HeapObject> const& lhs, Handle<HeapObject> const& rhs) { |
| 26 return lhs.is_identical_to(rhs); |
| 27 } |
| 28 |
| 24 namespace compiler { | 29 namespace compiler { |
| 25 | 30 |
| 26 namespace { | 31 namespace { |
| 27 | 32 |
| 28 template <typename T> | 33 template <typename T> |
| 29 bool PrintMatchAndExplain(const T& value, const std::string& value_name, | 34 bool PrintMatchAndExplain(const T& value, const std::string& value_name, |
| 30 const Matcher<T>& value_matcher, | 35 const Matcher<T>& value_matcher, |
| 31 MatchResultListener* listener) { | 36 MatchResultListener* listener) { |
| 32 StringMatchResultListener value_listener; | 37 StringMatchResultListener value_listener; |
| 33 if (!value_matcher.MatchAndExplain(value, &value_listener)) { | 38 if (!value_matcher.MatchAndExplain(value, &value_listener)) { |
| (...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 } | 1526 } |
| 1522 | 1527 |
| 1523 | 1528 |
| 1524 Matcher<Node*> IsExternalConstant( | 1529 Matcher<Node*> IsExternalConstant( |
| 1525 const Matcher<ExternalReference>& value_matcher) { | 1530 const Matcher<ExternalReference>& value_matcher) { |
| 1526 return MakeMatcher(new IsConstantMatcher<ExternalReference>( | 1531 return MakeMatcher(new IsConstantMatcher<ExternalReference>( |
| 1527 IrOpcode::kExternalConstant, value_matcher)); | 1532 IrOpcode::kExternalConstant, value_matcher)); |
| 1528 } | 1533 } |
| 1529 | 1534 |
| 1530 | 1535 |
| 1531 Matcher<Node*> IsHeapConstant( | 1536 Matcher<Node*> IsHeapConstant(Handle<HeapObject> value) { |
| 1532 const Matcher<Unique<HeapObject> >& value_matcher) { | 1537 return MakeMatcher(new IsConstantMatcher<Handle<HeapObject>>( |
| 1533 return MakeMatcher(new IsConstantMatcher<Unique<HeapObject> >( | 1538 IrOpcode::kHeapConstant, value)); |
| 1534 IrOpcode::kHeapConstant, value_matcher)); | |
| 1535 } | 1539 } |
| 1536 | 1540 |
| 1537 | 1541 |
| 1538 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher) { | 1542 Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher) { |
| 1539 return MakeMatcher( | 1543 return MakeMatcher( |
| 1540 new IsConstantMatcher<int32_t>(IrOpcode::kInt32Constant, value_matcher)); | 1544 new IsConstantMatcher<int32_t>(IrOpcode::kInt32Constant, value_matcher)); |
| 1541 } | 1545 } |
| 1542 | 1546 |
| 1543 | 1547 |
| 1544 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher) { | 1548 Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher) { |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 IS_UNOP_MATCHER(NumberToInt32) | 2046 IS_UNOP_MATCHER(NumberToInt32) |
| 2043 IS_UNOP_MATCHER(NumberToUint32) | 2047 IS_UNOP_MATCHER(NumberToUint32) |
| 2044 IS_UNOP_MATCHER(ObjectIsSmi) | 2048 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2045 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 2049 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
| 2046 IS_UNOP_MATCHER(Word32Clz) | 2050 IS_UNOP_MATCHER(Word32Clz) |
| 2047 #undef IS_UNOP_MATCHER | 2051 #undef IS_UNOP_MATCHER |
| 2048 | 2052 |
| 2049 } // namespace compiler | 2053 } // namespace compiler |
| 2050 } // namespace internal | 2054 } // namespace internal |
| 2051 } // namespace v8 | 2055 } // namespace v8 |
| OLD | NEW |