| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/machine-graph-verifier.h" | 5 #include "src/compiler/machine-graph-verifier.h" |
| 6 | 6 |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 break; | 439 break; |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 | 444 |
| 445 private: | 445 private: |
| 446 void CheckValueInputRepresentationIs(Node const* node, int index, | 446 void CheckValueInputRepresentationIs(Node const* node, int index, |
| 447 MachineRepresentation representation) { | 447 MachineRepresentation representation) { |
| 448 Node const* input = node->InputAt(index); | 448 Node const* input = node->InputAt(index); |
| 449 if (inferrer_->GetRepresentation(input) != representation) { | 449 MachineRepresentation input_representation = |
| 450 inferrer_->GetRepresentation(input); |
| 451 if (input_representation != representation) { |
| 450 std::stringstream str; | 452 std::stringstream str; |
| 451 str << "TypeError: node #" << node->id() << ":" << *node->op() | 453 str << "TypeError: node #" << node->id() << ":" << *node->op() << ":" |
| 452 << " uses node #" << input->id() << ":" << *input->op() | 454 << MachineReprToString(input_representation) << " uses node #" |
| 453 << " which doesn't have a " << MachineReprToString(representation) | 455 << input->id() << ":" << *input->op() << " which doesn't have a " |
| 454 << " representation."; | 456 << MachineReprToString(representation) << " representation."; |
| 455 FATAL(str.str().c_str()); | 457 FATAL(str.str().c_str()); |
| 456 } | 458 } |
| 457 } | 459 } |
| 458 | 460 |
| 459 void CheckValueInputIsTagged(Node const* node, int index) { | 461 void CheckValueInputIsTagged(Node const* node, int index) { |
| 460 Node const* input = node->InputAt(index); | 462 Node const* input = node->InputAt(index); |
| 461 switch (inferrer_->GetRepresentation(input)) { | 463 switch (inferrer_->GetRepresentation(input)) { |
| 462 case MachineRepresentation::kTagged: | 464 case MachineRepresentation::kTagged: |
| 463 case MachineRepresentation::kTaggedPointer: | 465 case MachineRepresentation::kTaggedPointer: |
| 464 case MachineRepresentation::kTaggedSigned: | 466 case MachineRepresentation::kTaggedSigned: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 } | 515 } |
| 514 std::ostringstream str; | 516 std::ostringstream str; |
| 515 str << "TypeError: node #" << node->id() << ":" << *node->op() | 517 str << "TypeError: node #" << node->id() << ":" << *node->op() |
| 516 << " uses node #" << input->id() << ":" << *input->op() | 518 << " uses node #" << input->id() << ":" << *input->op() |
| 517 << " which doesn't have an int32-compatible representation."; | 519 << " which doesn't have an int32-compatible representation."; |
| 518 FATAL(str.str().c_str()); | 520 FATAL(str.str().c_str()); |
| 519 } | 521 } |
| 520 | 522 |
| 521 void CheckValueInputForInt64Op(Node const* node, int index) { | 523 void CheckValueInputForInt64Op(Node const* node, int index) { |
| 522 Node const* input = node->InputAt(index); | 524 Node const* input = node->InputAt(index); |
| 523 switch (inferrer_->GetRepresentation(input)) { | 525 MachineRepresentation input_representation = |
| 526 inferrer_->GetRepresentation(input); |
| 527 switch (input_representation) { |
| 524 case MachineRepresentation::kWord64: | 528 case MachineRepresentation::kWord64: |
| 525 return; | 529 return; |
| 526 case MachineRepresentation::kNone: { | 530 case MachineRepresentation::kNone: { |
| 527 std::ostringstream str; | 531 std::ostringstream str; |
| 528 str << "TypeError: node #" << input->id() << ":" << *input->op() | 532 str << "TypeError: node #" << input->id() << ":" << *input->op() |
| 529 << " is untyped."; | 533 << " is untyped."; |
| 530 FATAL(str.str().c_str()); | 534 FATAL(str.str().c_str()); |
| 531 break; | 535 break; |
| 532 } | 536 } |
| 533 | 537 |
| 534 default: | 538 default: |
| 535 break; | 539 break; |
| 536 } | 540 } |
| 537 std::ostringstream str; | 541 std::ostringstream str; |
| 538 str << "TypeError: node #" << node->id() << ":" << *node->op() | 542 str << "TypeError: node #" << node->id() << ":" << *node->op() << ":" |
| 539 << " uses node #" << input->id() << ":" << *input->op() | 543 << input_representation << " uses node #" << input->id() << ":" |
| 540 << " which doesn't have a kWord64 representation."; | 544 << *input->op() << " which doesn't have a kWord64 representation."; |
| 541 FATAL(str.str().c_str()); | 545 FATAL(str.str().c_str()); |
| 542 } | 546 } |
| 543 | 547 |
| 544 void CheckValueInputForFloat32Op(Node const* node, int index) { | 548 void CheckValueInputForFloat32Op(Node const* node, int index) { |
| 545 Node const* input = node->InputAt(index); | 549 Node const* input = node->InputAt(index); |
| 546 if (MachineRepresentation::kFloat32 == | 550 if (MachineRepresentation::kFloat32 == |
| 547 inferrer_->GetRepresentation(input)) { | 551 inferrer_->GetRepresentation(input)) { |
| 548 return; | 552 return; |
| 549 } | 553 } |
| 550 std::ostringstream str; | 554 std::ostringstream str; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 Linkage* linkage, Zone* temp_zone) { | 667 Linkage* linkage, Zone* temp_zone) { |
| 664 MachineRepresentationInferrer representation_inferrer(schedule, graph, | 668 MachineRepresentationInferrer representation_inferrer(schedule, graph, |
| 665 linkage, temp_zone); | 669 linkage, temp_zone); |
| 666 MachineRepresentationChecker checker(schedule, &representation_inferrer); | 670 MachineRepresentationChecker checker(schedule, &representation_inferrer); |
| 667 checker.Run(); | 671 checker.Run(); |
| 668 } | 672 } |
| 669 | 673 |
| 670 } // namespace compiler | 674 } // namespace compiler |
| 671 } // namespace internal | 675 } // namespace internal |
| 672 } // namespace v8 | 676 } // namespace v8 |
| OLD | NEW |