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/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/generic-node-inl.h" | 10 #include "src/compiler/generic-node-inl.h" |
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1795 | 1795 |
1796 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); | 1796 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); |
1797 Node* end = graph.NewNode(common.End(), ret, start); | 1797 Node* end = graph.NewNode(common.End(), ret, start); |
1798 | 1798 |
1799 graph.SetEnd(end); | 1799 graph.SetEnd(end); |
1800 | 1800 |
1801 ComputeAndVerifySchedule(23, &graph); | 1801 ComputeAndVerifySchedule(23, &graph); |
1802 } | 1802 } |
1803 | 1803 |
1804 | 1804 |
| 1805 TEST(LoopedFloatingDiamond) { |
| 1806 HandleAndZoneScope scope; |
| 1807 Graph graph(scope.main_zone()); |
| 1808 CommonOperatorBuilder common(scope.main_zone()); |
| 1809 SimplifiedOperatorBuilder simplified(scope.main_zone()); |
| 1810 MachineOperatorBuilder machine; |
| 1811 |
| 1812 Node* start = graph.NewNode(common.Start(2)); |
| 1813 graph.SetStart(start); |
| 1814 |
| 1815 Node* p0 = graph.NewNode(common.Parameter(0), start); |
| 1816 |
| 1817 Node* c = graph.NewNode(common.Int32Constant(7)); |
| 1818 Node* loop = graph.NewNode(common.Loop(2), start, start); |
| 1819 Node* ind = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p0, loop); |
| 1820 Node* add = graph.NewNode(machine.IntAdd(), ind, c); |
| 1821 |
| 1822 Node* br = graph.NewNode(common.Branch(), add, loop); |
| 1823 Node* t = graph.NewNode(common.IfTrue(), br); |
| 1824 Node* f = graph.NewNode(common.IfFalse(), br); |
| 1825 |
| 1826 Node* br1 = graph.NewNode(common.Branch(), p0, graph.start()); |
| 1827 Node* t1 = graph.NewNode(common.IfTrue(), br1); |
| 1828 Node* f1 = graph.NewNode(common.IfFalse(), br1); |
| 1829 Node* m1 = graph.NewNode(common.Merge(2), t1, f1); |
| 1830 Node* phi1 = graph.NewNode(common.Phi(kMachAnyTagged, 2), add, p0, m1); |
| 1831 |
| 1832 loop->ReplaceInput(1, t); // close loop. |
| 1833 ind->ReplaceInput(1, phi1); // close induction variable. |
| 1834 |
| 1835 Node* ret = graph.NewNode(common.Return(), ind, start, f); |
| 1836 Node* end = graph.NewNode(common.End(), ret, f); |
| 1837 |
| 1838 graph.SetEnd(end); |
| 1839 |
| 1840 ComputeAndVerifySchedule(20, &graph); |
| 1841 } |
| 1842 |
| 1843 |
1805 TEST(PhisPushedDownToDifferentBranches) { | 1844 TEST(PhisPushedDownToDifferentBranches) { |
1806 HandleAndZoneScope scope; | 1845 HandleAndZoneScope scope; |
1807 Graph graph(scope.main_zone()); | 1846 Graph graph(scope.main_zone()); |
1808 CommonOperatorBuilder common(scope.main_zone()); | 1847 CommonOperatorBuilder common(scope.main_zone()); |
1809 SimplifiedOperatorBuilder simplified(scope.main_zone()); | 1848 SimplifiedOperatorBuilder simplified(scope.main_zone()); |
1810 MachineOperatorBuilder machine; | 1849 MachineOperatorBuilder machine; |
1811 | 1850 |
1812 Node* start = graph.NewNode(common.Start(2)); | 1851 Node* start = graph.NewNode(common.Start(2)); |
1813 graph.SetStart(start); | 1852 graph.SetStart(start); |
1814 | 1853 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 graph.SetEnd(end); | 1956 graph.SetEnd(end); |
1918 | 1957 |
1919 Schedule* schedule = ComputeAndVerifySchedule(5, &graph); | 1958 Schedule* schedule = ComputeAndVerifySchedule(5, &graph); |
1920 BasicBlock* block = schedule->block(loop); | 1959 BasicBlock* block = schedule->block(loop); |
1921 CHECK_NE(NULL, loop); | 1960 CHECK_NE(NULL, loop); |
1922 CHECK_EQ(block, schedule->block(effect)); | 1961 CHECK_EQ(block, schedule->block(effect)); |
1923 CHECK_GE(block->rpo_number(), 0); | 1962 CHECK_GE(block->rpo_number(), 0); |
1924 } | 1963 } |
1925 | 1964 |
1926 #endif | 1965 #endif |
OLD | NEW |