| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
| 8 #include "src/compiler/graph-visualizer.h" | 8 #include "src/compiler/graph-visualizer.h" |
| 9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 Node* ret2 = | 666 Node* ret2 = |
| 667 graph()->NewNode(common()->Return(), p5, graph()->start(), false_branch); | 667 graph()->NewNode(common()->Return(), p5, graph()->start(), false_branch); |
| 668 Node* merge = graph()->NewNode(common()->Merge(2), ret1, ret2); | 668 Node* merge = graph()->NewNode(common()->Merge(2), ret1, ret2); |
| 669 graph()->SetEnd(graph()->NewNode(common()->End(), merge)); | 669 graph()->SetEnd(graph()->NewNode(common()->End(), merge)); |
| 670 | 670 |
| 671 ComputeAndVerifySchedule(13); | 671 ComputeAndVerifySchedule(13); |
| 672 } | 672 } |
| 673 | 673 |
| 674 | 674 |
| 675 TEST_F(SchedulerTest, BuildScheduleIfSplitWithEffects) { | 675 TEST_F(SchedulerTest, BuildScheduleIfSplitWithEffects) { |
| 676 FLAG_turbo_deoptimization = false; |
| 677 |
| 676 const Operator* op; | 678 const Operator* op; |
| 677 | 679 |
| 678 // Manually transcripted code for: | 680 // Manually transcripted code for: |
| 679 // function turbo_fan_test(a, b, c, y) { | 681 // function turbo_fan_test(a, b, c, y) { |
| 680 // if (a < b) { | 682 // if (a < b) { |
| 681 // return a + b - c * c - a + y; | 683 // return a + b - c * c - a + y; |
| 682 // } else { | 684 // } else { |
| 683 // return c * c - a; | 685 // return c * c - a; |
| 684 // } | 686 // } |
| 685 // } | 687 // } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 n23->ReplaceInput(0, n22); | 804 n23->ReplaceInput(0, n22); |
| 803 | 805 |
| 804 graph()->SetStart(n0); | 806 graph()->SetStart(n0); |
| 805 graph()->SetEnd(n23); | 807 graph()->SetEnd(n23); |
| 806 | 808 |
| 807 ComputeAndVerifySchedule(20); | 809 ComputeAndVerifySchedule(20); |
| 808 } | 810 } |
| 809 | 811 |
| 810 | 812 |
| 811 TEST_F(SchedulerTest, BuildScheduleSimpleLoop) { | 813 TEST_F(SchedulerTest, BuildScheduleSimpleLoop) { |
| 814 FLAG_turbo_deoptimization = false; |
| 815 |
| 812 const Operator* op; | 816 const Operator* op; |
| 813 | 817 |
| 814 // Manually transcripted code for: | 818 // Manually transcripted code for: |
| 815 // function turbo_fan_test(a, b) { | 819 // function turbo_fan_test(a, b) { |
| 816 // while (a < b) { | 820 // while (a < b) { |
| 817 // a++; | 821 // a++; |
| 818 // } | 822 // } |
| 819 // return a; | 823 // return a; |
| 820 // } | 824 // } |
| 821 op = common()->Start(0); | 825 op = common()->Start(0); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 n20->ReplaceInput(0, n19); | 909 n20->ReplaceInput(0, n19); |
| 906 | 910 |
| 907 graph()->SetStart(n0); | 911 graph()->SetStart(n0); |
| 908 graph()->SetEnd(n20); | 912 graph()->SetEnd(n20); |
| 909 | 913 |
| 910 ComputeAndVerifySchedule(19); | 914 ComputeAndVerifySchedule(19); |
| 911 } | 915 } |
| 912 | 916 |
| 913 | 917 |
| 914 TEST_F(SchedulerTest, BuildScheduleComplexLoops) { | 918 TEST_F(SchedulerTest, BuildScheduleComplexLoops) { |
| 919 FLAG_turbo_deoptimization = false; |
| 920 |
| 915 const Operator* op; | 921 const Operator* op; |
| 916 | 922 |
| 917 // Manually transcripted code for: | 923 // Manually transcripted code for: |
| 918 // function turbo_fan_test(a, b, c) { | 924 // function turbo_fan_test(a, b, c) { |
| 919 // while (a < b) { | 925 // while (a < b) { |
| 920 // a++; | 926 // a++; |
| 921 // while (c < b) { | 927 // while (c < b) { |
| 922 // c++; | 928 // c++; |
| 923 // } | 929 // } |
| 924 // } | 930 // } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 n46->ReplaceInput(0, n45); | 1149 n46->ReplaceInput(0, n45); |
| 1144 | 1150 |
| 1145 graph()->SetStart(n0); | 1151 graph()->SetStart(n0); |
| 1146 graph()->SetEnd(n46); | 1152 graph()->SetEnd(n46); |
| 1147 | 1153 |
| 1148 ComputeAndVerifySchedule(46); | 1154 ComputeAndVerifySchedule(46); |
| 1149 } | 1155 } |
| 1150 | 1156 |
| 1151 | 1157 |
| 1152 TEST_F(SchedulerTest, BuildScheduleBreakAndContinue) { | 1158 TEST_F(SchedulerTest, BuildScheduleBreakAndContinue) { |
| 1159 FLAG_turbo_deoptimization = false; |
| 1160 |
| 1153 const Operator* op; | 1161 const Operator* op; |
| 1154 | 1162 |
| 1155 // Manually transcripted code for: | 1163 // Manually transcripted code for: |
| 1156 // function turbo_fan_test(a, b, c) { | 1164 // function turbo_fan_test(a, b, c) { |
| 1157 // var d = 0; | 1165 // var d = 0; |
| 1158 // while (a < b) { | 1166 // while (a < b) { |
| 1159 // a++; | 1167 // a++; |
| 1160 // while (c < b) { | 1168 // while (c < b) { |
| 1161 // c++; | 1169 // c++; |
| 1162 // if (d == 0) break; | 1170 // if (d == 0) break; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 n58->ReplaceInput(0, n57); | 1471 n58->ReplaceInput(0, n57); |
| 1464 | 1472 |
| 1465 graph()->SetStart(n0); | 1473 graph()->SetStart(n0); |
| 1466 graph()->SetEnd(n58); | 1474 graph()->SetEnd(n58); |
| 1467 | 1475 |
| 1468 ComputeAndVerifySchedule(62); | 1476 ComputeAndVerifySchedule(62); |
| 1469 } | 1477 } |
| 1470 | 1478 |
| 1471 | 1479 |
| 1472 TEST_F(SchedulerTest, BuildScheduleSimpleLoopWithCodeMotion) { | 1480 TEST_F(SchedulerTest, BuildScheduleSimpleLoopWithCodeMotion) { |
| 1481 FLAG_turbo_deoptimization = false; |
| 1482 |
| 1473 const Operator* op; | 1483 const Operator* op; |
| 1474 | 1484 |
| 1475 // Manually transcripted code for: | 1485 // Manually transcripted code for: |
| 1476 // function turbo_fan_test(a, b, c) { | 1486 // function turbo_fan_test(a, b, c) { |
| 1477 // while (a < b) { | 1487 // while (a < b) { |
| 1478 // a += b + c; | 1488 // a += b + c; |
| 1479 // } | 1489 // } |
| 1480 // return a; | 1490 // return a; |
| 1481 // } | 1491 // } |
| 1482 op = common()->Start(0); | 1492 op = common()->Start(0); |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 Node* end = graph()->NewNode(common()->End(), ret); | 2040 Node* end = graph()->NewNode(common()->End(), ret); |
| 2031 | 2041 |
| 2032 graph()->SetEnd(end); | 2042 graph()->SetEnd(end); |
| 2033 | 2043 |
| 2034 ComputeAndVerifySchedule(16); | 2044 ComputeAndVerifySchedule(16); |
| 2035 } | 2045 } |
| 2036 | 2046 |
| 2037 } // namespace compiler | 2047 } // namespace compiler |
| 2038 } // namespace internal | 2048 } // namespace internal |
| 2039 } // namespace v8 | 2049 } // namespace v8 |
| OLD | NEW |