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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/node.h" | 7 #include "src/compiler/node.h" |
8 #include "src/compiler/operator.h" | 8 #include "src/compiler/operator.h" |
9 #include "test/unittests/compiler/graph-reducer-unittest.h" | 9 #include "test/unittests/compiler/graph-reducer-unittest.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 EXPECT_EQ(&kOpB1, nn2->op()); | 589 EXPECT_EQ(&kOpB1, nn2->op()); |
590 EXPECT_EQ(&kOpB1, nn3->op()); | 590 EXPECT_EQ(&kOpB1, nn3->op()); |
591 EXPECT_EQ(&kOpB2, nend->op()); | 591 EXPECT_EQ(&kOpB2, nend->op()); |
592 } | 592 } |
593 } | 593 } |
594 | 594 |
595 | 595 |
596 TEST_F(GraphReducerTest, Wrapping1) { | 596 TEST_F(GraphReducerTest, Wrapping1) { |
597 Node* end = graph()->NewNode(&kOpA0); | 597 Node* end = graph()->NewNode(&kOpA0); |
598 graph()->SetEnd(end); | 598 graph()->SetEnd(end); |
599 EXPECT_EQ(1, graph()->NodeCount()); | 599 EXPECT_EQ(1U, graph()->NodeCount()); |
600 | 600 |
601 A0Wrapper r(graph()); | 601 A0Wrapper r(graph()); |
602 | 602 |
603 ReduceGraph(&r); | 603 ReduceGraph(&r); |
604 EXPECT_EQ(2, graph()->NodeCount()); | 604 EXPECT_EQ(2U, graph()->NodeCount()); |
605 | 605 |
606 Node* nend = graph()->end(); | 606 Node* nend = graph()->end(); |
607 EXPECT_NE(end, nend); | 607 EXPECT_NE(end, nend); |
608 EXPECT_EQ(&kOpB1, nend->op()); | 608 EXPECT_EQ(&kOpB1, nend->op()); |
609 EXPECT_EQ(1, nend->InputCount()); | 609 EXPECT_EQ(1, nend->InputCount()); |
610 EXPECT_EQ(end, nend->InputAt(0)); | 610 EXPECT_EQ(end, nend->InputAt(0)); |
611 } | 611 } |
612 | 612 |
613 | 613 |
614 TEST_F(GraphReducerTest, Wrapping2) { | 614 TEST_F(GraphReducerTest, Wrapping2) { |
615 Node* end = graph()->NewNode(&kOpB0); | 615 Node* end = graph()->NewNode(&kOpB0); |
616 graph()->SetEnd(end); | 616 graph()->SetEnd(end); |
617 EXPECT_EQ(1, graph()->NodeCount()); | 617 EXPECT_EQ(1U, graph()->NodeCount()); |
618 | 618 |
619 B0Wrapper r(graph()); | 619 B0Wrapper r(graph()); |
620 | 620 |
621 ReduceGraph(&r); | 621 ReduceGraph(&r); |
622 EXPECT_EQ(3, graph()->NodeCount()); | 622 EXPECT_EQ(3U, graph()->NodeCount()); |
623 | 623 |
624 Node* nend = graph()->end(); | 624 Node* nend = graph()->end(); |
625 EXPECT_NE(end, nend); | 625 EXPECT_NE(end, nend); |
626 EXPECT_EQ(&kOpC1, nend->op()); | 626 EXPECT_EQ(&kOpC1, nend->op()); |
627 EXPECT_EQ(1, nend->InputCount()); | 627 EXPECT_EQ(1, nend->InputCount()); |
628 | 628 |
629 Node* n1 = nend->InputAt(0); | 629 Node* n1 = nend->InputAt(0); |
630 EXPECT_NE(end, n1); | 630 EXPECT_NE(end, n1); |
631 EXPECT_EQ(&kOpC1, n1->op()); | 631 EXPECT_EQ(&kOpC1, n1->op()); |
632 EXPECT_EQ(1, n1->InputCount()); | 632 EXPECT_EQ(1, n1->InputCount()); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 EXPECT_EQ(&kOpC0, n1->op()); | 850 EXPECT_EQ(&kOpC0, n1->op()); |
851 EXPECT_EQ(&kOpC1, end->op()); | 851 EXPECT_EQ(&kOpC1, end->op()); |
852 EXPECT_EQ(n1, end->InputAt(0)); | 852 EXPECT_EQ(n1, end->InputAt(0)); |
853 } | 853 } |
854 } | 854 } |
855 } | 855 } |
856 | 856 |
857 } // namespace compiler | 857 } // namespace compiler |
858 } // namespace internal | 858 } // namespace internal |
859 } // namespace v8 | 859 } // namespace v8 |
OLD | NEW |