| 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 #include "src/compiler/graph-unittest.h" | 5 #include "test/unittests/compiler/graph-unittest.h" |
| 6 | 6 |
| 7 #include <ostream> // NOLINT(readability/streams) | 7 #include <ostream> // NOLINT(readability/streams) |
| 8 | 8 |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 | 10 |
| 11 using testing::_; | 11 using testing::_; |
| 12 using testing::MakeMatcher; | 12 using testing::MakeMatcher; |
| 13 using testing::MatcherInterface; | 13 using testing::MatcherInterface; |
| 14 using testing::MatchResultListener; | 14 using testing::MatchResultListener; |
| 15 using testing::StringMatchResultListener; | 15 using testing::StringMatchResultListener; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 | 116 |
| 117 class NodeMatcher : public MatcherInterface<Node*> { | 117 class NodeMatcher : public MatcherInterface<Node*> { |
| 118 public: | 118 public: |
| 119 explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {} | 119 explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {} |
| 120 | 120 |
| 121 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 121 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 122 *os << "is a " << IrOpcode::Mnemonic(opcode_) << " node"; | 122 *os << "is a " << IrOpcode::Mnemonic(opcode_) << " node"; |
| 123 } | 123 } |
| 124 | 124 |
| 125 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 125 virtual bool MatchAndExplain(Node* node, |
| 126 OVERRIDE { | 126 MatchResultListener* listener) const OVERRIDE { |
| 127 if (node == NULL) { | 127 if (node == NULL) { |
| 128 *listener << "which is NULL"; | 128 *listener << "which is NULL"; |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 if (node->opcode() != opcode_) { | 131 if (node->opcode() != opcode_) { |
| 132 *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode()) | 132 *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode()) |
| 133 << " but should have been " << IrOpcode::Mnemonic(opcode_); | 133 << " but should have been " << IrOpcode::Mnemonic(opcode_); |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 return true; | 136 return true; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 151 | 151 |
| 152 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 152 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 153 NodeMatcher::DescribeTo(os); | 153 NodeMatcher::DescribeTo(os); |
| 154 *os << " whose value ("; | 154 *os << " whose value ("; |
| 155 value_matcher_.DescribeTo(os); | 155 value_matcher_.DescribeTo(os); |
| 156 *os << ") and control ("; | 156 *os << ") and control ("; |
| 157 control_matcher_.DescribeTo(os); | 157 control_matcher_.DescribeTo(os); |
| 158 *os << ")"; | 158 *os << ")"; |
| 159 } | 159 } |
| 160 | 160 |
| 161 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 161 virtual bool MatchAndExplain(Node* node, |
| 162 OVERRIDE { | 162 MatchResultListener* listener) const OVERRIDE { |
| 163 return (NodeMatcher::MatchAndExplain(node, listener) && | 163 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 164 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 164 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 165 "value", value_matcher_, listener) && | 165 "value", value_matcher_, listener) && |
| 166 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 166 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 167 "control", control_matcher_, listener)); | 167 "control", control_matcher_, listener)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 private: | 170 private: |
| 171 const Matcher<Node*> value_matcher_; | 171 const Matcher<Node*> value_matcher_; |
| 172 const Matcher<Node*> control_matcher_; | 172 const Matcher<Node*> control_matcher_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 183 | 183 |
| 184 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 184 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 185 NodeMatcher::DescribeTo(os); | 185 NodeMatcher::DescribeTo(os); |
| 186 *os << " whose control0 ("; | 186 *os << " whose control0 ("; |
| 187 control0_matcher_.DescribeTo(os); | 187 control0_matcher_.DescribeTo(os); |
| 188 *os << ") and control1 ("; | 188 *os << ") and control1 ("; |
| 189 control1_matcher_.DescribeTo(os); | 189 control1_matcher_.DescribeTo(os); |
| 190 *os << ")"; | 190 *os << ")"; |
| 191 } | 191 } |
| 192 | 192 |
| 193 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 193 virtual bool MatchAndExplain(Node* node, |
| 194 OVERRIDE { | 194 MatchResultListener* listener) const OVERRIDE { |
| 195 return (NodeMatcher::MatchAndExplain(node, listener) && | 195 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 196 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), | 196 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0), |
| 197 "control0", control0_matcher_, listener) && | 197 "control0", control0_matcher_, listener) && |
| 198 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), | 198 PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1), |
| 199 "control1", control1_matcher_, listener)); | 199 "control1", control1_matcher_, listener)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 private: | 202 private: |
| 203 const Matcher<Node*> control0_matcher_; | 203 const Matcher<Node*> control0_matcher_; |
| 204 const Matcher<Node*> control1_matcher_; | 204 const Matcher<Node*> control1_matcher_; |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 | 207 |
| 208 class IsControl1Matcher FINAL : public NodeMatcher { | 208 class IsControl1Matcher FINAL : public NodeMatcher { |
| 209 public: | 209 public: |
| 210 IsControl1Matcher(IrOpcode::Value opcode, | 210 IsControl1Matcher(IrOpcode::Value opcode, |
| 211 const Matcher<Node*>& control_matcher) | 211 const Matcher<Node*>& control_matcher) |
| 212 : NodeMatcher(opcode), control_matcher_(control_matcher) {} | 212 : NodeMatcher(opcode), control_matcher_(control_matcher) {} |
| 213 | 213 |
| 214 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 214 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 215 NodeMatcher::DescribeTo(os); | 215 NodeMatcher::DescribeTo(os); |
| 216 *os << " whose control ("; | 216 *os << " whose control ("; |
| 217 control_matcher_.DescribeTo(os); | 217 control_matcher_.DescribeTo(os); |
| 218 *os << ")"; | 218 *os << ")"; |
| 219 } | 219 } |
| 220 | 220 |
| 221 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 221 virtual bool MatchAndExplain(Node* node, |
| 222 OVERRIDE { | 222 MatchResultListener* listener) const OVERRIDE { |
| 223 return (NodeMatcher::MatchAndExplain(node, listener) && | 223 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 224 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 224 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 225 "control", control_matcher_, listener)); | 225 "control", control_matcher_, listener)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 private: | 228 private: |
| 229 const Matcher<Node*> control_matcher_; | 229 const Matcher<Node*> control_matcher_; |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 | 232 |
| 233 class IsFinishMatcher FINAL : public NodeMatcher { | 233 class IsFinishMatcher FINAL : public NodeMatcher { |
| 234 public: | 234 public: |
| 235 IsFinishMatcher(const Matcher<Node*>& value_matcher, | 235 IsFinishMatcher(const Matcher<Node*>& value_matcher, |
| 236 const Matcher<Node*>& effect_matcher) | 236 const Matcher<Node*>& effect_matcher) |
| 237 : NodeMatcher(IrOpcode::kFinish), | 237 : NodeMatcher(IrOpcode::kFinish), |
| 238 value_matcher_(value_matcher), | 238 value_matcher_(value_matcher), |
| 239 effect_matcher_(effect_matcher) {} | 239 effect_matcher_(effect_matcher) {} |
| 240 | 240 |
| 241 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 241 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 242 NodeMatcher::DescribeTo(os); | 242 NodeMatcher::DescribeTo(os); |
| 243 *os << " whose value ("; | 243 *os << " whose value ("; |
| 244 value_matcher_.DescribeTo(os); | 244 value_matcher_.DescribeTo(os); |
| 245 *os << ") and effect ("; | 245 *os << ") and effect ("; |
| 246 effect_matcher_.DescribeTo(os); | 246 effect_matcher_.DescribeTo(os); |
| 247 *os << ")"; | 247 *os << ")"; |
| 248 } | 248 } |
| 249 | 249 |
| 250 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 250 virtual bool MatchAndExplain(Node* node, |
| 251 OVERRIDE { | 251 MatchResultListener* listener) const OVERRIDE { |
| 252 return (NodeMatcher::MatchAndExplain(node, listener) && | 252 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 253 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 253 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 254 "value", value_matcher_, listener) && | 254 "value", value_matcher_, listener) && |
| 255 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 255 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 256 effect_matcher_, listener)); | 256 effect_matcher_, listener)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 private: | 259 private: |
| 260 const Matcher<Node*> value_matcher_; | 260 const Matcher<Node*> value_matcher_; |
| 261 const Matcher<Node*> effect_matcher_; | 261 const Matcher<Node*> effect_matcher_; |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 | 264 |
| 265 template <typename T> | 265 template <typename T> |
| 266 class IsConstantMatcher FINAL : public NodeMatcher { | 266 class IsConstantMatcher FINAL : public NodeMatcher { |
| 267 public: | 267 public: |
| 268 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) | 268 IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher) |
| 269 : NodeMatcher(opcode), value_matcher_(value_matcher) {} | 269 : NodeMatcher(opcode), value_matcher_(value_matcher) {} |
| 270 | 270 |
| 271 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 271 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 272 NodeMatcher::DescribeTo(os); | 272 NodeMatcher::DescribeTo(os); |
| 273 *os << " whose value ("; | 273 *os << " whose value ("; |
| 274 value_matcher_.DescribeTo(os); | 274 value_matcher_.DescribeTo(os); |
| 275 *os << ")"; | 275 *os << ")"; |
| 276 } | 276 } |
| 277 | 277 |
| 278 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 278 virtual bool MatchAndExplain(Node* node, |
| 279 OVERRIDE { | 279 MatchResultListener* listener) const OVERRIDE { |
| 280 return (NodeMatcher::MatchAndExplain(node, listener) && | 280 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 281 PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_, | 281 PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_, |
| 282 listener)); | 282 listener)); |
| 283 } | 283 } |
| 284 | 284 |
| 285 private: | 285 private: |
| 286 const Matcher<T> value_matcher_; | 286 const Matcher<T> value_matcher_; |
| 287 }; | 287 }; |
| 288 | 288 |
| 289 | 289 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 305 type_matcher_.DescribeTo(os); | 305 type_matcher_.DescribeTo(os); |
| 306 *os << "), value0 ("; | 306 *os << "), value0 ("; |
| 307 value0_matcher_.DescribeTo(os); | 307 value0_matcher_.DescribeTo(os); |
| 308 *os << "), value1 ("; | 308 *os << "), value1 ("; |
| 309 value1_matcher_.DescribeTo(os); | 309 value1_matcher_.DescribeTo(os); |
| 310 *os << ") and control ("; | 310 *os << ") and control ("; |
| 311 control_matcher_.DescribeTo(os); | 311 control_matcher_.DescribeTo(os); |
| 312 *os << ")"; | 312 *os << ")"; |
| 313 } | 313 } |
| 314 | 314 |
| 315 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 315 virtual bool MatchAndExplain(Node* node, |
| 316 OVERRIDE { | 316 MatchResultListener* listener) const OVERRIDE { |
| 317 return (NodeMatcher::MatchAndExplain(node, listener) && | 317 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 318 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", | 318 PrintMatchAndExplain(OpParameter<MachineType>(node), "type", |
| 319 type_matcher_, listener) && | 319 type_matcher_, listener) && |
| 320 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 320 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 321 "value0", value0_matcher_, listener) && | 321 "value0", value0_matcher_, listener) && |
| 322 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 322 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| 323 "value1", value1_matcher_, listener) && | 323 "value1", value1_matcher_, listener) && |
| 324 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 324 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 325 "control", control_matcher_, listener)); | 325 "control", control_matcher_, listener)); |
| 326 } | 326 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 343 | 343 |
| 344 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 344 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 345 NodeMatcher::DescribeTo(os); | 345 NodeMatcher::DescribeTo(os); |
| 346 *os << " whose index ("; | 346 *os << " whose index ("; |
| 347 index_matcher_.DescribeTo(os); | 347 index_matcher_.DescribeTo(os); |
| 348 *os << ") and base ("; | 348 *os << ") and base ("; |
| 349 base_matcher_.DescribeTo(os); | 349 base_matcher_.DescribeTo(os); |
| 350 *os << ")"; | 350 *os << ")"; |
| 351 } | 351 } |
| 352 | 352 |
| 353 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 353 virtual bool MatchAndExplain(Node* node, |
| 354 OVERRIDE { | 354 MatchResultListener* listener) const OVERRIDE { |
| 355 return (NodeMatcher::MatchAndExplain(node, listener) && | 355 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 356 PrintMatchAndExplain(OpParameter<size_t>(node), "index", | 356 PrintMatchAndExplain(OpParameter<size_t>(node), "index", |
| 357 index_matcher_, listener) && | 357 index_matcher_, listener) && |
| 358 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 358 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
| 359 base_matcher_, listener)); | 359 base_matcher_, listener)); |
| 360 } | 360 } |
| 361 | 361 |
| 362 private: | 362 private: |
| 363 const Matcher<size_t> index_matcher_; | 363 const Matcher<size_t> index_matcher_; |
| 364 const Matcher<Node*> base_matcher_; | 364 const Matcher<Node*> base_matcher_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 393 value2_matcher_.DescribeTo(os); | 393 value2_matcher_.DescribeTo(os); |
| 394 *os << ") and value3 ("; | 394 *os << ") and value3 ("; |
| 395 value3_matcher_.DescribeTo(os); | 395 value3_matcher_.DescribeTo(os); |
| 396 *os << ") and effect ("; | 396 *os << ") and effect ("; |
| 397 effect_matcher_.DescribeTo(os); | 397 effect_matcher_.DescribeTo(os); |
| 398 *os << ") and control ("; | 398 *os << ") and control ("; |
| 399 control_matcher_.DescribeTo(os); | 399 control_matcher_.DescribeTo(os); |
| 400 *os << ")"; | 400 *os << ")"; |
| 401 } | 401 } |
| 402 | 402 |
| 403 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 403 virtual bool MatchAndExplain(Node* node, |
| 404 OVERRIDE { | 404 MatchResultListener* listener) const OVERRIDE { |
| 405 return (NodeMatcher::MatchAndExplain(node, listener) && | 405 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 406 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), | 406 PrintMatchAndExplain(OpParameter<CallDescriptor*>(node), |
| 407 "descriptor", descriptor_matcher_, listener) && | 407 "descriptor", descriptor_matcher_, listener) && |
| 408 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 408 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 409 "value0", value0_matcher_, listener) && | 409 "value0", value0_matcher_, listener) && |
| 410 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 410 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| 411 "value1", value1_matcher_, listener) && | 411 "value1", value1_matcher_, listener) && |
| 412 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | 412 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), |
| 413 "value2", value2_matcher_, listener) && | 413 "value2", value2_matcher_, listener) && |
| 414 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), | 414 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 rep_matcher_.DescribeTo(os); | 448 rep_matcher_.DescribeTo(os); |
| 449 *os << "), base ("; | 449 *os << "), base ("; |
| 450 base_matcher_.DescribeTo(os); | 450 base_matcher_.DescribeTo(os); |
| 451 *os << "), index ("; | 451 *os << "), index ("; |
| 452 index_matcher_.DescribeTo(os); | 452 index_matcher_.DescribeTo(os); |
| 453 *os << ") and effect ("; | 453 *os << ") and effect ("; |
| 454 effect_matcher_.DescribeTo(os); | 454 effect_matcher_.DescribeTo(os); |
| 455 *os << ")"; | 455 *os << ")"; |
| 456 } | 456 } |
| 457 | 457 |
| 458 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 458 virtual bool MatchAndExplain(Node* node, |
| 459 OVERRIDE { | 459 MatchResultListener* listener) const OVERRIDE { |
| 460 return (NodeMatcher::MatchAndExplain(node, listener) && | 460 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 461 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", | 461 PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep", |
| 462 rep_matcher_, listener) && | 462 rep_matcher_, listener) && |
| 463 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 463 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
| 464 base_matcher_, listener) && | 464 base_matcher_, listener) && |
| 465 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 465 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| 466 "index", index_matcher_, listener) && | 466 "index", index_matcher_, listener) && |
| 467 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 467 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 468 effect_matcher_, listener)); | 468 effect_matcher_, listener)); |
| 469 } | 469 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 index_matcher_.DescribeTo(os); | 506 index_matcher_.DescribeTo(os); |
| 507 *os << "), value ("; | 507 *os << "), value ("; |
| 508 value_matcher_.DescribeTo(os); | 508 value_matcher_.DescribeTo(os); |
| 509 *os << "), effect ("; | 509 *os << "), effect ("; |
| 510 effect_matcher_.DescribeTo(os); | 510 effect_matcher_.DescribeTo(os); |
| 511 *os << ") and control ("; | 511 *os << ") and control ("; |
| 512 control_matcher_.DescribeTo(os); | 512 control_matcher_.DescribeTo(os); |
| 513 *os << ")"; | 513 *os << ")"; |
| 514 } | 514 } |
| 515 | 515 |
| 516 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 516 virtual bool MatchAndExplain(Node* node, |
| 517 OVERRIDE { | 517 MatchResultListener* listener) const OVERRIDE { |
| 518 return (NodeMatcher::MatchAndExplain(node, listener) && | 518 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 519 PrintMatchAndExplain( | 519 PrintMatchAndExplain( |
| 520 OpParameter<StoreRepresentation>(node).machine_type(), "type", | 520 OpParameter<StoreRepresentation>(node).machine_type(), "type", |
| 521 type_matcher_, listener) && | 521 type_matcher_, listener) && |
| 522 PrintMatchAndExplain( | 522 PrintMatchAndExplain( |
| 523 OpParameter<StoreRepresentation>(node).write_barrier_kind(), | 523 OpParameter<StoreRepresentation>(node).write_barrier_kind(), |
| 524 "write barrier", write_barrier_matcher_, listener) && | 524 "write barrier", write_barrier_matcher_, listener) && |
| 525 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", | 525 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
| 526 base_matcher_, listener) && | 526 base_matcher_, listener) && |
| 527 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | 527 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 555 | 555 |
| 556 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 556 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 557 NodeMatcher::DescribeTo(os); | 557 NodeMatcher::DescribeTo(os); |
| 558 *os << " whose lhs ("; | 558 *os << " whose lhs ("; |
| 559 lhs_matcher_.DescribeTo(os); | 559 lhs_matcher_.DescribeTo(os); |
| 560 *os << ") and rhs ("; | 560 *os << ") and rhs ("; |
| 561 rhs_matcher_.DescribeTo(os); | 561 rhs_matcher_.DescribeTo(os); |
| 562 *os << ")"; | 562 *os << ")"; |
| 563 } | 563 } |
| 564 | 564 |
| 565 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 565 virtual bool MatchAndExplain(Node* node, |
| 566 OVERRIDE { | 566 MatchResultListener* listener) const OVERRIDE { |
| 567 return (NodeMatcher::MatchAndExplain(node, listener) && | 567 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 568 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", | 568 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
| 569 lhs_matcher_, listener) && | 569 lhs_matcher_, listener) && |
| 570 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | 570 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
| 571 rhs_matcher_, listener)); | 571 rhs_matcher_, listener)); |
| 572 } | 572 } |
| 573 | 573 |
| 574 private: | 574 private: |
| 575 const Matcher<Node*> lhs_matcher_; | 575 const Matcher<Node*> lhs_matcher_; |
| 576 const Matcher<Node*> rhs_matcher_; | 576 const Matcher<Node*> rhs_matcher_; |
| 577 }; | 577 }; |
| 578 | 578 |
| 579 | 579 |
| 580 class IsUnopMatcher FINAL : public NodeMatcher { | 580 class IsUnopMatcher FINAL : public NodeMatcher { |
| 581 public: | 581 public: |
| 582 IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) | 582 IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher) |
| 583 : NodeMatcher(opcode), input_matcher_(input_matcher) {} | 583 : NodeMatcher(opcode), input_matcher_(input_matcher) {} |
| 584 | 584 |
| 585 virtual void DescribeTo(std::ostream* os) const OVERRIDE { | 585 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 586 NodeMatcher::DescribeTo(os); | 586 NodeMatcher::DescribeTo(os); |
| 587 *os << " whose input ("; | 587 *os << " whose input ("; |
| 588 input_matcher_.DescribeTo(os); | 588 input_matcher_.DescribeTo(os); |
| 589 *os << ")"; | 589 *os << ")"; |
| 590 } | 590 } |
| 591 | 591 |
| 592 virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const | 592 virtual bool MatchAndExplain(Node* node, |
| 593 OVERRIDE { | 593 MatchResultListener* listener) const OVERRIDE { |
| 594 return (NodeMatcher::MatchAndExplain(node, listener) && | 594 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 595 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | 595 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| 596 "input", input_matcher_, listener)); | 596 "input", input_matcher_, listener)); |
| 597 } | 597 } |
| 598 | 598 |
| 599 private: | 599 private: |
| 600 const Matcher<Node*> input_matcher_; | 600 const Matcher<Node*> input_matcher_; |
| 601 }; | 601 }; |
| 602 } | 602 } |
| 603 | 603 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 IS_UNOP_MATCHER(ChangeUint32ToUint64) | 771 IS_UNOP_MATCHER(ChangeUint32ToUint64) |
| 772 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) | 772 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) |
| 773 IS_UNOP_MATCHER(TruncateFloat64ToInt32) | 773 IS_UNOP_MATCHER(TruncateFloat64ToInt32) |
| 774 IS_UNOP_MATCHER(TruncateInt64ToInt32) | 774 IS_UNOP_MATCHER(TruncateInt64ToInt32) |
| 775 IS_UNOP_MATCHER(Float64Sqrt) | 775 IS_UNOP_MATCHER(Float64Sqrt) |
| 776 #undef IS_UNOP_MATCHER | 776 #undef IS_UNOP_MATCHER |
| 777 | 777 |
| 778 } // namespace compiler | 778 } // namespace compiler |
| 779 } // namespace internal | 779 } // namespace internal |
| 780 } // namespace v8 | 780 } // namespace v8 |
| OLD | NEW |