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/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 | 84 |
85 // A pattern matcher for floating point constants. | 85 // A pattern matcher for floating point constants. |
86 template <typename T, IrOpcode::Value kOpcode> | 86 template <typename T, IrOpcode::Value kOpcode> |
87 struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> { | 87 struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> { |
88 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {} | 88 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(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<float, IrOpcode::kFloat32Constant> Float32Matcher; |
93 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; | 94 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; |
94 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; | 95 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; |
95 | 96 |
96 | 97 |
97 // A pattern matcher for heap object constants. | 98 // A pattern matcher for heap object constants. |
98 template <typename T> | 99 template <typename T> |
99 struct HeapObjectMatcher FINAL | 100 struct HeapObjectMatcher FINAL |
100 : public ValueMatcher<Unique<T>, IrOpcode::kHeapConstant> { | 101 : public ValueMatcher<Unique<T>, IrOpcode::kHeapConstant> { |
101 explicit HeapObjectMatcher(Node* node) | 102 explicit HeapObjectMatcher(Node* node) |
102 : ValueMatcher<Unique<T>, IrOpcode::kHeapConstant>(node) {} | 103 : ValueMatcher<Unique<T>, IrOpcode::kHeapConstant>(node) {} |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 137 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
137 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 138 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
138 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 139 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
139 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 140 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
140 | 141 |
141 } // namespace compiler | 142 } // namespace compiler |
142 } // namespace internal | 143 } // namespace internal |
143 } // namespace v8 | 144 } // namespace v8 |
144 | 145 |
145 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 146 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |