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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1809 | 1809 |
1810 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); | 1810 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); |
1811 Node* end = graph.NewNode(common.End(), ret, start); | 1811 Node* end = graph.NewNode(common.End(), ret, start); |
1812 | 1812 |
1813 graph.SetEnd(end); | 1813 graph.SetEnd(end); |
1814 | 1814 |
1815 ComputeAndVerifySchedule(23, &graph); | 1815 ComputeAndVerifySchedule(23, &graph); |
1816 } | 1816 } |
1817 | 1817 |
1818 | 1818 |
| 1819 TEST(NestedFloatingDiamondWithLoop) { |
| 1820 HandleAndZoneScope scope; |
| 1821 Graph graph(scope.main_zone()); |
| 1822 CommonOperatorBuilder common(scope.main_zone()); |
| 1823 SimplifiedOperatorBuilder simplified(scope.main_zone()); |
| 1824 MachineOperatorBuilder machine; |
| 1825 |
| 1826 Node* start = graph.NewNode(common.Start(2)); |
| 1827 graph.SetStart(start); |
| 1828 |
| 1829 Node* p0 = graph.NewNode(common.Parameter(0), start); |
| 1830 |
| 1831 Node* fv = graph.NewNode(common.Int32Constant(7)); |
| 1832 Node* br = graph.NewNode(common.Branch(), p0, graph.start()); |
| 1833 Node* t = graph.NewNode(common.IfTrue(), br); |
| 1834 Node* f = graph.NewNode(common.IfFalse(), br); |
| 1835 |
| 1836 Node* loop = graph.NewNode(common.Loop(2), f, start); |
| 1837 Node* ind = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p0, loop); |
| 1838 |
| 1839 // TODO(mstarzinger): Make scheduler deal with non-empty loops here. |
| 1840 // Node* add = graph.NewNode(machine.IntAdd(), ind, fv); |
| 1841 |
| 1842 Node* br1 = graph.NewNode(common.Branch(), ind, loop); |
| 1843 Node* t1 = graph.NewNode(common.IfTrue(), br1); |
| 1844 Node* f1 = graph.NewNode(common.IfFalse(), br1); |
| 1845 |
| 1846 loop->ReplaceInput(1, t1); // close loop. |
| 1847 ind->ReplaceInput(1, ind); // close induction variable. |
| 1848 |
| 1849 Node* m = graph.NewNode(common.Merge(2), t, f1); |
| 1850 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), fv, ind, m); |
| 1851 |
| 1852 Node* ret = graph.NewNode(common.Return(), phi, start, start); |
| 1853 Node* end = graph.NewNode(common.End(), ret, start); |
| 1854 |
| 1855 graph.SetEnd(end); |
| 1856 |
| 1857 ComputeAndVerifySchedule(19, &graph); |
| 1858 } |
| 1859 |
| 1860 |
1819 TEST(LoopedFloatingDiamond1) { | 1861 TEST(LoopedFloatingDiamond1) { |
1820 HandleAndZoneScope scope; | 1862 HandleAndZoneScope scope; |
1821 Graph graph(scope.main_zone()); | 1863 Graph graph(scope.main_zone()); |
1822 CommonOperatorBuilder common(scope.main_zone()); | 1864 CommonOperatorBuilder common(scope.main_zone()); |
1823 SimplifiedOperatorBuilder simplified(scope.main_zone()); | 1865 SimplifiedOperatorBuilder simplified(scope.main_zone()); |
1824 MachineOperatorBuilder machine; | 1866 MachineOperatorBuilder machine; |
1825 | 1867 |
1826 Node* start = graph.NewNode(common.Start(2)); | 1868 Node* start = graph.NewNode(common.Start(2)); |
1827 graph.SetStart(start); | 1869 graph.SetStart(start); |
1828 | 1870 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 graph.SetEnd(end); | 2052 graph.SetEnd(end); |
2011 | 2053 |
2012 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2054 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
2013 BasicBlock* block = schedule->block(loop); | 2055 BasicBlock* block = schedule->block(loop); |
2014 CHECK_NE(NULL, loop); | 2056 CHECK_NE(NULL, loop); |
2015 CHECK_EQ(block, schedule->block(effect)); | 2057 CHECK_EQ(block, schedule->block(effect)); |
2016 CHECK_GE(block->rpo_number(), 0); | 2058 CHECK_GE(block->rpo_number(), 0); |
2017 } | 2059 } |
2018 | 2060 |
2019 #endif | 2061 #endif |
OLD | NEW |