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 #include "src/unique.h" | 10 #include "src/unique.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool IsPowerOf2() const { | 74 bool IsPowerOf2() const { |
75 return this->HasValue() && this->Value() > 0 && | 75 return this->HasValue() && this->Value() > 0 && |
76 (this->Value() & (this->Value() - 1)) == 0; | 76 (this->Value() & (this->Value() - 1)) == 0; |
77 } | 77 } |
78 }; | 78 }; |
79 | 79 |
80 typedef IntMatcher<int32_t, IrOpcode::kInt32Constant> Int32Matcher; | 80 typedef IntMatcher<int32_t, IrOpcode::kInt32Constant> Int32Matcher; |
81 typedef IntMatcher<uint32_t, IrOpcode::kInt32Constant> Uint32Matcher; | 81 typedef IntMatcher<uint32_t, IrOpcode::kInt32Constant> Uint32Matcher; |
82 typedef IntMatcher<int64_t, IrOpcode::kInt64Constant> Int64Matcher; | 82 typedef IntMatcher<int64_t, IrOpcode::kInt64Constant> Int64Matcher; |
83 typedef IntMatcher<uint64_t, IrOpcode::kInt64Constant> Uint64Matcher; | 83 typedef IntMatcher<uint64_t, IrOpcode::kInt64Constant> Uint64Matcher; |
| 84 #if V8_HOST_ARCH_32_BIT |
| 85 typedef Int32Matcher IntPtrMatcher; |
| 86 typedef Uint32Matcher UintPtrMatcher; |
| 87 #else |
| 88 typedef Int64Matcher IntPtrMatcher; |
| 89 typedef Uint64Matcher UintPtrMatcher; |
| 90 #endif |
84 | 91 |
85 | 92 |
86 // A pattern matcher for floating point constants. | 93 // A pattern matcher for floating point constants. |
87 template <typename T, IrOpcode::Value kOpcode> | 94 template <typename T, IrOpcode::Value kOpcode> |
88 struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> { | 95 struct FloatMatcher FINAL : public ValueMatcher<T, kOpcode> { |
89 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {} | 96 explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {} |
90 | 97 |
91 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } | 98 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } |
92 }; | 99 }; |
93 | 100 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 138 } |
132 | 139 |
133 Left left_; | 140 Left left_; |
134 Right right_; | 141 Right right_; |
135 }; | 142 }; |
136 | 143 |
137 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; | 144 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; |
138 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 145 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
139 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 146 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
140 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 147 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
| 148 typedef BinopMatcher<IntPtrMatcher, IntPtrMatcher> IntPtrBinopMatcher; |
| 149 typedef BinopMatcher<UintPtrMatcher, UintPtrMatcher> UintPtrBinopMatcher; |
141 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 150 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
142 typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher; | 151 typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher; |
143 | 152 |
144 | 153 |
145 // Fairly intel-specify node matcher used for matching scale factors in | 154 // Fairly intel-specify node matcher used for matching scale factors in |
146 // addressing modes. | 155 // addressing modes. |
147 // Matches nodes of form [x * N] for N in {1,2,4,8} | 156 // Matches nodes of form [x * N] for N in {1,2,4,8} |
148 class ScaleFactorMatcher : public NodeMatcher { | 157 class ScaleFactorMatcher : public NodeMatcher { |
149 public: | 158 public: |
150 static const int kMatchedFactors[4]; | 159 static const int kMatchedFactors[4]; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 int power_; | 230 int power_; |
222 int displacement_; | 231 int displacement_; |
223 }; | 232 }; |
224 | 233 |
225 | 234 |
226 } // namespace compiler | 235 } // namespace compiler |
227 } // namespace internal | 236 } // namespace internal |
228 } // namespace v8 | 237 } // namespace v8 |
229 | 238 |
230 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 239 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |