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 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 struct FloatMatcher FINAL : public ValueMatcher<T> { | 87 struct FloatMatcher FINAL : public ValueMatcher<T> { |
88 explicit FloatMatcher(Node* node) : ValueMatcher<T>(node) {} | 88 explicit FloatMatcher(Node* node) : ValueMatcher<T>(node) {} |
89 | 89 |
90 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } | 90 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } |
91 }; | 91 }; |
92 | 92 |
93 typedef FloatMatcher<double> Float64Matcher; | 93 typedef FloatMatcher<double> Float64Matcher; |
94 | 94 |
95 | 95 |
96 // A pattern matcher for heap object constants. | 96 // A pattern matcher for heap object constants. |
97 struct HeapObjectMatcher FINAL | 97 struct HeapObjectMatcher FINAL : public ValueMatcher<Handle<HeapObject> > { |
98 : public ValueMatcher<PrintableUnique<HeapObject> > { | |
99 explicit HeapObjectMatcher(Node* node) | 98 explicit HeapObjectMatcher(Node* node) |
100 : ValueMatcher<PrintableUnique<HeapObject> >(node) {} | 99 : ValueMatcher<Handle<HeapObject> >(node) {} |
101 | 100 |
102 bool IsKnownGlobal(HeapObject* global) const { | 101 bool IsKnownGlobal(Handle<HeapObject> global) const { |
103 return HasValue() && Value().IsKnownGlobal(global); | 102 return HasValue() && Value().is_identical_to(global); |
104 } | 103 } |
105 }; | 104 }; |
106 | 105 |
107 | 106 |
108 // For shorter pattern matching code, this struct matches both the left and | 107 // For shorter pattern matching code, this struct matches both the left and |
109 // right hand sides of a binary operation and can put constants on the right | 108 // right hand sides of a binary operation and can put constants on the right |
110 // if they appear on the left hand side of a commutative operation. | 109 // if they appear on the left hand side of a commutative operation. |
111 template <typename Left, typename Right> | 110 template <typename Left, typename Right> |
112 struct BinopMatcher FINAL : public NodeMatcher { | 111 struct BinopMatcher FINAL : public NodeMatcher { |
113 explicit BinopMatcher(Node* node) | 112 explicit BinopMatcher(Node* node) |
(...skipping 23 matching lines...) Expand all Loading... |
137 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; | 136 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; |
138 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 137 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
139 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 138 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
140 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 139 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
141 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 140 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
142 } | 141 } |
143 } | 142 } |
144 } // namespace v8::internal::compiler | 143 } // namespace v8::internal::compiler |
145 | 144 |
146 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 145 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |