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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 483 |
484 TEST(Sorter1) { | 484 TEST(Sorter1) { |
485 HandleAndZoneScope scope; | 485 HandleAndZoneScope scope; |
486 AB2Sorter r; | 486 AB2Sorter r; |
487 for (int i = 0; i < 6; i++) { | 487 for (int i = 0; i < 6; i++) { |
488 GraphTester graph; | 488 GraphTester graph; |
489 | 489 |
490 Node* n1 = graph.NewNode(&OPA0); | 490 Node* n1 = graph.NewNode(&OPA0); |
491 Node* n2 = graph.NewNode(&OPA1, n1); | 491 Node* n2 = graph.NewNode(&OPA1, n1); |
492 Node* n3 = graph.NewNode(&OPA1, n1); | 492 Node* n3 = graph.NewNode(&OPA1, n1); |
493 Node* end; | 493 Node* end = NULL; // Initialize to please the compiler. |
494 | 494 |
495 if (i == 0) end = graph.NewNode(&OPA2, n2, n3); | 495 if (i == 0) end = graph.NewNode(&OPA2, n2, n3); |
496 if (i == 1) end = graph.NewNode(&OPA2, n3, n2); | 496 if (i == 1) end = graph.NewNode(&OPA2, n3, n2); |
497 if (i == 2) end = graph.NewNode(&OPA2, n2, n1); | 497 if (i == 2) end = graph.NewNode(&OPA2, n2, n1); |
498 if (i == 3) end = graph.NewNode(&OPA2, n1, n2); | 498 if (i == 3) end = graph.NewNode(&OPA2, n1, n2); |
499 if (i == 4) end = graph.NewNode(&OPA2, n3, n1); | 499 if (i == 4) end = graph.NewNode(&OPA2, n3, n1); |
500 if (i == 5) end = graph.NewNode(&OPA2, n1, n3); | 500 if (i == 5) end = graph.NewNode(&OPA2, n1, n3); |
501 | 501 |
502 graph.SetEnd(end); | 502 graph.SetEnd(end); |
503 | 503 |
(...skipping 148 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 |