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 <cmath> | 8 #include <cmath> |
9 | 9 |
10 // TODO(turbofan): Move ExternalReference out of assembler.h | 10 // TODO(turbofan): Move ExternalReference out of assembler.h |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; | 165 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; |
166 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; | 166 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; |
167 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; | 167 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; |
168 | 168 |
169 | 169 |
170 // A pattern matcher for heap object constants. | 170 // A pattern matcher for heap object constants. |
171 struct HeapObjectMatcher final | 171 struct HeapObjectMatcher final |
172 : public ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant> { | 172 : public ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant> { |
173 explicit HeapObjectMatcher(Node* node) | 173 explicit HeapObjectMatcher(Node* node) |
174 : ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant>(node) {} | 174 : ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant>(node) {} |
| 175 |
| 176 bool Is(Handle<HeapObject> const& value) const { |
| 177 return this->HasValue() && this->Value().address() == value.address(); |
| 178 } |
175 }; | 179 }; |
176 | 180 |
177 | 181 |
178 // A pattern matcher for external reference constants. | 182 // A pattern matcher for external reference constants. |
179 struct ExternalReferenceMatcher final | 183 struct ExternalReferenceMatcher final |
180 : public ValueMatcher<ExternalReference, IrOpcode::kExternalConstant> { | 184 : public ValueMatcher<ExternalReference, IrOpcode::kExternalConstant> { |
181 explicit ExternalReferenceMatcher(Node* node) | 185 explicit ExternalReferenceMatcher(Node* node) |
182 : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {} | 186 : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {} |
183 bool Is(const ExternalReference& value) const { | 187 bool Is(const ExternalReference& value) const { |
184 return this->HasValue() && this->Value() == value; | 188 return this->HasValue() && this->Value() == value; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 Node* branch_; | 614 Node* branch_; |
611 Node* if_true_; | 615 Node* if_true_; |
612 Node* if_false_; | 616 Node* if_false_; |
613 }; | 617 }; |
614 | 618 |
615 } // namespace compiler | 619 } // namespace compiler |
616 } // namespace internal | 620 } // namespace internal |
617 } // namespace v8 | 621 } // namespace v8 |
618 | 622 |
619 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 623 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |