Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: test/unittests/compiler/node-test-utils.cc

Issue 816453005: [turbofan] Cleanup use of virtual, OVERRIDE, FINAL. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "test/unittests/compiler/node-test-utils.h" 5 #include "test/unittests/compiler/node-test-utils.h"
6 6
7 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 9
10 using testing::_; 10 using testing::_;
(...skipping 21 matching lines...) Expand all
32 return false; 32 return false;
33 } 33 }
34 return true; 34 return true;
35 } 35 }
36 36
37 37
38 class NodeMatcher : public MatcherInterface<Node*> { 38 class NodeMatcher : public MatcherInterface<Node*> {
39 public: 39 public:
40 explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {} 40 explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {}
41 41
42 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 42 void DescribeTo(std::ostream* os) const OVERRIDE {
43 *os << "is a " << IrOpcode::Mnemonic(opcode_) << " node"; 43 *os << "is a " << IrOpcode::Mnemonic(opcode_) << " node";
44 } 44 }
45 45
46 virtual bool MatchAndExplain(Node* node, 46 bool MatchAndExplain(Node* node,
47 MatchResultListener* listener) const OVERRIDE { 47 MatchResultListener* listener) const OVERRIDE {
48 if (node == NULL) { 48 if (node == NULL) {
49 *listener << "which is NULL"; 49 *listener << "which is NULL";
50 return false; 50 return false;
51 } 51 }
52 if (node->opcode() != opcode_) { 52 if (node->opcode() != opcode_) {
53 *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode()) 53 *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode())
54 << " but should have been " << IrOpcode::Mnemonic(opcode_); 54 << " but should have been " << IrOpcode::Mnemonic(opcode_);
55 return false; 55 return false;
56 } 56 }
57 return true; 57 return true;
58 } 58 }
59 59
60 private: 60 private:
61 const IrOpcode::Value opcode_; 61 const IrOpcode::Value opcode_;
62 }; 62 };
63 63
64 64
65 class IsBranchMatcher FINAL : public NodeMatcher { 65 class IsBranchMatcher FINAL : public NodeMatcher {
66 public: 66 public:
67 IsBranchMatcher(const Matcher<Node*>& value_matcher, 67 IsBranchMatcher(const Matcher<Node*>& value_matcher,
68 const Matcher<Node*>& control_matcher) 68 const Matcher<Node*>& control_matcher)
69 : NodeMatcher(IrOpcode::kBranch), 69 : NodeMatcher(IrOpcode::kBranch),
70 value_matcher_(value_matcher), 70 value_matcher_(value_matcher),
71 control_matcher_(control_matcher) {} 71 control_matcher_(control_matcher) {}
72 72
73 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 73 void DescribeTo(std::ostream* os) const FINAL {
74 NodeMatcher::DescribeTo(os); 74 NodeMatcher::DescribeTo(os);
75 *os << " whose value ("; 75 *os << " whose value (";
76 value_matcher_.DescribeTo(os); 76 value_matcher_.DescribeTo(os);
77 *os << ") and control ("; 77 *os << ") and control (";
78 control_matcher_.DescribeTo(os); 78 control_matcher_.DescribeTo(os);
79 *os << ")"; 79 *os << ")";
80 } 80 }
81 81
82 virtual bool MatchAndExplain(Node* node, 82 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
83 MatchResultListener* listener) const OVERRIDE {
84 return (NodeMatcher::MatchAndExplain(node, listener) && 83 return (NodeMatcher::MatchAndExplain(node, listener) &&
85 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 84 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
86 "value", value_matcher_, listener) && 85 "value", value_matcher_, listener) &&
87 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 86 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
88 "control", control_matcher_, listener)); 87 "control", control_matcher_, listener));
89 } 88 }
90 89
91 private: 90 private:
92 const Matcher<Node*> value_matcher_; 91 const Matcher<Node*> value_matcher_;
93 const Matcher<Node*> control_matcher_; 92 const Matcher<Node*> control_matcher_;
94 }; 93 };
95 94
96 95
97 class IsMergeMatcher FINAL : public NodeMatcher { 96 class IsMergeMatcher FINAL : public NodeMatcher {
98 public: 97 public:
99 IsMergeMatcher(const Matcher<Node*>& control0_matcher, 98 IsMergeMatcher(const Matcher<Node*>& control0_matcher,
100 const Matcher<Node*>& control1_matcher) 99 const Matcher<Node*>& control1_matcher)
101 : NodeMatcher(IrOpcode::kMerge), 100 : NodeMatcher(IrOpcode::kMerge),
102 control0_matcher_(control0_matcher), 101 control0_matcher_(control0_matcher),
103 control1_matcher_(control1_matcher) {} 102 control1_matcher_(control1_matcher) {}
104 103
105 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 104 void DescribeTo(std::ostream* os) const FINAL {
106 NodeMatcher::DescribeTo(os); 105 NodeMatcher::DescribeTo(os);
107 *os << " whose control0 ("; 106 *os << " whose control0 (";
108 control0_matcher_.DescribeTo(os); 107 control0_matcher_.DescribeTo(os);
109 *os << ") and control1 ("; 108 *os << ") and control1 (";
110 control1_matcher_.DescribeTo(os); 109 control1_matcher_.DescribeTo(os);
111 *os << ")"; 110 *os << ")";
112 } 111 }
113 112
114 virtual bool MatchAndExplain(Node* node, 113 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
115 MatchResultListener* listener) const OVERRIDE {
116 return (NodeMatcher::MatchAndExplain(node, listener) && 114 return (NodeMatcher::MatchAndExplain(node, listener) &&
117 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), 115 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0),
118 "control0", control0_matcher_, listener) && 116 "control0", control0_matcher_, listener) &&
119 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), 117 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1),
120 "control1", control1_matcher_, listener)); 118 "control1", control1_matcher_, listener));
121 } 119 }
122 120
123 private: 121 private:
124 const Matcher<Node*> control0_matcher_; 122 const Matcher<Node*> control0_matcher_;
125 const Matcher<Node*> control1_matcher_; 123 const Matcher<Node*> control1_matcher_;
126 }; 124 };
127 125
128 126
129 class IsControl1Matcher FINAL : public NodeMatcher { 127 class IsControl1Matcher FINAL : public NodeMatcher {
130 public: 128 public:
131 IsControl1Matcher(IrOpcode::Value opcode, 129 IsControl1Matcher(IrOpcode::Value opcode,
132 const Matcher<Node*>& control_matcher) 130 const Matcher<Node*>& control_matcher)
133 : NodeMatcher(opcode), control_matcher_(control_matcher) {} 131 : NodeMatcher(opcode), control_matcher_(control_matcher) {}
134 132
135 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 133 void DescribeTo(std::ostream* os) const FINAL {
136 NodeMatcher::DescribeTo(os); 134 NodeMatcher::DescribeTo(os);
137 *os << " whose control ("; 135 *os << " whose control (";
138 control_matcher_.DescribeTo(os); 136 control_matcher_.DescribeTo(os);
139 *os << ")"; 137 *os << ")";
140 } 138 }
141 139
142 virtual bool MatchAndExplain(Node* node, 140 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
143 MatchResultListener* listener) const OVERRIDE {
144 return (NodeMatcher::MatchAndExplain(node, listener) && 141 return (NodeMatcher::MatchAndExplain(node, listener) &&
145 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 142 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
146 "control", control_matcher_, listener)); 143 "control", control_matcher_, listener));
147 } 144 }
148 145
149 private: 146 private:
150 const Matcher<Node*> control_matcher_; 147 const Matcher<Node*> control_matcher_;
151 }; 148 };
152 149
153 150
154 class IsFinishMatcher FINAL : public NodeMatcher { 151 class IsFinishMatcher FINAL : public NodeMatcher {
155 public: 152 public:
156 IsFinishMatcher(const Matcher<Node*>& value_matcher, 153 IsFinishMatcher(const Matcher<Node*>& value_matcher,
157 const Matcher<Node*>& effect_matcher) 154 const Matcher<Node*>& effect_matcher)
158 : NodeMatcher(IrOpcode::kFinish), 155 : NodeMatcher(IrOpcode::kFinish),
159 value_matcher_(value_matcher), 156 value_matcher_(value_matcher),
160 effect_matcher_(effect_matcher) {} 157 effect_matcher_(effect_matcher) {}
161 158
162 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 159 void DescribeTo(std::ostream* os) const FINAL {
163 NodeMatcher::DescribeTo(os); 160 NodeMatcher::DescribeTo(os);
164 *os << " whose value ("; 161 *os << " whose value (";
165 value_matcher_.DescribeTo(os); 162 value_matcher_.DescribeTo(os);
166 *os << ") and effect ("; 163 *os << ") and effect (";
167 effect_matcher_.DescribeTo(os); 164 effect_matcher_.DescribeTo(os);
168 *os << ")"; 165 *os << ")";
169 } 166 }
170 167
171 virtual bool MatchAndExplain(Node* node, 168 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
172 MatchResultListener* listener) const OVERRIDE {
173 return (NodeMatcher::MatchAndExplain(node, listener) && 169 return (NodeMatcher::MatchAndExplain(node, listener) &&
174 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 170 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
175 "value", value_matcher_, listener) && 171 "value", value_matcher_, listener) &&
176 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 172 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
177 effect_matcher_, listener)); 173 effect_matcher_, listener));
178 } 174 }
179 175
180 private: 176 private:
181 const Matcher<Node*> value_matcher_; 177 const Matcher<Node*> value_matcher_;
182 const Matcher<Node*> effect_matcher_; 178 const Matcher<Node*> effect_matcher_;
183 }; 179 };
184 180
185 181
186 template <typename T> 182 template <typename T>
187 class IsConstantMatcher FINAL : public NodeMatcher { 183 class IsConstantMatcher FINAL : public NodeMatcher {
188 public: 184 public:
189 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) 185 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher)
190 : NodeMatcher(opcode), value_matcher_(value_matcher) {} 186 : NodeMatcher(opcode), value_matcher_(value_matcher) {}
191 187
192 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 188 void DescribeTo(std::ostream* os) const FINAL {
193 NodeMatcher::DescribeTo(os); 189 NodeMatcher::DescribeTo(os);
194 *os << " whose value ("; 190 *os << " whose value (";
195 value_matcher_.DescribeTo(os); 191 value_matcher_.DescribeTo(os);
196 *os << ")"; 192 *os << ")";
197 } 193 }
198 194
199 virtual bool MatchAndExplain(Node* node, 195 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
200 MatchResultListener* listener) const OVERRIDE {
201 return (NodeMatcher::MatchAndExplain(node, listener) && 196 return (NodeMatcher::MatchAndExplain(node, listener) &&
202 PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_, 197 PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_,
203 listener)); 198 listener));
204 } 199 }
205 200
206 private: 201 private:
207 const Matcher<T> value_matcher_; 202 const Matcher<T> value_matcher_;
208 }; 203 };
209 204
210 205
211 class IsSelectMatcher FINAL : public NodeMatcher { 206 class IsSelectMatcher FINAL : public NodeMatcher {
212 public: 207 public:
213 IsSelectMatcher(const Matcher<MachineType>& type_matcher, 208 IsSelectMatcher(const Matcher<MachineType>& type_matcher,
214 const Matcher<Node*>& value0_matcher, 209 const Matcher<Node*>& value0_matcher,
215 const Matcher<Node*>& value1_matcher, 210 const Matcher<Node*>& value1_matcher,
216 const Matcher<Node*>& value2_matcher) 211 const Matcher<Node*>& value2_matcher)
217 : NodeMatcher(IrOpcode::kSelect), 212 : NodeMatcher(IrOpcode::kSelect),
218 type_matcher_(type_matcher), 213 type_matcher_(type_matcher),
219 value0_matcher_(value0_matcher), 214 value0_matcher_(value0_matcher),
220 value1_matcher_(value1_matcher), 215 value1_matcher_(value1_matcher),
221 value2_matcher_(value2_matcher) {} 216 value2_matcher_(value2_matcher) {}
222 217
223 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 218 void DescribeTo(std::ostream* os) const FINAL {
224 NodeMatcher::DescribeTo(os); 219 NodeMatcher::DescribeTo(os);
225 *os << " whose type ("; 220 *os << " whose type (";
226 type_matcher_.DescribeTo(os); 221 type_matcher_.DescribeTo(os);
227 *os << "), value0 ("; 222 *os << "), value0 (";
228 value0_matcher_.DescribeTo(os); 223 value0_matcher_.DescribeTo(os);
229 *os << "), value1 ("; 224 *os << "), value1 (";
230 value1_matcher_.DescribeTo(os); 225 value1_matcher_.DescribeTo(os);
231 *os << ") and value2 ("; 226 *os << ") and value2 (";
232 value2_matcher_.DescribeTo(os); 227 value2_matcher_.DescribeTo(os);
233 *os << ")"; 228 *os << ")";
234 } 229 }
235 230
236 virtual bool MatchAndExplain(Node* node, 231 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
237 MatchResultListener* listener) const OVERRIDE {
238 return (NodeMatcher::MatchAndExplain(node, listener) && 232 return (NodeMatcher::MatchAndExplain(node, listener) &&
239 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", 233 PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
240 type_matcher_, listener) && 234 type_matcher_, listener) &&
241 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 235 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
242 "value0", value0_matcher_, listener) && 236 "value0", value0_matcher_, listener) &&
243 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 237 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
244 "value1", value1_matcher_, listener) && 238 "value1", value1_matcher_, listener) &&
245 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), 239 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
246 "value2", value2_matcher_, listener)); 240 "value2", value2_matcher_, listener));
247 } 241 }
(...skipping 11 matching lines...) Expand all
259 IsPhiMatcher(const Matcher<MachineType>& type_matcher, 253 IsPhiMatcher(const Matcher<MachineType>& type_matcher,
260 const Matcher<Node*>& value0_matcher, 254 const Matcher<Node*>& value0_matcher,
261 const Matcher<Node*>& value1_matcher, 255 const Matcher<Node*>& value1_matcher,
262 const Matcher<Node*>& control_matcher) 256 const Matcher<Node*>& control_matcher)
263 : NodeMatcher(IrOpcode::kPhi), 257 : NodeMatcher(IrOpcode::kPhi),
264 type_matcher_(type_matcher), 258 type_matcher_(type_matcher),
265 value0_matcher_(value0_matcher), 259 value0_matcher_(value0_matcher),
266 value1_matcher_(value1_matcher), 260 value1_matcher_(value1_matcher),
267 control_matcher_(control_matcher) {} 261 control_matcher_(control_matcher) {}
268 262
269 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 263 void DescribeTo(std::ostream* os) const FINAL {
270 NodeMatcher::DescribeTo(os); 264 NodeMatcher::DescribeTo(os);
271 *os << " whose type ("; 265 *os << " whose type (";
272 type_matcher_.DescribeTo(os); 266 type_matcher_.DescribeTo(os);
273 *os << "), value0 ("; 267 *os << "), value0 (";
274 value0_matcher_.DescribeTo(os); 268 value0_matcher_.DescribeTo(os);
275 *os << "), value1 ("; 269 *os << "), value1 (";
276 value1_matcher_.DescribeTo(os); 270 value1_matcher_.DescribeTo(os);
277 *os << ") and control ("; 271 *os << ") and control (";
278 control_matcher_.DescribeTo(os); 272 control_matcher_.DescribeTo(os);
279 *os << ")"; 273 *os << ")";
280 } 274 }
281 275
282 virtual bool MatchAndExplain(Node* node, 276 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
283 MatchResultListener* listener) const OVERRIDE {
284 return (NodeMatcher::MatchAndExplain(node, listener) && 277 return (NodeMatcher::MatchAndExplain(node, listener) &&
285 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", 278 PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
286 type_matcher_, listener) && 279 type_matcher_, listener) &&
287 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 280 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
288 "value0", value0_matcher_, listener) && 281 "value0", value0_matcher_, listener) &&
289 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 282 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
290 "value1", value1_matcher_, listener) && 283 "value1", value1_matcher_, listener) &&
291 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 284 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
292 "control", control_matcher_, listener)); 285 "control", control_matcher_, listener));
293 } 286 }
294 287
295 private: 288 private:
296 const Matcher<MachineType> type_matcher_; 289 const Matcher<MachineType> type_matcher_;
297 const Matcher<Node*> value0_matcher_; 290 const Matcher<Node*> value0_matcher_;
298 const Matcher<Node*> value1_matcher_; 291 const Matcher<Node*> value1_matcher_;
299 const Matcher<Node*> control_matcher_; 292 const Matcher<Node*> control_matcher_;
300 }; 293 };
301 294
302 295
303 class IsEffectPhiMatcher FINAL : public NodeMatcher { 296 class IsEffectPhiMatcher FINAL : public NodeMatcher {
304 public: 297 public:
305 IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher, 298 IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher,
306 const Matcher<Node*>& effect1_matcher, 299 const Matcher<Node*>& effect1_matcher,
307 const Matcher<Node*>& control_matcher) 300 const Matcher<Node*>& control_matcher)
308 : NodeMatcher(IrOpcode::kEffectPhi), 301 : NodeMatcher(IrOpcode::kEffectPhi),
309 effect0_matcher_(effect0_matcher), 302 effect0_matcher_(effect0_matcher),
310 effect1_matcher_(effect1_matcher), 303 effect1_matcher_(effect1_matcher),
311 control_matcher_(control_matcher) {} 304 control_matcher_(control_matcher) {}
312 305
313 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 306 void DescribeTo(std::ostream* os) const FINAL {
314 NodeMatcher::DescribeTo(os); 307 NodeMatcher::DescribeTo(os);
315 *os << "), effect0 ("; 308 *os << "), effect0 (";
316 effect0_matcher_.DescribeTo(os); 309 effect0_matcher_.DescribeTo(os);
317 *os << "), effect1 ("; 310 *os << "), effect1 (";
318 effect1_matcher_.DescribeTo(os); 311 effect1_matcher_.DescribeTo(os);
319 *os << ") and control ("; 312 *os << ") and control (";
320 control_matcher_.DescribeTo(os); 313 control_matcher_.DescribeTo(os);
321 *os << ")"; 314 *os << ")";
322 } 315 }
323 316
324 virtual bool MatchAndExplain(Node* node, 317 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
325 MatchResultListener* listener) const OVERRIDE {
326 return (NodeMatcher::MatchAndExplain(node, listener) && 318 return (NodeMatcher::MatchAndExplain(node, listener) &&
327 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0), 319 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0),
328 "effect0", effect0_matcher_, listener) && 320 "effect0", effect0_matcher_, listener) &&
329 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1), 321 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1),
330 "effect1", effect1_matcher_, listener) && 322 "effect1", effect1_matcher_, listener) &&
331 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 323 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
332 "control", control_matcher_, listener)); 324 "control", control_matcher_, listener));
333 } 325 }
334 326
335 private: 327 private:
336 const Matcher<Node*> effect0_matcher_; 328 const Matcher<Node*> effect0_matcher_;
337 const Matcher<Node*> effect1_matcher_; 329 const Matcher<Node*> effect1_matcher_;
338 const Matcher<Node*> control_matcher_; 330 const Matcher<Node*> control_matcher_;
339 }; 331 };
340 332
341 333
342 class IsProjectionMatcher FINAL : public NodeMatcher { 334 class IsProjectionMatcher FINAL : public NodeMatcher {
343 public: 335 public:
344 IsProjectionMatcher(const Matcher<size_t>& index_matcher, 336 IsProjectionMatcher(const Matcher<size_t>& index_matcher,
345 const Matcher<Node*>& base_matcher) 337 const Matcher<Node*>& base_matcher)
346 : NodeMatcher(IrOpcode::kProjection), 338 : NodeMatcher(IrOpcode::kProjection),
347 index_matcher_(index_matcher), 339 index_matcher_(index_matcher),
348 base_matcher_(base_matcher) {} 340 base_matcher_(base_matcher) {}
349 341
350 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 342 void DescribeTo(std::ostream* os) const FINAL {
351 NodeMatcher::DescribeTo(os); 343 NodeMatcher::DescribeTo(os);
352 *os << " whose index ("; 344 *os << " whose index (";
353 index_matcher_.DescribeTo(os); 345 index_matcher_.DescribeTo(os);
354 *os << ") and base ("; 346 *os << ") and base (";
355 base_matcher_.DescribeTo(os); 347 base_matcher_.DescribeTo(os);
356 *os << ")"; 348 *os << ")";
357 } 349 }
358 350
359 virtual bool MatchAndExplain(Node* node, 351 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
360 MatchResultListener* listener) const OVERRIDE {
361 return (NodeMatcher::MatchAndExplain(node, listener) && 352 return (NodeMatcher::MatchAndExplain(node, listener) &&
362 PrintMatchAndExplain(OpParameter<size_t>(node), "index", 353 PrintMatchAndExplain(OpParameter<size_t>(node), "index",
363 index_matcher_, listener) && 354 index_matcher_, listener) &&
364 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 355 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
365 base_matcher_, listener)); 356 base_matcher_, listener));
366 } 357 }
367 358
368 private: 359 private:
369 const Matcher<size_t> index_matcher_; 360 const Matcher<size_t> index_matcher_;
370 const Matcher<Node*> base_matcher_; 361 const Matcher<Node*> base_matcher_;
371 }; 362 };
372 363
373 364
374 class IsCall2Matcher FINAL : public NodeMatcher { 365 class IsCall2Matcher FINAL : public NodeMatcher {
375 public: 366 public:
376 IsCall2Matcher(const Matcher<CallDescriptor*>& descriptor_matcher, 367 IsCall2Matcher(const Matcher<CallDescriptor*>& descriptor_matcher,
377 const Matcher<Node*>& value0_matcher, 368 const Matcher<Node*>& value0_matcher,
378 const Matcher<Node*>& value1_matcher, 369 const Matcher<Node*>& value1_matcher,
379 const Matcher<Node*>& effect_matcher, 370 const Matcher<Node*>& effect_matcher,
380 const Matcher<Node*>& control_matcher) 371 const Matcher<Node*>& control_matcher)
381 : NodeMatcher(IrOpcode::kCall), 372 : NodeMatcher(IrOpcode::kCall),
382 descriptor_matcher_(descriptor_matcher), 373 descriptor_matcher_(descriptor_matcher),
383 value0_matcher_(value0_matcher), 374 value0_matcher_(value0_matcher),
384 value1_matcher_(value1_matcher), 375 value1_matcher_(value1_matcher),
385 effect_matcher_(effect_matcher), 376 effect_matcher_(effect_matcher),
386 control_matcher_(control_matcher) {} 377 control_matcher_(control_matcher) {}
387 378
388 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 379 void DescribeTo(std::ostream* os) const FINAL {
389 NodeMatcher::DescribeTo(os); 380 NodeMatcher::DescribeTo(os);
390 *os << " whose value0 ("; 381 *os << " whose value0 (";
391 value0_matcher_.DescribeTo(os); 382 value0_matcher_.DescribeTo(os);
392 *os << ") and value1 ("; 383 *os << ") and value1 (";
393 value1_matcher_.DescribeTo(os); 384 value1_matcher_.DescribeTo(os);
394 *os << ") and effect ("; 385 *os << ") and effect (";
395 effect_matcher_.DescribeTo(os); 386 effect_matcher_.DescribeTo(os);
396 *os << ") and control ("; 387 *os << ") and control (";
397 control_matcher_.DescribeTo(os); 388 control_matcher_.DescribeTo(os);
398 *os << ")"; 389 *os << ")";
399 } 390 }
400 391
401 virtual bool MatchAndExplain(Node* node, 392 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
402 MatchResultListener* listener) const OVERRIDE {
403 return (NodeMatcher::MatchAndExplain(node, listener) && 393 return (NodeMatcher::MatchAndExplain(node, listener) &&
404 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), 394 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node),
405 "descriptor", descriptor_matcher_, listener) && 395 "descriptor", descriptor_matcher_, listener) &&
406 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 396 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
407 "value0", value0_matcher_, listener) && 397 "value0", value0_matcher_, listener) &&
408 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 398 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
409 "value1", value1_matcher_, listener) && 399 "value1", value1_matcher_, listener) &&
410 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 400 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
411 effect_matcher_, listener) && 401 effect_matcher_, listener) &&
412 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 402 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
(...skipping 20 matching lines...) Expand all
433 const Matcher<Node*>& control_matcher) 423 const Matcher<Node*>& control_matcher)
434 : NodeMatcher(IrOpcode::kCall), 424 : NodeMatcher(IrOpcode::kCall),
435 descriptor_matcher_(descriptor_matcher), 425 descriptor_matcher_(descriptor_matcher),
436 value0_matcher_(value0_matcher), 426 value0_matcher_(value0_matcher),
437 value1_matcher_(value1_matcher), 427 value1_matcher_(value1_matcher),
438 value2_matcher_(value2_matcher), 428 value2_matcher_(value2_matcher),
439 value3_matcher_(value3_matcher), 429 value3_matcher_(value3_matcher),
440 effect_matcher_(effect_matcher), 430 effect_matcher_(effect_matcher),
441 control_matcher_(control_matcher) {} 431 control_matcher_(control_matcher) {}
442 432
443 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 433 void DescribeTo(std::ostream* os) const FINAL {
444 NodeMatcher::DescribeTo(os); 434 NodeMatcher::DescribeTo(os);
445 *os << " whose value0 ("; 435 *os << " whose value0 (";
446 value0_matcher_.DescribeTo(os); 436 value0_matcher_.DescribeTo(os);
447 *os << ") and value1 ("; 437 *os << ") and value1 (";
448 value1_matcher_.DescribeTo(os); 438 value1_matcher_.DescribeTo(os);
449 *os << ") and value2 ("; 439 *os << ") and value2 (";
450 value2_matcher_.DescribeTo(os); 440 value2_matcher_.DescribeTo(os);
451 *os << ") and value3 ("; 441 *os << ") and value3 (";
452 value3_matcher_.DescribeTo(os); 442 value3_matcher_.DescribeTo(os);
453 *os << ") and effect ("; 443 *os << ") and effect (";
454 effect_matcher_.DescribeTo(os); 444 effect_matcher_.DescribeTo(os);
455 *os << ") and control ("; 445 *os << ") and control (";
456 control_matcher_.DescribeTo(os); 446 control_matcher_.DescribeTo(os);
457 *os << ")"; 447 *os << ")";
458 } 448 }
459 449
460 virtual bool MatchAndExplain(Node* node, 450 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
461 MatchResultListener* listener) const OVERRIDE {
462 return (NodeMatcher::MatchAndExplain(node, listener) && 451 return (NodeMatcher::MatchAndExplain(node, listener) &&
463 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), 452 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node),
464 "descriptor", descriptor_matcher_, listener) && 453 "descriptor", descriptor_matcher_, listener) &&
465 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 454 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
466 "value0", value0_matcher_, listener) && 455 "value0", value0_matcher_, listener) &&
467 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 456 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
468 "value1", value1_matcher_, listener) && 457 "value1", value1_matcher_, listener) &&
469 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), 458 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
470 "value2", value2_matcher_, listener) && 459 "value2", value2_matcher_, listener) &&
471 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), 460 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
(...skipping 20 matching lines...) Expand all
492 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher, 481 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher,
493 const Matcher<Node*>& base_matcher, 482 const Matcher<Node*>& base_matcher,
494 const Matcher<Node*>& effect_matcher, 483 const Matcher<Node*>& effect_matcher,
495 const Matcher<Node*>& control_matcher) 484 const Matcher<Node*>& control_matcher)
496 : NodeMatcher(IrOpcode::kLoadField), 485 : NodeMatcher(IrOpcode::kLoadField),
497 access_matcher_(access_matcher), 486 access_matcher_(access_matcher),
498 base_matcher_(base_matcher), 487 base_matcher_(base_matcher),
499 effect_matcher_(effect_matcher), 488 effect_matcher_(effect_matcher),
500 control_matcher_(control_matcher) {} 489 control_matcher_(control_matcher) {}
501 490
502 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 491 void DescribeTo(std::ostream* os) const FINAL {
503 NodeMatcher::DescribeTo(os); 492 NodeMatcher::DescribeTo(os);
504 *os << " whose access ("; 493 *os << " whose access (";
505 access_matcher_.DescribeTo(os); 494 access_matcher_.DescribeTo(os);
506 *os << "), base ("; 495 *os << "), base (";
507 base_matcher_.DescribeTo(os); 496 base_matcher_.DescribeTo(os);
508 *os << "), effect ("; 497 *os << "), effect (";
509 effect_matcher_.DescribeTo(os); 498 effect_matcher_.DescribeTo(os);
510 *os << ") and control ("; 499 *os << ") and control (";
511 control_matcher_.DescribeTo(os); 500 control_matcher_.DescribeTo(os);
512 *os << ")"; 501 *os << ")";
513 } 502 }
514 503
515 virtual bool MatchAndExplain(Node* node, 504 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
516 MatchResultListener* listener) const OVERRIDE {
517 return (NodeMatcher::MatchAndExplain(node, listener) && 505 return (NodeMatcher::MatchAndExplain(node, listener) &&
518 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", 506 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
519 access_matcher_, listener) && 507 access_matcher_, listener) &&
520 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 508 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
521 base_matcher_, listener) && 509 base_matcher_, listener) &&
522 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 510 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
523 effect_matcher_, listener) && 511 effect_matcher_, listener) &&
524 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 512 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
525 "control", control_matcher_, listener)); 513 "control", control_matcher_, listener));
526 } 514 }
(...skipping 13 matching lines...) Expand all
540 const Matcher<Node*>& value_matcher, 528 const Matcher<Node*>& value_matcher,
541 const Matcher<Node*>& effect_matcher, 529 const Matcher<Node*>& effect_matcher,
542 const Matcher<Node*>& control_matcher) 530 const Matcher<Node*>& control_matcher)
543 : NodeMatcher(IrOpcode::kStoreField), 531 : NodeMatcher(IrOpcode::kStoreField),
544 access_matcher_(access_matcher), 532 access_matcher_(access_matcher),
545 base_matcher_(base_matcher), 533 base_matcher_(base_matcher),
546 value_matcher_(value_matcher), 534 value_matcher_(value_matcher),
547 effect_matcher_(effect_matcher), 535 effect_matcher_(effect_matcher),
548 control_matcher_(control_matcher) {} 536 control_matcher_(control_matcher) {}
549 537
550 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 538 void DescribeTo(std::ostream* os) const FINAL {
551 NodeMatcher::DescribeTo(os); 539 NodeMatcher::DescribeTo(os);
552 *os << " whose access ("; 540 *os << " whose access (";
553 access_matcher_.DescribeTo(os); 541 access_matcher_.DescribeTo(os);
554 *os << "), base ("; 542 *os << "), base (";
555 base_matcher_.DescribeTo(os); 543 base_matcher_.DescribeTo(os);
556 *os << "), value ("; 544 *os << "), value (";
557 value_matcher_.DescribeTo(os); 545 value_matcher_.DescribeTo(os);
558 *os << "), effect ("; 546 *os << "), effect (";
559 effect_matcher_.DescribeTo(os); 547 effect_matcher_.DescribeTo(os);
560 *os << ") and control ("; 548 *os << ") and control (";
561 control_matcher_.DescribeTo(os); 549 control_matcher_.DescribeTo(os);
562 *os << ")"; 550 *os << ")";
563 } 551 }
564 552
565 virtual bool MatchAndExplain(Node* node, 553 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
566 MatchResultListener* listener) const OVERRIDE {
567 return (NodeMatcher::MatchAndExplain(node, listener) && 554 return (NodeMatcher::MatchAndExplain(node, listener) &&
568 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access", 555 PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
569 access_matcher_, listener) && 556 access_matcher_, listener) &&
570 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 557 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
571 base_matcher_, listener) && 558 base_matcher_, listener) &&
572 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 559 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
573 "value", value_matcher_, listener) && 560 "value", value_matcher_, listener) &&
574 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 561 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
575 effect_matcher_, listener) && 562 effect_matcher_, listener) &&
576 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 563 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
(...skipping 18 matching lines...) Expand all
595 const Matcher<Node*>& effect_matcher, 582 const Matcher<Node*>& effect_matcher,
596 const Matcher<Node*>& control_matcher) 583 const Matcher<Node*>& control_matcher)
597 : NodeMatcher(IrOpcode::kLoadBuffer), 584 : NodeMatcher(IrOpcode::kLoadBuffer),
598 access_matcher_(access_matcher), 585 access_matcher_(access_matcher),
599 buffer_matcher_(buffer_matcher), 586 buffer_matcher_(buffer_matcher),
600 offset_matcher_(offset_matcher), 587 offset_matcher_(offset_matcher),
601 length_matcher_(length_matcher), 588 length_matcher_(length_matcher),
602 effect_matcher_(effect_matcher), 589 effect_matcher_(effect_matcher),
603 control_matcher_(control_matcher) {} 590 control_matcher_(control_matcher) {}
604 591
605 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 592 void DescribeTo(std::ostream* os) const FINAL {
606 NodeMatcher::DescribeTo(os); 593 NodeMatcher::DescribeTo(os);
607 *os << " whose access ("; 594 *os << " whose access (";
608 access_matcher_.DescribeTo(os); 595 access_matcher_.DescribeTo(os);
609 *os << "), buffer ("; 596 *os << "), buffer (";
610 buffer_matcher_.DescribeTo(os); 597 buffer_matcher_.DescribeTo(os);
611 *os << "), offset ("; 598 *os << "), offset (";
612 offset_matcher_.DescribeTo(os); 599 offset_matcher_.DescribeTo(os);
613 *os << "), length ("; 600 *os << "), length (";
614 length_matcher_.DescribeTo(os); 601 length_matcher_.DescribeTo(os);
615 *os << "), effect ("; 602 *os << "), effect (";
616 effect_matcher_.DescribeTo(os); 603 effect_matcher_.DescribeTo(os);
617 *os << ") and control ("; 604 *os << ") and control (";
618 control_matcher_.DescribeTo(os); 605 control_matcher_.DescribeTo(os);
619 *os << ")"; 606 *os << ")";
620 } 607 }
621 608
622 virtual bool MatchAndExplain(Node* node, 609 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
623 MatchResultListener* listener) const OVERRIDE {
624 return (NodeMatcher::MatchAndExplain(node, listener) && 610 return (NodeMatcher::MatchAndExplain(node, listener) &&
625 PrintMatchAndExplain(BufferAccessOf(node->op()), "access", 611 PrintMatchAndExplain(BufferAccessOf(node->op()), "access",
626 access_matcher_, listener) && 612 access_matcher_, listener) &&
627 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 613 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
628 "buffer", buffer_matcher_, listener) && 614 "buffer", buffer_matcher_, listener) &&
629 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 615 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
630 "offset", offset_matcher_, listener) && 616 "offset", offset_matcher_, listener) &&
631 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), 617 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
632 "length", length_matcher_, listener) && 618 "length", length_matcher_, listener) &&
633 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 619 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
(...skipping 23 matching lines...) Expand all
657 const Matcher<Node*>& control_matcher) 643 const Matcher<Node*>& control_matcher)
658 : NodeMatcher(IrOpcode::kStoreBuffer), 644 : NodeMatcher(IrOpcode::kStoreBuffer),
659 access_matcher_(access_matcher), 645 access_matcher_(access_matcher),
660 buffer_matcher_(buffer_matcher), 646 buffer_matcher_(buffer_matcher),
661 offset_matcher_(offset_matcher), 647 offset_matcher_(offset_matcher),
662 length_matcher_(length_matcher), 648 length_matcher_(length_matcher),
663 value_matcher_(value_matcher), 649 value_matcher_(value_matcher),
664 effect_matcher_(effect_matcher), 650 effect_matcher_(effect_matcher),
665 control_matcher_(control_matcher) {} 651 control_matcher_(control_matcher) {}
666 652
667 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 653 void DescribeTo(std::ostream* os) const FINAL {
668 NodeMatcher::DescribeTo(os); 654 NodeMatcher::DescribeTo(os);
669 *os << " whose access ("; 655 *os << " whose access (";
670 access_matcher_.DescribeTo(os); 656 access_matcher_.DescribeTo(os);
671 *os << "), buffer ("; 657 *os << "), buffer (";
672 buffer_matcher_.DescribeTo(os); 658 buffer_matcher_.DescribeTo(os);
673 *os << "), offset ("; 659 *os << "), offset (";
674 offset_matcher_.DescribeTo(os); 660 offset_matcher_.DescribeTo(os);
675 *os << "), length ("; 661 *os << "), length (";
676 length_matcher_.DescribeTo(os); 662 length_matcher_.DescribeTo(os);
677 *os << "), value ("; 663 *os << "), value (";
678 value_matcher_.DescribeTo(os); 664 value_matcher_.DescribeTo(os);
679 *os << "), effect ("; 665 *os << "), effect (";
680 effect_matcher_.DescribeTo(os); 666 effect_matcher_.DescribeTo(os);
681 *os << ") and control ("; 667 *os << ") and control (";
682 control_matcher_.DescribeTo(os); 668 control_matcher_.DescribeTo(os);
683 *os << ")"; 669 *os << ")";
684 } 670 }
685 671
686 virtual bool MatchAndExplain(Node* node, 672 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
687 MatchResultListener* listener) const OVERRIDE {
688 return (NodeMatcher::MatchAndExplain(node, listener) && 673 return (NodeMatcher::MatchAndExplain(node, listener) &&
689 PrintMatchAndExplain(BufferAccessOf(node->op()), "access", 674 PrintMatchAndExplain(BufferAccessOf(node->op()), "access",
690 access_matcher_, listener) && 675 access_matcher_, listener) &&
691 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 676 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
692 "buffer", buffer_matcher_, listener) && 677 "buffer", buffer_matcher_, listener) &&
693 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 678 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
694 "offset", offset_matcher_, listener) && 679 "offset", offset_matcher_, listener) &&
695 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), 680 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
696 "length", length_matcher_, listener) && 681 "length", length_matcher_, listener) &&
697 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), 682 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
(...skipping 22 matching lines...) Expand all
720 const Matcher<Node*>& index_matcher, 705 const Matcher<Node*>& index_matcher,
721 const Matcher<Node*>& effect_matcher, 706 const Matcher<Node*>& effect_matcher,
722 const Matcher<Node*>& control_matcher) 707 const Matcher<Node*>& control_matcher)
723 : NodeMatcher(IrOpcode::kLoadElement), 708 : NodeMatcher(IrOpcode::kLoadElement),
724 access_matcher_(access_matcher), 709 access_matcher_(access_matcher),
725 base_matcher_(base_matcher), 710 base_matcher_(base_matcher),
726 index_matcher_(index_matcher), 711 index_matcher_(index_matcher),
727 effect_matcher_(effect_matcher), 712 effect_matcher_(effect_matcher),
728 control_matcher_(control_matcher) {} 713 control_matcher_(control_matcher) {}
729 714
730 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 715 void DescribeTo(std::ostream* os) const FINAL {
731 NodeMatcher::DescribeTo(os); 716 NodeMatcher::DescribeTo(os);
732 *os << " whose access ("; 717 *os << " whose access (";
733 access_matcher_.DescribeTo(os); 718 access_matcher_.DescribeTo(os);
734 *os << "), base ("; 719 *os << "), base (";
735 base_matcher_.DescribeTo(os); 720 base_matcher_.DescribeTo(os);
736 *os << "), index ("; 721 *os << "), index (";
737 index_matcher_.DescribeTo(os); 722 index_matcher_.DescribeTo(os);
738 *os << "), effect ("; 723 *os << "), effect (";
739 effect_matcher_.DescribeTo(os); 724 effect_matcher_.DescribeTo(os);
740 *os << ") and control ("; 725 *os << ") and control (";
741 control_matcher_.DescribeTo(os); 726 control_matcher_.DescribeTo(os);
742 *os << ")"; 727 *os << ")";
743 } 728 }
744 729
745 virtual bool MatchAndExplain(Node* node, 730 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
746 MatchResultListener* listener) const OVERRIDE {
747 return (NodeMatcher::MatchAndExplain(node, listener) && 731 return (NodeMatcher::MatchAndExplain(node, listener) &&
748 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", 732 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access",
749 access_matcher_, listener) && 733 access_matcher_, listener) &&
750 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 734 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
751 base_matcher_, listener) && 735 base_matcher_, listener) &&
752 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 736 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
753 "index", index_matcher_, listener) && 737 "index", index_matcher_, listener) &&
754 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 738 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
755 effect_matcher_, listener) && 739 effect_matcher_, listener) &&
756 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 740 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
(...skipping 18 matching lines...) Expand all
775 const Matcher<Node*>& effect_matcher, 759 const Matcher<Node*>& effect_matcher,
776 const Matcher<Node*>& control_matcher) 760 const Matcher<Node*>& control_matcher)
777 : NodeMatcher(IrOpcode::kStoreElement), 761 : NodeMatcher(IrOpcode::kStoreElement),
778 access_matcher_(access_matcher), 762 access_matcher_(access_matcher),
779 base_matcher_(base_matcher), 763 base_matcher_(base_matcher),
780 index_matcher_(index_matcher), 764 index_matcher_(index_matcher),
781 value_matcher_(value_matcher), 765 value_matcher_(value_matcher),
782 effect_matcher_(effect_matcher), 766 effect_matcher_(effect_matcher),
783 control_matcher_(control_matcher) {} 767 control_matcher_(control_matcher) {}
784 768
785 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 769 void DescribeTo(std::ostream* os) const FINAL {
786 NodeMatcher::DescribeTo(os); 770 NodeMatcher::DescribeTo(os);
787 *os << " whose access ("; 771 *os << " whose access (";
788 access_matcher_.DescribeTo(os); 772 access_matcher_.DescribeTo(os);
789 *os << "), base ("; 773 *os << "), base (";
790 base_matcher_.DescribeTo(os); 774 base_matcher_.DescribeTo(os);
791 *os << "), index ("; 775 *os << "), index (";
792 index_matcher_.DescribeTo(os); 776 index_matcher_.DescribeTo(os);
793 *os << "), value ("; 777 *os << "), value (";
794 value_matcher_.DescribeTo(os); 778 value_matcher_.DescribeTo(os);
795 *os << "), effect ("; 779 *os << "), effect (";
796 effect_matcher_.DescribeTo(os); 780 effect_matcher_.DescribeTo(os);
797 *os << ") and control ("; 781 *os << ") and control (";
798 control_matcher_.DescribeTo(os); 782 control_matcher_.DescribeTo(os);
799 *os << ")"; 783 *os << ")";
800 } 784 }
801 785
802 virtual bool MatchAndExplain(Node* node, 786 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
803 MatchResultListener* listener) const OVERRIDE {
804 return (NodeMatcher::MatchAndExplain(node, listener) && 787 return (NodeMatcher::MatchAndExplain(node, listener) &&
805 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access", 788 PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access",
806 access_matcher_, listener) && 789 access_matcher_, listener) &&
807 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 790 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
808 base_matcher_, listener) && 791 base_matcher_, listener) &&
809 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 792 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
810 "index", index_matcher_, listener) && 793 "index", index_matcher_, listener) &&
811 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), 794 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
812 "value", value_matcher_, listener) && 795 "value", value_matcher_, listener) &&
813 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 796 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
(...skipping 19 matching lines...) Expand all
833 const Matcher<Node*>& index_matcher, 816 const Matcher<Node*>& index_matcher,
834 const Matcher<Node*>& effect_matcher, 817 const Matcher<Node*>& effect_matcher,
835 const Matcher<Node*>& control_matcher) 818 const Matcher<Node*>& control_matcher)
836 : NodeMatcher(IrOpcode::kLoad), 819 : NodeMatcher(IrOpcode::kLoad),
837 rep_matcher_(rep_matcher), 820 rep_matcher_(rep_matcher),
838 base_matcher_(base_matcher), 821 base_matcher_(base_matcher),
839 index_matcher_(index_matcher), 822 index_matcher_(index_matcher),
840 effect_matcher_(effect_matcher), 823 effect_matcher_(effect_matcher),
841 control_matcher_(control_matcher) {} 824 control_matcher_(control_matcher) {}
842 825
843 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 826 void DescribeTo(std::ostream* os) const FINAL {
844 NodeMatcher::DescribeTo(os); 827 NodeMatcher::DescribeTo(os);
845 *os << " whose rep ("; 828 *os << " whose rep (";
846 rep_matcher_.DescribeTo(os); 829 rep_matcher_.DescribeTo(os);
847 *os << "), base ("; 830 *os << "), base (";
848 base_matcher_.DescribeTo(os); 831 base_matcher_.DescribeTo(os);
849 *os << "), index ("; 832 *os << "), index (";
850 index_matcher_.DescribeTo(os); 833 index_matcher_.DescribeTo(os);
851 *os << "), effect ("; 834 *os << "), effect (";
852 effect_matcher_.DescribeTo(os); 835 effect_matcher_.DescribeTo(os);
853 *os << ") and control ("; 836 *os << ") and control (";
854 control_matcher_.DescribeTo(os); 837 control_matcher_.DescribeTo(os);
855 *os << ")"; 838 *os << ")";
856 } 839 }
857 840
858 virtual bool MatchAndExplain(Node* node, 841 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
859 MatchResultListener* listener) const OVERRIDE {
860 return (NodeMatcher::MatchAndExplain(node, listener) && 842 return (NodeMatcher::MatchAndExplain(node, listener) &&
861 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", 843 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep",
862 rep_matcher_, listener) && 844 rep_matcher_, listener) &&
863 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 845 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
864 base_matcher_, listener) && 846 base_matcher_, listener) &&
865 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 847 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
866 "index", index_matcher_, listener) && 848 "index", index_matcher_, listener) &&
867 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 849 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
868 effect_matcher_, listener) && 850 effect_matcher_, listener) &&
869 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 851 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
(...skipping 14 matching lines...) Expand all
884 IsToNumberMatcher(const Matcher<Node*>& base_matcher, 866 IsToNumberMatcher(const Matcher<Node*>& base_matcher,
885 const Matcher<Node*>& context_matcher, 867 const Matcher<Node*>& context_matcher,
886 const Matcher<Node*>& effect_matcher, 868 const Matcher<Node*>& effect_matcher,
887 const Matcher<Node*>& control_matcher) 869 const Matcher<Node*>& control_matcher)
888 : NodeMatcher(IrOpcode::kJSToNumber), 870 : NodeMatcher(IrOpcode::kJSToNumber),
889 base_matcher_(base_matcher), 871 base_matcher_(base_matcher),
890 context_matcher_(context_matcher), 872 context_matcher_(context_matcher),
891 effect_matcher_(effect_matcher), 873 effect_matcher_(effect_matcher),
892 control_matcher_(control_matcher) {} 874 control_matcher_(control_matcher) {}
893 875
894 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 876 void DescribeTo(std::ostream* os) const FINAL {
895 NodeMatcher::DescribeTo(os); 877 NodeMatcher::DescribeTo(os);
896 *os << " whose base ("; 878 *os << " whose base (";
897 base_matcher_.DescribeTo(os); 879 base_matcher_.DescribeTo(os);
898 *os << "), context ("; 880 *os << "), context (";
899 context_matcher_.DescribeTo(os); 881 context_matcher_.DescribeTo(os);
900 *os << "), effect ("; 882 *os << "), effect (";
901 effect_matcher_.DescribeTo(os); 883 effect_matcher_.DescribeTo(os);
902 *os << ") and control ("; 884 *os << ") and control (";
903 control_matcher_.DescribeTo(os); 885 control_matcher_.DescribeTo(os);
904 *os << ")"; 886 *os << ")";
905 } 887 }
906 888
907 virtual bool MatchAndExplain(Node* node, 889 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
908 MatchResultListener* listener) const OVERRIDE {
909 return (NodeMatcher::MatchAndExplain(node, listener) && 890 return (NodeMatcher::MatchAndExplain(node, listener) &&
910 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 891 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
911 base_matcher_, listener) && 892 base_matcher_, listener) &&
912 PrintMatchAndExplain(NodeProperties::GetContextInput(node), 893 PrintMatchAndExplain(NodeProperties::GetContextInput(node),
913 "context", context_matcher_, listener) && 894 "context", context_matcher_, listener) &&
914 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 895 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
915 effect_matcher_, listener) && 896 effect_matcher_, listener) &&
916 PrintMatchAndExplain(NodeProperties::GetControlInput(node), 897 PrintMatchAndExplain(NodeProperties::GetControlInput(node),
917 "control", control_matcher_, listener)); 898 "control", control_matcher_, listener));
918 } 899 }
(...skipping 15 matching lines...) Expand all
934 const Matcher<Node*>& effect_matcher, 915 const Matcher<Node*>& effect_matcher,
935 const Matcher<Node*>& control_matcher) 916 const Matcher<Node*>& control_matcher)
936 : NodeMatcher(IrOpcode::kStore), 917 : NodeMatcher(IrOpcode::kStore),
937 rep_matcher_(rep_matcher), 918 rep_matcher_(rep_matcher),
938 base_matcher_(base_matcher), 919 base_matcher_(base_matcher),
939 index_matcher_(index_matcher), 920 index_matcher_(index_matcher),
940 value_matcher_(value_matcher), 921 value_matcher_(value_matcher),
941 effect_matcher_(effect_matcher), 922 effect_matcher_(effect_matcher),
942 control_matcher_(control_matcher) {} 923 control_matcher_(control_matcher) {}
943 924
944 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 925 void DescribeTo(std::ostream* os) const FINAL {
945 NodeMatcher::DescribeTo(os); 926 NodeMatcher::DescribeTo(os);
946 *os << " whose rep ("; 927 *os << " whose rep (";
947 rep_matcher_.DescribeTo(os); 928 rep_matcher_.DescribeTo(os);
948 *os << "), base ("; 929 *os << "), base (";
949 base_matcher_.DescribeTo(os); 930 base_matcher_.DescribeTo(os);
950 *os << "), index ("; 931 *os << "), index (";
951 index_matcher_.DescribeTo(os); 932 index_matcher_.DescribeTo(os);
952 *os << "), value ("; 933 *os << "), value (";
953 value_matcher_.DescribeTo(os); 934 value_matcher_.DescribeTo(os);
954 *os << "), effect ("; 935 *os << "), effect (";
955 effect_matcher_.DescribeTo(os); 936 effect_matcher_.DescribeTo(os);
956 *os << ") and control ("; 937 *os << ") and control (";
957 control_matcher_.DescribeTo(os); 938 control_matcher_.DescribeTo(os);
958 *os << ")"; 939 *os << ")";
959 } 940 }
960 941
961 virtual bool MatchAndExplain(Node* node, 942 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
962 MatchResultListener* listener) const OVERRIDE {
963 return (NodeMatcher::MatchAndExplain(node, listener) && 943 return (NodeMatcher::MatchAndExplain(node, listener) &&
964 PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep", 944 PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep",
965 rep_matcher_, listener) && 945 rep_matcher_, listener) &&
966 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", 946 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
967 base_matcher_, listener) && 947 base_matcher_, listener) &&
968 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), 948 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
969 "index", index_matcher_, listener) && 949 "index", index_matcher_, listener) &&
970 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), 950 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
971 "value", value_matcher_, listener) && 951 "value", value_matcher_, listener) &&
972 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", 952 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
(...skipping 13 matching lines...) Expand all
986 966
987 967
988 class IsBinopMatcher FINAL : public NodeMatcher { 968 class IsBinopMatcher FINAL : public NodeMatcher {
989 public: 969 public:
990 IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher, 970 IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher,
991 const Matcher<Node*>& rhs_matcher) 971 const Matcher<Node*>& rhs_matcher)
992 : NodeMatcher(opcode), 972 : NodeMatcher(opcode),
993 lhs_matcher_(lhs_matcher), 973 lhs_matcher_(lhs_matcher),
994 rhs_matcher_(rhs_matcher) {} 974 rhs_matcher_(rhs_matcher) {}
995 975
996 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 976 void DescribeTo(std::ostream* os) const FINAL {
997 NodeMatcher::DescribeTo(os); 977 NodeMatcher::DescribeTo(os);
998 *os << " whose lhs ("; 978 *os << " whose lhs (";
999 lhs_matcher_.DescribeTo(os); 979 lhs_matcher_.DescribeTo(os);
1000 *os << ") and rhs ("; 980 *os << ") and rhs (";
1001 rhs_matcher_.DescribeTo(os); 981 rhs_matcher_.DescribeTo(os);
1002 *os << ")"; 982 *os << ")";
1003 } 983 }
1004 984
1005 virtual bool MatchAndExplain(Node* node, 985 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
1006 MatchResultListener* listener) const OVERRIDE {
1007 return (NodeMatcher::MatchAndExplain(node, listener) && 986 return (NodeMatcher::MatchAndExplain(node, listener) &&
1008 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", 987 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs",
1009 lhs_matcher_, listener) && 988 lhs_matcher_, listener) &&
1010 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", 989 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs",
1011 rhs_matcher_, listener)); 990 rhs_matcher_, listener));
1012 } 991 }
1013 992
1014 private: 993 private:
1015 const Matcher<Node*> lhs_matcher_; 994 const Matcher<Node*> lhs_matcher_;
1016 const Matcher<Node*> rhs_matcher_; 995 const Matcher<Node*> rhs_matcher_;
1017 }; 996 };
1018 997
1019 998
1020 class IsUnopMatcher FINAL : public NodeMatcher { 999 class IsUnopMatcher FINAL : public NodeMatcher {
1021 public: 1000 public:
1022 IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) 1001 IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher)
1023 : NodeMatcher(opcode), input_matcher_(input_matcher) {} 1002 : NodeMatcher(opcode), input_matcher_(input_matcher) {}
1024 1003
1025 virtual void DescribeTo(std::ostream* os) const OVERRIDE { 1004 void DescribeTo(std::ostream* os) const FINAL {
1026 NodeMatcher::DescribeTo(os); 1005 NodeMatcher::DescribeTo(os);
1027 *os << " whose input ("; 1006 *os << " whose input (";
1028 input_matcher_.DescribeTo(os); 1007 input_matcher_.DescribeTo(os);
1029 *os << ")"; 1008 *os << ")";
1030 } 1009 }
1031 1010
1032 virtual bool MatchAndExplain(Node* node, 1011 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL {
1033 MatchResultListener* listener) const OVERRIDE {
1034 return (NodeMatcher::MatchAndExplain(node, listener) && 1012 return (NodeMatcher::MatchAndExplain(node, listener) &&
1035 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), 1013 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
1036 "input", input_matcher_, listener)); 1014 "input", input_matcher_, listener));
1037 } 1015 }
1038 1016
1039 private: 1017 private:
1040 const Matcher<Node*> input_matcher_; 1018 const Matcher<Node*> input_matcher_;
1041 }; 1019 };
1042 } 1020 }
1043 1021
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 IS_UNOP_MATCHER(Float64Ceil) 1304 IS_UNOP_MATCHER(Float64Ceil)
1327 IS_UNOP_MATCHER(Float64RoundTruncate) 1305 IS_UNOP_MATCHER(Float64RoundTruncate)
1328 IS_UNOP_MATCHER(Float64RoundTiesAway) 1306 IS_UNOP_MATCHER(Float64RoundTiesAway)
1329 IS_UNOP_MATCHER(NumberToInt32) 1307 IS_UNOP_MATCHER(NumberToInt32)
1330 IS_UNOP_MATCHER(NumberToUint32) 1308 IS_UNOP_MATCHER(NumberToUint32)
1331 #undef IS_UNOP_MATCHER 1309 #undef IS_UNOP_MATCHER
1332 1310
1333 } // namespace compiler 1311 } // namespace compiler
1334 } // namespace internal 1312 } // namespace internal
1335 } // namespace v8 1313 } // namespace v8
OLDNEW
« src/compiler/change-lowering.h ('K') | « test/unittests/compiler/node-matchers-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698