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 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 ComputeAndVerifySchedule(62, &graph); | 1502 ComputeAndVerifySchedule(62, &graph); |
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; |
1513 const 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; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 graph.SetEnd(end); | 1661 graph.SetEnd(end); |
1662 | 1662 |
1663 ComputeAndVerifySchedule(13, &graph); | 1663 ComputeAndVerifySchedule(13, &graph); |
1664 } | 1664 } |
1665 | 1665 |
1666 | 1666 |
1667 TEST(FloatingDiamond2) { | 1667 TEST(FloatingDiamond2) { |
1668 HandleAndZoneScope scope; | 1668 HandleAndZoneScope scope; |
1669 Graph graph(scope.main_zone()); | 1669 Graph graph(scope.main_zone()); |
1670 CommonOperatorBuilder common(scope.main_zone()); | 1670 CommonOperatorBuilder common(scope.main_zone()); |
1671 MachineOperatorBuilder machine(scope.main_zone()); | 1671 MachineOperatorBuilder machine; |
1672 | 1672 |
1673 Node* start = graph.NewNode(common.Start(2)); | 1673 Node* start = graph.NewNode(common.Start(2)); |
1674 graph.SetStart(start); | 1674 graph.SetStart(start); |
1675 | 1675 |
1676 Node* p0 = graph.NewNode(common.Parameter(0), start); | 1676 Node* p0 = graph.NewNode(common.Parameter(0), start); |
1677 Node* p1 = graph.NewNode(common.Parameter(1), start); | 1677 Node* p1 = graph.NewNode(common.Parameter(1), start); |
1678 Node* d1 = CreateDiamond(&graph, &common, p0); | 1678 Node* d1 = CreateDiamond(&graph, &common, p0); |
1679 Node* d2 = CreateDiamond(&graph, &common, p1); | 1679 Node* d2 = CreateDiamond(&graph, &common, p1); |
1680 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); | 1680 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); |
1681 Node* ret = graph.NewNode(common.Return(), add, start, start); | 1681 Node* ret = graph.NewNode(common.Return(), add, start, start); |
1682 Node* end = graph.NewNode(common.End(), ret, start); | 1682 Node* end = graph.NewNode(common.End(), ret, start); |
1683 | 1683 |
1684 graph.SetEnd(end); | 1684 graph.SetEnd(end); |
1685 | 1685 |
1686 ComputeAndVerifySchedule(24, &graph); | 1686 ComputeAndVerifySchedule(24, &graph); |
1687 } | 1687 } |
1688 | 1688 |
1689 | 1689 |
1690 TEST(FloatingDiamond3) { | 1690 TEST(FloatingDiamond3) { |
1691 HandleAndZoneScope scope; | 1691 HandleAndZoneScope scope; |
1692 Graph graph(scope.main_zone()); | 1692 Graph graph(scope.main_zone()); |
1693 CommonOperatorBuilder common(scope.main_zone()); | 1693 CommonOperatorBuilder common(scope.main_zone()); |
1694 MachineOperatorBuilder machine(scope.main_zone()); | 1694 MachineOperatorBuilder machine; |
1695 | 1695 |
1696 Node* start = graph.NewNode(common.Start(2)); | 1696 Node* start = graph.NewNode(common.Start(2)); |
1697 graph.SetStart(start); | 1697 graph.SetStart(start); |
1698 | 1698 |
1699 Node* p0 = graph.NewNode(common.Parameter(0), start); | 1699 Node* p0 = graph.NewNode(common.Parameter(0), start); |
1700 Node* p1 = graph.NewNode(common.Parameter(1), start); | 1700 Node* p1 = graph.NewNode(common.Parameter(1), start); |
1701 Node* d1 = CreateDiamond(&graph, &common, p0); | 1701 Node* d1 = CreateDiamond(&graph, &common, p0); |
1702 Node* d2 = CreateDiamond(&graph, &common, p1); | 1702 Node* d2 = CreateDiamond(&graph, &common, p1); |
1703 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); | 1703 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); |
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 |