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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "graph-tester.h" | 7 #include "graph-tester.h" |
8 #include "src/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
10 | 10 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 B1Forwarder f; | 463 B1Forwarder f; |
464 reducer.AddReducer(&r); | 464 reducer.AddReducer(&r); |
465 reducer.AddReducer(&f); | 465 reducer.AddReducer(&f); |
466 | 466 |
467 // Tests first reducing A => B, then B1(x) => x. | 467 // Tests first reducing A => B, then B1(x) => x. |
468 for (int i = 0; i < 3; i++) { | 468 for (int i = 0; i < 3; i++) { |
469 int before = graph.NodeCount(); | 469 int before = graph.NodeCount(); |
470 reducer.ReduceGraph(); | 470 reducer.ReduceGraph(); |
471 CHECK_EQ(before, graph.NodeCount()); | 471 CHECK_EQ(before, graph.NodeCount()); |
472 CHECK_EQ(&OPB0, n1->op()); | 472 CHECK_EQ(&OPB0, n1->op()); |
473 CHECK_EQ(NULL, n2->op()); | 473 CHECK(n2->IsDead()); |
474 CHECK_EQ(n1, end->InputAt(0)); | 474 CHECK_EQ(n1, end->InputAt(0)); |
475 CHECK_EQ(NULL, n3->op()); | 475 CHECK(n3->IsDead()); |
476 CHECK_EQ(n1, end->InputAt(0)); | 476 CHECK_EQ(n1, end->InputAt(0)); |
477 CHECK_EQ(&OPB2, end->op()); | 477 CHECK_EQ(&OPB2, end->op()); |
478 CHECK_EQ(0, n2->UseCount()); | 478 CHECK_EQ(0, n2->UseCount()); |
479 CHECK_EQ(0, n3->UseCount()); | 479 CHECK_EQ(0, n3->UseCount()); |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 | 483 |
484 TEST(Sorter1) { | 484 TEST(Sorter1) { |
485 HandleAndZoneScope scope; | 485 HandleAndZoneScope scope; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 reducer.AddReducer(&once); | 652 reducer.AddReducer(&once); |
653 | 653 |
654 // Tests A* => B* with in-place updates. Should only be applied once. | 654 // Tests A* => B* with in-place updates. Should only be applied once. |
655 int before = graph.NodeCount(); | 655 int before = graph.NodeCount(); |
656 reducer.ReduceGraph(); | 656 reducer.ReduceGraph(); |
657 CHECK_EQ(before, graph.NodeCount()); | 657 CHECK_EQ(before, graph.NodeCount()); |
658 CHECK_EQ(&OPB0, n1->op()); | 658 CHECK_EQ(&OPB0, n1->op()); |
659 CHECK_EQ(&OPB1, end->op()); | 659 CHECK_EQ(&OPB1, end->op()); |
660 CHECK_EQ(n1, end->InputAt(0)); | 660 CHECK_EQ(n1, end->InputAt(0)); |
661 } | 661 } |
OLD | NEW |