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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 bool IsMinusZero() const { | 161 bool IsMinusZero() const { |
162 return this->Is(0.0) && std::signbit(this->Value()); | 162 return this->Is(0.0) && std::signbit(this->Value()); |
163 } | 163 } |
164 bool IsNegative() const { return this->HasValue() && this->Value() < 0.0; } | 164 bool IsNegative() const { return this->HasValue() && this->Value() < 0.0; } |
165 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } | 165 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } |
166 bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); } | 166 bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); } |
167 bool IsNormal() const { | 167 bool IsNormal() const { |
168 return this->HasValue() && std::isnormal(this->Value()); | 168 return this->HasValue() && std::isnormal(this->Value()); |
169 } | 169 } |
| 170 bool IsInteger() const { |
| 171 return this->HasValue() && std::nearbyint(this->Value()) == this->Value(); |
| 172 } |
170 bool IsPositiveOrNegativePowerOf2() const { | 173 bool IsPositiveOrNegativePowerOf2() const { |
171 if (!this->HasValue() || (this->Value() == 0.0)) { | 174 if (!this->HasValue() || (this->Value() == 0.0)) { |
172 return false; | 175 return false; |
173 } | 176 } |
174 Double value = Double(this->Value()); | 177 Double value = Double(this->Value()); |
175 return !value.IsInfinite() && | 178 return !value.IsInfinite() && |
176 base::bits::IsPowerOfTwo64(value.Significand()); | 179 base::bits::IsPowerOfTwo64(value.Significand()); |
177 } | 180 } |
178 }; | 181 }; |
179 | 182 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 Node* branch_; | 702 Node* branch_; |
700 Node* if_true_; | 703 Node* if_true_; |
701 Node* if_false_; | 704 Node* if_false_; |
702 }; | 705 }; |
703 | 706 |
704 } // namespace compiler | 707 } // namespace compiler |
705 } // namespace internal | 708 } // namespace internal |
706 } // namespace v8 | 709 } // namespace v8 |
707 | 710 |
708 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 711 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |