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/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 // A pattern matcher for nodes. | 15 // A pattern matcher for nodes. |
16 struct NodeMatcher { | 16 struct NodeMatcher { |
17 explicit NodeMatcher(Node* node) : node_(node) {} | 17 explicit NodeMatcher(Node* node) : node_(node) {} |
18 | 18 |
19 Node* node() const { return node_; } | 19 Node* node() const { return node_; } |
20 Operator* op() const { return node()->op(); } | 20 const Operator* op() const { return node()->op(); } |
21 IrOpcode::Value opcode() const { return node()->opcode(); } | 21 IrOpcode::Value opcode() const { return node()->opcode(); } |
22 | 22 |
23 bool HasProperty(Operator::Property property) const { | 23 bool HasProperty(Operator::Property property) const { |
24 return op()->HasProperty(property); | 24 return op()->HasProperty(property); |
25 } | 25 } |
26 Node* InputAt(int index) const { return node()->InputAt(index); } | 26 Node* InputAt(int index) const { return node()->InputAt(index); } |
27 | 27 |
28 #define DEFINE_IS_OPCODE(Opcode) \ | 28 #define DEFINE_IS_OPCODE(Opcode) \ |
29 bool Is##Opcode() const { return opcode() == IrOpcode::k##Opcode; } | 29 bool Is##Opcode() const { return opcode() == IrOpcode::k##Opcode; } |
30 ALL_OP_LIST(DEFINE_IS_OPCODE) | 30 ALL_OP_LIST(DEFINE_IS_OPCODE) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; | 137 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; |
138 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; | 138 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; |
139 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; | 139 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; |
140 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; | 140 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; |
141 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; | 141 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; |
142 } | 142 } |
143 } | 143 } |
144 } // namespace v8::internal::compiler | 144 } // namespace v8::internal::compiler |
145 | 145 |
146 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 146 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
OLD | NEW |