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 <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; | 197 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; |
| 198 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 198 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
| 199 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 199 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
| 200 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 200 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
| 201 typedef BinopMatcher<IntPtrMatcher, IntPtrMatcher> IntPtrBinopMatcher; | 201 typedef BinopMatcher<IntPtrMatcher, IntPtrMatcher> IntPtrBinopMatcher; |
| 202 typedef BinopMatcher<UintPtrMatcher, UintPtrMatcher> UintPtrBinopMatcher; | 202 typedef BinopMatcher<UintPtrMatcher, UintPtrMatcher> UintPtrBinopMatcher; |
| 203 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 203 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
| 204 typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher; | 204 typedef BinopMatcher<NumberMatcher, NumberMatcher> NumberBinopMatcher; |
| 205 | 205 |
| 206 | 206 |
| 207 // A pattern matcher for JSCallFunction operations. | |
| 208 struct JSCallFunctionMatcher FINAL : public NodeMatcher { | |
|
jochen (gone - plz use gerrit)
2014/12/23 10:38:42
i see that this is done all over the place, but th
| |
| 209 explicit JSCallFunctionMatcher(Node* const node) | |
| 210 : NodeMatcher(node), function_(node->InputAt(0)) { | |
| 211 DCHECK_EQ(IrOpcode::kJSCallFunction, opcode()); | |
| 212 } | |
| 213 | |
| 214 typedef HeapObjectMatcher<JSFunction> Function; | |
| 215 | |
| 216 const Function& function() const { return function_; } | |
| 217 Node* frame_state() const; | |
| 218 | |
| 219 // Formal parameters, including the receiver. | |
| 220 typedef Node::Inputs::iterator const_iterator; | |
| 221 const_iterator begin() const; | |
| 222 const_iterator end() const; | |
| 223 size_t size() const; | |
| 224 | |
| 225 private: | |
| 226 Function const function_; | |
| 227 }; | |
|
jochen (gone - plz use gerrit)
2014/12/23 10:38:42
are you copying the matchers around? If yes, there
| |
| 228 | |
| 229 | |
| 230 // A pattern matcher for JSCallRuntime operations. | |
| 231 struct JSCallRuntimeMatcher FINAL : public NodeMatcher { | |
| 232 explicit JSCallRuntimeMatcher(Node* const node) : NodeMatcher(node) { | |
| 233 DCHECK_EQ(IrOpcode::kJSCallRuntime, opcode()); | |
| 234 } | |
| 235 | |
| 236 const Runtime::Function* function() const; | |
| 237 }; | |
| 238 | |
| 239 | |
| 207 template <class BinopMatcher, IrOpcode::Value kMulOpcode, | 240 template <class BinopMatcher, IrOpcode::Value kMulOpcode, |
| 208 IrOpcode::Value kShiftOpcode> | 241 IrOpcode::Value kShiftOpcode> |
| 209 struct ScaleMatcher { | 242 struct ScaleMatcher { |
| 210 explicit ScaleMatcher(Node* node, bool allow_power_of_two_plus_one = false) | 243 explicit ScaleMatcher(Node* node, bool allow_power_of_two_plus_one = false) |
| 211 : scale_(-1), power_of_two_plus_one_(false) { | 244 : scale_(-1), power_of_two_plus_one_(false) { |
| 212 if (node->InputCount() < 2) return; | 245 if (node->InputCount() < 2) return; |
| 213 BinopMatcher m(node); | 246 BinopMatcher m(node); |
| 214 if (node->opcode() == kShiftOpcode) { | 247 if (node->opcode() == kShiftOpcode) { |
| 215 if (m.right().HasValue()) { | 248 if (m.right().HasValue()) { |
| 216 typename BinopMatcher::RightMatcher::ValueType value = | 249 typename BinopMatcher::RightMatcher::ValueType value = |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher> | 542 typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher> |
| 510 BaseWithIndexAndDisplacement32Matcher; | 543 BaseWithIndexAndDisplacement32Matcher; |
| 511 typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher> | 544 typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher> |
| 512 BaseWithIndexAndDisplacement64Matcher; | 545 BaseWithIndexAndDisplacement64Matcher; |
| 513 | 546 |
| 514 } // namespace compiler | 547 } // namespace compiler |
| 515 } // namespace internal | 548 } // namespace internal |
| 516 } // namespace v8 | 549 } // namespace v8 |
| 517 | 550 |
| 518 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 551 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
| OLD | NEW |