| 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 #ifndef V8_COMPILER_NODE_MATCHERS_H_ | 5 #ifndef V8_COMPILER_NODE_MATCHERS_H_ |
| 6 #define V8_COMPILER_NODE_MATCHERS_H_ | 6 #define V8_COMPILER_NODE_MATCHERS_H_ |
| 7 | 7 |
| 8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 struct ValueMatcher : public NodeMatcher { | 39 struct ValueMatcher : public NodeMatcher { |
| 40 explicit ValueMatcher(Node* node) | 40 explicit ValueMatcher(Node* node) |
| 41 : NodeMatcher(node), | 41 : NodeMatcher(node), |
| 42 value_(), | 42 value_(), |
| 43 has_value_(CommonOperatorTraits<T>::HasValue(node->op())) { | 43 has_value_(CommonOperatorTraits<T>::HasValue(node->op())) { |
| 44 if (has_value_) value_ = CommonOperatorTraits<T>::ValueOf(node->op()); | 44 if (has_value_) value_ = CommonOperatorTraits<T>::ValueOf(node->op()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool HasValue() const { return has_value_; } | 47 bool HasValue() const { return has_value_; } |
| 48 T Value() const { | 48 T Value() const { |
| 49 ASSERT(HasValue()); | 49 DCHECK(HasValue()); |
| 50 return value_; | 50 return value_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool Is(T value) const { | 53 bool Is(T value) const { |
| 54 return HasValue() && CommonOperatorTraits<T>::Equals(Value(), value); | 54 return HasValue() && CommonOperatorTraits<T>::Equals(Value(), value); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool IsInRange(T low, T high) const { | 57 bool IsInRange(T low, T high) const { |
| 58 return HasValue() && low <= value_ && value_ <= high; | 58 return HasValue() && low <= value_ && value_ <= high; |
| 59 } | 59 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; | 124 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; |
| 125 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 125 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
| 126 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 126 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
| 127 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 127 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
| 128 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 128 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 } // namespace v8::internal::compiler | 131 } // namespace v8::internal::compiler |
| 132 | 132 |
| 133 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 133 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
| OLD | NEW |