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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 listener)); | 796 listener)); |
797 } | 797 } |
798 | 798 |
799 private: | 799 private: |
800 const Matcher<CallDescriptor const*> descriptor_matcher_; | 800 const Matcher<CallDescriptor const*> descriptor_matcher_; |
801 const std::vector<Matcher<Node*>> value_matchers_; | 801 const std::vector<Matcher<Node*>> value_matchers_; |
802 const Matcher<Node*> effect_matcher_; | 802 const Matcher<Node*> effect_matcher_; |
803 const Matcher<Node*> control_matcher_; | 803 const Matcher<Node*> control_matcher_; |
804 }; | 804 }; |
805 | 805 |
806 | |
807 class IsReferenceEqualMatcher final : public NodeMatcher { | |
808 public: | |
809 IsReferenceEqualMatcher(const Matcher<Type*>& type_matcher, | |
810 const Matcher<Node*>& lhs_matcher, | |
811 const Matcher<Node*>& rhs_matcher) | |
812 : NodeMatcher(IrOpcode::kReferenceEqual), | |
813 type_matcher_(type_matcher), | |
814 lhs_matcher_(lhs_matcher), | |
815 rhs_matcher_(rhs_matcher) {} | |
816 | |
817 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
818 return (NodeMatcher::MatchAndExplain(node, listener) && | |
819 // TODO(bmeurer): The type parameter is currently ignored. | |
820 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", | |
821 lhs_matcher_, listener) && | |
822 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | |
823 rhs_matcher_, listener)); | |
824 } | |
825 | |
826 private: | |
827 const Matcher<Type*> type_matcher_; | |
828 const Matcher<Node*> lhs_matcher_; | |
829 const Matcher<Node*> rhs_matcher_; | |
830 }; | |
831 | |
832 class IsSpeculativeBinopMatcher final : public NodeMatcher { | 806 class IsSpeculativeBinopMatcher final : public NodeMatcher { |
833 public: | 807 public: |
834 IsSpeculativeBinopMatcher(IrOpcode::Value opcode, | 808 IsSpeculativeBinopMatcher(IrOpcode::Value opcode, |
835 const Matcher<NumberOperationHint>& hint_matcher, | 809 const Matcher<NumberOperationHint>& hint_matcher, |
836 const Matcher<Node*>& lhs_matcher, | 810 const Matcher<Node*>& lhs_matcher, |
837 const Matcher<Node*>& rhs_matcher, | 811 const Matcher<Node*>& rhs_matcher, |
838 const Matcher<Node*>& effect_matcher, | 812 const Matcher<Node*>& effect_matcher, |
839 const Matcher<Node*>& control_matcher) | 813 const Matcher<Node*>& control_matcher) |
840 : NodeMatcher(opcode), | 814 : NodeMatcher(opcode), |
841 hint_matcher_(hint_matcher), | 815 hint_matcher_(hint_matcher), |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 value_matchers.push_back(value2_matcher); | 2039 value_matchers.push_back(value2_matcher); |
2066 value_matchers.push_back(value3_matcher); | 2040 value_matchers.push_back(value3_matcher); |
2067 value_matchers.push_back(value4_matcher); | 2041 value_matchers.push_back(value4_matcher); |
2068 value_matchers.push_back(value5_matcher); | 2042 value_matchers.push_back(value5_matcher); |
2069 value_matchers.push_back(value6_matcher); | 2043 value_matchers.push_back(value6_matcher); |
2070 value_matchers.push_back(value7_matcher); | 2044 value_matchers.push_back(value7_matcher); |
2071 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, | 2045 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, |
2072 effect_matcher, control_matcher)); | 2046 effect_matcher, control_matcher)); |
2073 } | 2047 } |
2074 | 2048 |
2075 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, | |
2076 const Matcher<Node*>& lhs_matcher, | |
2077 const Matcher<Node*>& rhs_matcher) { | |
2078 return MakeMatcher( | |
2079 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); | |
2080 } | |
2081 | |
2082 #define DEFINE_SPECULATIVE_BINOP_MATCHER(opcode) \ | 2049 #define DEFINE_SPECULATIVE_BINOP_MATCHER(opcode) \ |
2083 Matcher<Node*> Is##opcode(const Matcher<NumberOperationHint>& hint_matcher, \ | 2050 Matcher<Node*> Is##opcode(const Matcher<NumberOperationHint>& hint_matcher, \ |
2084 const Matcher<Node*>& lhs_matcher, \ | 2051 const Matcher<Node*>& lhs_matcher, \ |
2085 const Matcher<Node*>& rhs_matcher, \ | 2052 const Matcher<Node*>& rhs_matcher, \ |
2086 const Matcher<Node*>& effect_matcher, \ | 2053 const Matcher<Node*>& effect_matcher, \ |
2087 const Matcher<Node*>& control_matcher) { \ | 2054 const Matcher<Node*>& control_matcher) { \ |
2088 return MakeMatcher(new IsSpeculativeBinopMatcher( \ | 2055 return MakeMatcher(new IsSpeculativeBinopMatcher( \ |
2089 IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \ | 2056 IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \ |
2090 effect_matcher, control_matcher)); \ | 2057 effect_matcher, control_matcher)); \ |
2091 } | 2058 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2274 IS_BINOP_MATCHER(NumberSubtract) | 2241 IS_BINOP_MATCHER(NumberSubtract) |
2275 IS_BINOP_MATCHER(NumberMultiply) | 2242 IS_BINOP_MATCHER(NumberMultiply) |
2276 IS_BINOP_MATCHER(NumberShiftLeft) | 2243 IS_BINOP_MATCHER(NumberShiftLeft) |
2277 IS_BINOP_MATCHER(NumberShiftRight) | 2244 IS_BINOP_MATCHER(NumberShiftRight) |
2278 IS_BINOP_MATCHER(NumberShiftRightLogical) | 2245 IS_BINOP_MATCHER(NumberShiftRightLogical) |
2279 IS_BINOP_MATCHER(NumberImul) | 2246 IS_BINOP_MATCHER(NumberImul) |
2280 IS_BINOP_MATCHER(NumberAtan2) | 2247 IS_BINOP_MATCHER(NumberAtan2) |
2281 IS_BINOP_MATCHER(NumberMax) | 2248 IS_BINOP_MATCHER(NumberMax) |
2282 IS_BINOP_MATCHER(NumberMin) | 2249 IS_BINOP_MATCHER(NumberMin) |
2283 IS_BINOP_MATCHER(NumberPow) | 2250 IS_BINOP_MATCHER(NumberPow) |
| 2251 IS_BINOP_MATCHER(ReferenceEqual) |
2284 IS_BINOP_MATCHER(Word32And) | 2252 IS_BINOP_MATCHER(Word32And) |
2285 IS_BINOP_MATCHER(Word32Or) | 2253 IS_BINOP_MATCHER(Word32Or) |
2286 IS_BINOP_MATCHER(Word32Xor) | 2254 IS_BINOP_MATCHER(Word32Xor) |
2287 IS_BINOP_MATCHER(Word32Sar) | 2255 IS_BINOP_MATCHER(Word32Sar) |
2288 IS_BINOP_MATCHER(Word32Shl) | 2256 IS_BINOP_MATCHER(Word32Shl) |
2289 IS_BINOP_MATCHER(Word32Shr) | 2257 IS_BINOP_MATCHER(Word32Shr) |
2290 IS_BINOP_MATCHER(Word32Ror) | 2258 IS_BINOP_MATCHER(Word32Ror) |
2291 IS_BINOP_MATCHER(Word32Equal) | 2259 IS_BINOP_MATCHER(Word32Equal) |
2292 IS_BINOP_MATCHER(Word64And) | 2260 IS_BINOP_MATCHER(Word64And) |
2293 IS_BINOP_MATCHER(Word64Or) | 2261 IS_BINOP_MATCHER(Word64Or) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 IS_UNOP_MATCHER(NumberSqrt) | 2341 IS_UNOP_MATCHER(NumberSqrt) |
2374 IS_UNOP_MATCHER(NumberTan) | 2342 IS_UNOP_MATCHER(NumberTan) |
2375 IS_UNOP_MATCHER(NumberTanh) | 2343 IS_UNOP_MATCHER(NumberTanh) |
2376 IS_UNOP_MATCHER(NumberTrunc) | 2344 IS_UNOP_MATCHER(NumberTrunc) |
2377 IS_UNOP_MATCHER(NumberToBoolean) | 2345 IS_UNOP_MATCHER(NumberToBoolean) |
2378 IS_UNOP_MATCHER(NumberToInt32) | 2346 IS_UNOP_MATCHER(NumberToInt32) |
2379 IS_UNOP_MATCHER(NumberToUint32) | 2347 IS_UNOP_MATCHER(NumberToUint32) |
2380 IS_UNOP_MATCHER(PlainPrimitiveToNumber) | 2348 IS_UNOP_MATCHER(PlainPrimitiveToNumber) |
2381 IS_UNOP_MATCHER(ObjectIsReceiver) | 2349 IS_UNOP_MATCHER(ObjectIsReceiver) |
2382 IS_UNOP_MATCHER(ObjectIsSmi) | 2350 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2351 IS_UNOP_MATCHER(ObjectIsUndetectable) |
2383 IS_UNOP_MATCHER(StringFromCharCode) | 2352 IS_UNOP_MATCHER(StringFromCharCode) |
2384 IS_UNOP_MATCHER(Word32Clz) | 2353 IS_UNOP_MATCHER(Word32Clz) |
2385 IS_UNOP_MATCHER(Word32Ctz) | 2354 IS_UNOP_MATCHER(Word32Ctz) |
2386 IS_UNOP_MATCHER(Word32Popcnt) | 2355 IS_UNOP_MATCHER(Word32Popcnt) |
2387 IS_UNOP_MATCHER(Word32ReverseBytes) | 2356 IS_UNOP_MATCHER(Word32ReverseBytes) |
2388 #undef IS_UNOP_MATCHER | 2357 #undef IS_UNOP_MATCHER |
2389 | 2358 |
2390 } // namespace compiler | 2359 } // namespace compiler |
2391 } // namespace internal | 2360 } // namespace internal |
2392 } // namespace v8 | 2361 } // namespace v8 |
OLD | NEW |