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 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 | 7 |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
10 #include "src/compiler/generic-node.h" | 10 #include "src/compiler/generic-node.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 ComputeAndVerifySchedule(13, &graph); | 669 ComputeAndVerifySchedule(13, &graph); |
670 } | 670 } |
671 | 671 |
672 | 672 |
673 TEST(BuildScheduleIfSplitWithEffects) { | 673 TEST(BuildScheduleIfSplitWithEffects) { |
674 HandleAndZoneScope scope; | 674 HandleAndZoneScope scope; |
675 Isolate* isolate = scope.main_isolate(); | 675 Isolate* isolate = scope.main_isolate(); |
676 Graph graph(scope.main_zone()); | 676 Graph graph(scope.main_zone()); |
677 CommonOperatorBuilder common_builder(scope.main_zone()); | 677 CommonOperatorBuilder common_builder(scope.main_zone()); |
678 JSOperatorBuilder js_builder(scope.main_zone()); | 678 JSOperatorBuilder js_builder(scope.main_zone()); |
679 Operator* op; | 679 const Operator* op; |
680 | 680 |
681 Handle<Object> object = | 681 Handle<Object> object = |
682 Handle<Object>(isolate->heap()->undefined_value(), isolate); | 682 Handle<Object>(isolate->heap()->undefined_value(), isolate); |
683 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); | 683 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); |
684 | 684 |
685 // Manually transcripted code for: | 685 // Manually transcripted code for: |
686 // function turbo_fan_test(a, b, c, y) { | 686 // function turbo_fan_test(a, b, c, y) { |
687 // if (a < b) { | 687 // if (a < b) { |
688 // return a + b - c * c - a + y; | 688 // return a + b - c * c - a + y; |
689 // } else { | 689 // } else { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 ComputeAndVerifySchedule(20, &graph); | 814 ComputeAndVerifySchedule(20, &graph); |
815 } | 815 } |
816 | 816 |
817 | 817 |
818 TEST(BuildScheduleSimpleLoop) { | 818 TEST(BuildScheduleSimpleLoop) { |
819 HandleAndZoneScope scope; | 819 HandleAndZoneScope scope; |
820 Isolate* isolate = scope.main_isolate(); | 820 Isolate* isolate = scope.main_isolate(); |
821 Graph graph(scope.main_zone()); | 821 Graph graph(scope.main_zone()); |
822 CommonOperatorBuilder common_builder(scope.main_zone()); | 822 CommonOperatorBuilder common_builder(scope.main_zone()); |
823 JSOperatorBuilder js_builder(scope.main_zone()); | 823 JSOperatorBuilder js_builder(scope.main_zone()); |
824 Operator* op; | 824 const Operator* op; |
825 | 825 |
826 Handle<Object> object = | 826 Handle<Object> object = |
827 Handle<Object>(isolate->heap()->undefined_value(), isolate); | 827 Handle<Object>(isolate->heap()->undefined_value(), isolate); |
828 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); | 828 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); |
829 | 829 |
830 // Manually transcripted code for: | 830 // Manually transcripted code for: |
831 // function turbo_fan_test(a, b) { | 831 // function turbo_fan_test(a, b) { |
832 // while (a < b) { | 832 // while (a < b) { |
833 // a++; | 833 // a++; |
834 // } | 834 // } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 ComputeAndVerifySchedule(19, &graph); | 926 ComputeAndVerifySchedule(19, &graph); |
927 } | 927 } |
928 | 928 |
929 | 929 |
930 TEST(BuildScheduleComplexLoops) { | 930 TEST(BuildScheduleComplexLoops) { |
931 HandleAndZoneScope scope; | 931 HandleAndZoneScope scope; |
932 Isolate* isolate = scope.main_isolate(); | 932 Isolate* isolate = scope.main_isolate(); |
933 Graph graph(scope.main_zone()); | 933 Graph graph(scope.main_zone()); |
934 CommonOperatorBuilder common_builder(scope.main_zone()); | 934 CommonOperatorBuilder common_builder(scope.main_zone()); |
935 JSOperatorBuilder js_builder(scope.main_zone()); | 935 JSOperatorBuilder js_builder(scope.main_zone()); |
936 Operator* op; | 936 const Operator* op; |
937 | 937 |
938 Handle<Object> object = | 938 Handle<Object> object = |
939 Handle<Object>(isolate->heap()->undefined_value(), isolate); | 939 Handle<Object>(isolate->heap()->undefined_value(), isolate); |
940 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); | 940 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); |
941 | 941 |
942 // Manually transcripted code for: | 942 // Manually transcripted code for: |
943 // function turbo_fan_test(a, b, c) { | 943 // function turbo_fan_test(a, b, c) { |
944 // while (a < b) { | 944 // while (a < b) { |
945 // a++; | 945 // a++; |
946 // while (c < b) { | 946 // while (c < b) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 ComputeAndVerifySchedule(46, &graph); | 1173 ComputeAndVerifySchedule(46, &graph); |
1174 } | 1174 } |
1175 | 1175 |
1176 | 1176 |
1177 TEST(BuildScheduleBreakAndContinue) { | 1177 TEST(BuildScheduleBreakAndContinue) { |
1178 HandleAndZoneScope scope; | 1178 HandleAndZoneScope scope; |
1179 Isolate* isolate = scope.main_isolate(); | 1179 Isolate* isolate = scope.main_isolate(); |
1180 Graph graph(scope.main_zone()); | 1180 Graph graph(scope.main_zone()); |
1181 CommonOperatorBuilder common_builder(scope.main_zone()); | 1181 CommonOperatorBuilder common_builder(scope.main_zone()); |
1182 JSOperatorBuilder js_builder(scope.main_zone()); | 1182 JSOperatorBuilder js_builder(scope.main_zone()); |
1183 Operator* op; | 1183 const Operator* op; |
1184 | 1184 |
1185 Handle<Object> object = | 1185 Handle<Object> object = |
1186 Handle<Object>(isolate->heap()->undefined_value(), isolate); | 1186 Handle<Object>(isolate->heap()->undefined_value(), isolate); |
1187 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); | 1187 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); |
1188 | 1188 |
1189 // Manually transcripted code for: | 1189 // Manually transcripted code for: |
1190 // function turbo_fan_test(a, b, c) { | 1190 // function turbo_fan_test(a, b, c) { |
1191 // var d = 0; | 1191 // var d = 0; |
1192 // while (a < b) { | 1192 // while (a < b) { |
1193 // a++; | 1193 // a++; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 } | 1503 } |
1504 | 1504 |
1505 | 1505 |
1506 TEST(BuildScheduleSimpleLoopWithCodeMotion) { | 1506 TEST(BuildScheduleSimpleLoopWithCodeMotion) { |
1507 HandleAndZoneScope scope; | 1507 HandleAndZoneScope scope; |
1508 Isolate* isolate = scope.main_isolate(); | 1508 Isolate* isolate = scope.main_isolate(); |
1509 Graph graph(scope.main_zone()); | 1509 Graph graph(scope.main_zone()); |
1510 CommonOperatorBuilder common_builder(scope.main_zone()); | 1510 CommonOperatorBuilder common_builder(scope.main_zone()); |
1511 JSOperatorBuilder js_builder(scope.main_zone()); | 1511 JSOperatorBuilder js_builder(scope.main_zone()); |
1512 MachineOperatorBuilder machine_builder(scope.main_zone()); | 1512 MachineOperatorBuilder machine_builder(scope.main_zone()); |
1513 Operator* op; | 1513 const Operator* op; |
1514 | 1514 |
1515 Handle<Object> object = | 1515 Handle<Object> object = |
1516 Handle<Object>(isolate->heap()->undefined_value(), isolate); | 1516 Handle<Object>(isolate->heap()->undefined_value(), isolate); |
1517 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); | 1517 Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object); |
1518 | 1518 |
1519 // Manually transcripted code for: | 1519 // Manually transcripted code for: |
1520 // function turbo_fan_test(a, b, c) { | 1520 // function turbo_fan_test(a, b, c) { |
1521 // while (a < b) { | 1521 // while (a < b) { |
1522 // a += b + c; | 1522 // a += b + c; |
1523 // } | 1523 // } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 Node* d3 = CreateDiamond(&graph, &common, add); | 1704 Node* d3 = CreateDiamond(&graph, &common, add); |
1705 Node* ret = graph.NewNode(common.Return(), d3, start, start); | 1705 Node* ret = graph.NewNode(common.Return(), d3, start, start); |
1706 Node* end = graph.NewNode(common.End(), ret, start); | 1706 Node* end = graph.NewNode(common.End(), ret, start); |
1707 | 1707 |
1708 graph.SetEnd(end); | 1708 graph.SetEnd(end); |
1709 | 1709 |
1710 ComputeAndVerifySchedule(33, &graph); | 1710 ComputeAndVerifySchedule(33, &graph); |
1711 } | 1711 } |
1712 | 1712 |
1713 #endif | 1713 #endif |
OLD | NEW |