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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 bool Is(const T& value) const { | 151 bool Is(const T& value) const { |
152 return this->HasValue() && this->Value() == value; | 152 return this->HasValue() && this->Value() == value; |
153 } | 153 } |
154 bool IsInRange(const T& low, const T& high) const { | 154 bool IsInRange(const T& low, const T& high) const { |
155 return this->HasValue() && low <= this->Value() && this->Value() <= high; | 155 return this->HasValue() && low <= this->Value() && this->Value() <= high; |
156 } | 156 } |
157 bool IsMinusZero() const { | 157 bool IsMinusZero() const { |
158 return this->Is(0.0) && std::signbit(this->Value()); | 158 return this->Is(0.0) && std::signbit(this->Value()); |
159 } | 159 } |
| 160 bool IsNegative() const { return this->HasValue() && this->Value() < 0.0; } |
160 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } | 161 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } |
161 bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); } | 162 bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); } |
162 }; | 163 }; |
163 | 164 |
164 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; | 165 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; |
165 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; | 166 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; |
166 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; | 167 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; |
167 | 168 |
168 | 169 |
169 // A pattern matcher for heap object constants. | 170 // A pattern matcher for heap object constants. |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 Node* branch_; | 610 Node* branch_; |
610 Node* if_true_; | 611 Node* if_true_; |
611 Node* if_false_; | 612 Node* if_false_; |
612 }; | 613 }; |
613 | 614 |
614 } // namespace compiler | 615 } // namespace compiler |
615 } // namespace internal | 616 } // namespace internal |
616 } // namespace v8 | 617 } // namespace v8 |
617 | 618 |
618 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 619 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |