Chromium Code Reviews| 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/generic-node.h" | 8 #include "src/compiler/generic-node.h" |
| 9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 typedef Int64Matcher IntPtrMatcher; | 97 typedef Int64Matcher IntPtrMatcher; |
| 98 typedef Uint64Matcher UintPtrMatcher; | 98 typedef Uint64Matcher UintPtrMatcher; |
| 99 #endif | 99 #endif |
| 100 | 100 |
| 101 | 101 |
| 102 // A pattern matcher for floating point constants. | 102 // A pattern matcher for floating point constants. |
| 103 template <typename T, IrOpcode::Value kOpcode> | 103 template <typename T, IrOpcode::Value kOpcode> |
| 104 struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> { | 104 struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> { |
| 105 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {} | 105 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {} |
| 106 | 106 |
| 107 bool IsMinusZero() const { | |
| 108 return this->Is(0.0) && std::signbit(this->Value()); | |
|
Sven Panne
2014/11/26 09:48:33
std::signbit is a C++11 library feature, plain sig
Benedikt Meurer
2014/11/26 10:47:19
Done.
| |
| 109 } | |
| 107 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } | 110 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; | 113 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; |
| 111 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; | 114 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; |
| 112 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; | 115 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; |
| 113 | 116 |
| 114 | 117 |
| 115 // A pattern matcher for heap object constants. | 118 // A pattern matcher for heap object constants. |
| 116 template <typename T> | 119 template <typename T> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 | 163 |
| 161 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; | 164 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; |
| 162 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 165 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
| 163 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 166 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
| 164 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 167 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
| 165 typedef BinopMatcher<IntPtrMatcher, IntPtrMatcher> IntPtrBinopMatcher; | 168 typedef BinopMatcher<IntPtrMatcher, IntPtrMatcher> IntPtrBinopMatcher; |
| 166 typedef BinopMatcher<UintPtrMatcher, UintPtrMatcher> UintPtrBinopMatcher; | 169 typedef BinopMatcher<UintPtrMatcher, UintPtrMatcher> UintPtrBinopMatcher; |
| 167 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 170 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
| 168 typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher; | 171 typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher; |
| 169 | 172 |
| 173 | |
| 170 template <class BinopMatcher, IrOpcode::Value kAddOpcode, | 174 template <class BinopMatcher, IrOpcode::Value kAddOpcode, |
| 171 IrOpcode::Value kMulOpcode, IrOpcode::Value kShiftOpcode> | 175 IrOpcode::Value kMulOpcode, IrOpcode::Value kShiftOpcode> |
| 172 struct AddMatcher : public BinopMatcher { | 176 struct AddMatcher : public BinopMatcher { |
| 173 static const IrOpcode::Value kOpcode = kAddOpcode; | 177 static const IrOpcode::Value kOpcode = kAddOpcode; |
| 174 | 178 |
| 175 explicit AddMatcher(Node* node) : BinopMatcher(node), scale_exponent_(-1) { | 179 explicit AddMatcher(Node* node) : BinopMatcher(node), scale_exponent_(-1) { |
| 176 if (this->HasProperty(Operator::kCommutative)) PutScaledInputOnLeft(); | 180 if (this->HasProperty(Operator::kCommutative)) PutScaledInputOnLeft(); |
| 177 } | 181 } |
| 178 | 182 |
| 179 bool HasScaledInput() const { return scale_exponent_ != -1; } | 183 bool HasScaledInput() const { return scale_exponent_ != -1; } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 }; | 387 }; |
| 384 | 388 |
| 385 typedef ScaledWithOffsetMatcher<Int32AddMatcher> ScaledWithOffset32Matcher; | 389 typedef ScaledWithOffsetMatcher<Int32AddMatcher> ScaledWithOffset32Matcher; |
| 386 typedef ScaledWithOffsetMatcher<Int64AddMatcher> ScaledWithOffset64Matcher; | 390 typedef ScaledWithOffsetMatcher<Int64AddMatcher> ScaledWithOffset64Matcher; |
| 387 | 391 |
| 388 } // namespace compiler | 392 } // namespace compiler |
| 389 } // namespace internal | 393 } // namespace internal |
| 390 } // namespace v8 | 394 } // namespace v8 |
| 391 | 395 |
| 392 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 396 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
| OLD | NEW |