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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 private: | 185 private: |
186 int GetInputScaleExponent(Node* node) const { | 186 int GetInputScaleExponent(Node* node) const { |
187 if (node->opcode() == kShiftOpcode) { | 187 if (node->opcode() == kShiftOpcode) { |
188 BinopMatcher m(node); | 188 BinopMatcher m(node); |
189 if (m.right().HasValue()) { | 189 if (m.right().HasValue()) { |
190 typename BinopMatcher::RightMatcher::ValueType value = | 190 typename BinopMatcher::RightMatcher::ValueType value = |
191 m.right().Value(); | 191 m.right().Value(); |
192 if (value >= 0 && value <= 3) { | 192 if (value >= 0 && value <= 3) { |
193 return value; | 193 return static_cast<int>(value); |
194 } | 194 } |
195 } | 195 } |
196 } else if (node->opcode() == kMulOpcode) { | 196 } else if (node->opcode() == kMulOpcode) { |
197 BinopMatcher m(node); | 197 BinopMatcher m(node); |
198 if (m.right().HasValue()) { | 198 if (m.right().HasValue()) { |
199 typename BinopMatcher::RightMatcher::ValueType value = | 199 typename BinopMatcher::RightMatcher::ValueType value = |
200 m.right().Value(); | 200 m.right().Value(); |
201 if (value == 1) { | 201 if (value == 1) { |
202 return 0; | 202 return 0; |
203 } else if (value == 2) { | 203 } else if (value == 2) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 }; | 377 }; |
378 | 378 |
379 typedef ScaledWithOffsetMatcher<Int32AddMatcher> ScaledWithOffset32Matcher; | 379 typedef ScaledWithOffsetMatcher<Int32AddMatcher> ScaledWithOffset32Matcher; |
380 typedef ScaledWithOffsetMatcher<Int64AddMatcher> ScaledWithOffset64Matcher; | 380 typedef ScaledWithOffsetMatcher<Int64AddMatcher> ScaledWithOffset64Matcher; |
381 | 381 |
382 } // namespace compiler | 382 } // namespace compiler |
383 } // namespace internal | 383 } // namespace internal |
384 } // namespace v8 | 384 } // namespace v8 |
385 | 385 |
386 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 386 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |