| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <functional> | 5 #include <functional> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "graph-tester.h" | 9 #include "graph-tester.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 CHECK_EQ(2, n2->InputCount()); | 661 CHECK_EQ(2, n2->InputCount()); |
| 662 CHECK_EQ(2, n0->UseCount()); | 662 CHECK_EQ(2, n0->UseCount()); |
| 663 n2->TrimInputCount(0); | 663 n2->TrimInputCount(0); |
| 664 CHECK_EQ(0, n2->InputCount()); | 664 CHECK_EQ(0, n2->InputCount()); |
| 665 CHECK_EQ(0, n0->UseCount()); | 665 CHECK_EQ(0, n0->UseCount()); |
| 666 CHECK_EQ(0, n2->UseCount()); | 666 CHECK_EQ(0, n2->UseCount()); |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 | 669 |
| 670 | 670 |
| 671 TEST(RemoveAllInputs) { | 671 TEST(NullAllInputs) { |
| 672 GraphTester graph; | 672 GraphTester graph; |
| 673 | 673 |
| 674 for (int i = 0; i < 2; i++) { | 674 for (int i = 0; i < 2; i++) { |
| 675 Node* n0 = graph.NewNode(&dummy_operator); | 675 Node* n0 = graph.NewNode(&dummy_operator); |
| 676 Node* n1 = graph.NewNode(&dummy_operator, n0); | 676 Node* n1 = graph.NewNode(&dummy_operator, n0); |
| 677 Node* n2; | 677 Node* n2; |
| 678 if (i == 0) { | 678 if (i == 0) { |
| 679 n2 = graph.NewNode(&dummy_operator, n0, n1); | 679 n2 = graph.NewNode(&dummy_operator, n0, n1); |
| 680 CHECK_INPUTS(n2, n0, n1); | 680 CHECK_INPUTS(n2, n0, n1); |
| 681 } else { | 681 } else { |
| 682 n2 = graph.NewNode(&dummy_operator, n0); | 682 n2 = graph.NewNode(&dummy_operator, n0); |
| 683 CHECK_INPUTS(n2, n0); | 683 CHECK_INPUTS(n2, n0); |
| 684 n2->AppendInput(graph.zone(), n1); // with out-of-line input. | 684 n2->AppendInput(graph.zone(), n1); // with out-of-line input. |
| 685 CHECK_INPUTS(n2, n0, n1); | 685 CHECK_INPUTS(n2, n0, n1); |
| 686 } | 686 } |
| 687 | 687 |
| 688 n0->RemoveAllInputs(); | 688 n0->NullAllInputs(); |
| 689 CHECK_INPUTS(n0, NONE); | 689 CHECK_INPUTS(n0, NONE); |
| 690 | 690 |
| 691 CHECK_USES(n0, n1, n2); | 691 CHECK_USES(n0, n1, n2); |
| 692 n1->RemoveAllInputs(); | 692 n1->NullAllInputs(); |
| 693 CHECK_INPUTS(n1, NULL); | 693 CHECK_INPUTS(n1, NULL); |
| 694 CHECK_INPUTS(n2, n0, n1); | 694 CHECK_INPUTS(n2, n0, n1); |
| 695 CHECK_USES(n0, n2); | 695 CHECK_USES(n0, n2); |
| 696 | 696 |
| 697 n2->RemoveAllInputs(); | 697 n2->NullAllInputs(); |
| 698 CHECK_INPUTS(n1, NULL); | 698 CHECK_INPUTS(n1, NULL); |
| 699 CHECK_INPUTS(n2, NULL, NULL); | 699 CHECK_INPUTS(n2, NULL, NULL); |
| 700 CHECK_USES(n0, NONE); | 700 CHECK_USES(n0, NONE); |
| 701 } | 701 } |
| 702 | 702 |
| 703 { | 703 { |
| 704 Node* n0 = graph.NewNode(&dummy_operator); | 704 Node* n0 = graph.NewNode(&dummy_operator); |
| 705 Node* n1 = graph.NewNode(&dummy_operator, n0); | 705 Node* n1 = graph.NewNode(&dummy_operator, n0); |
| 706 n1->ReplaceInput(0, n1); // self-reference. | 706 n1->ReplaceInput(0, n1); // self-reference. |
| 707 | 707 |
| 708 CHECK_INPUTS(n0, NONE); | 708 CHECK_INPUTS(n0, NONE); |
| 709 CHECK_INPUTS(n1, n1); | 709 CHECK_INPUTS(n1, n1); |
| 710 CHECK_USES(n0, NONE); | 710 CHECK_USES(n0, NONE); |
| 711 CHECK_USES(n1, n1); | 711 CHECK_USES(n1, n1); |
| 712 n1->RemoveAllInputs(); | 712 n1->NullAllInputs(); |
| 713 | 713 |
| 714 CHECK_INPUTS(n0, NONE); | 714 CHECK_INPUTS(n0, NONE); |
| 715 CHECK_INPUTS(n1, NULL); | 715 CHECK_INPUTS(n1, NULL); |
| 716 CHECK_USES(n0, NONE); | 716 CHECK_USES(n0, NONE); |
| 717 CHECK_USES(n1, NONE); | 717 CHECK_USES(n1, NONE); |
| 718 } | 718 } |
| 719 } | 719 } |
| 720 | 720 |
| 721 | 721 |
| 722 TEST(AppendAndTrim) { | 722 TEST(AppendAndTrim) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 748 CheckInputs(last, nodes, i); | 748 CheckInputs(last, nodes, i); |
| 749 | 749 |
| 750 for (int j = 0; j < i; j++) { | 750 for (int j = 0; j < i; j++) { |
| 751 if (j < i) CHECK_USES(nodes[j], last); | 751 if (j < i) CHECK_USES(nodes[j], last); |
| 752 if (j >= i) CHECK_USES(nodes[j], NONE); | 752 if (j >= i) CHECK_USES(nodes[j], NONE); |
| 753 } | 753 } |
| 754 | 754 |
| 755 CHECK_USES(last, NONE); | 755 CHECK_USES(last, NONE); |
| 756 } | 756 } |
| 757 } | 757 } |
| OLD | NEW |