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 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
(...skipping 1786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 | 1797 |
1798 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); | 1798 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start); |
1799 Node* end = graph.NewNode(common.End(), ret, start); | 1799 Node* end = graph.NewNode(common.End(), ret, start); |
1800 | 1800 |
1801 graph.SetEnd(end); | 1801 graph.SetEnd(end); |
1802 | 1802 |
1803 ComputeAndVerifySchedule(23, &graph); | 1803 ComputeAndVerifySchedule(23, &graph); |
1804 } | 1804 } |
1805 | 1805 |
1806 | 1806 |
| 1807 TEST(NestedFloatingDiamondWithChain) { |
| 1808 HandleAndZoneScope scope; |
| 1809 Graph graph(scope.main_zone()); |
| 1810 CommonOperatorBuilder common(scope.main_zone()); |
| 1811 |
| 1812 Node* start = graph.NewNode(common.Start(2)); |
| 1813 graph.SetStart(start); |
| 1814 |
| 1815 Node* p0 = graph.NewNode(common.Parameter(0), start); |
| 1816 Node* p1 = graph.NewNode(common.Parameter(1), start); |
| 1817 Node* c = graph.NewNode(common.Int32Constant(7)); |
| 1818 |
| 1819 Node* brA1 = graph.NewNode(common.Branch(), p0, graph.start()); |
| 1820 Node* tA1 = graph.NewNode(common.IfTrue(), brA1); |
| 1821 Node* fA1 = graph.NewNode(common.IfFalse(), brA1); |
| 1822 Node* mA1 = graph.NewNode(common.Merge(2), tA1, fA1); |
| 1823 Node* phiA1 = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p1, mA1); |
| 1824 |
| 1825 Node* brB1 = graph.NewNode(common.Branch(), p1, graph.start()); |
| 1826 Node* tB1 = graph.NewNode(common.IfTrue(), brB1); |
| 1827 Node* fB1 = graph.NewNode(common.IfFalse(), brB1); |
| 1828 Node* mB1 = graph.NewNode(common.Merge(2), tB1, fB1); |
| 1829 Node* phiB1 = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p1, mB1); |
| 1830 |
| 1831 Node* brA2 = graph.NewNode(common.Branch(), phiB1, mA1); |
| 1832 Node* tA2 = graph.NewNode(common.IfTrue(), brA2); |
| 1833 Node* fA2 = graph.NewNode(common.IfFalse(), brA2); |
| 1834 Node* mA2 = graph.NewNode(common.Merge(2), tA2, fA2); |
| 1835 Node* phiA2 = graph.NewNode(common.Phi(kMachAnyTagged, 2), phiB1, c, mA2); |
| 1836 |
| 1837 Node* brB2 = graph.NewNode(common.Branch(), phiA1, mB1); |
| 1838 Node* tB2 = graph.NewNode(common.IfTrue(), brB2); |
| 1839 Node* fB2 = graph.NewNode(common.IfFalse(), brB2); |
| 1840 Node* mB2 = graph.NewNode(common.Merge(2), tB2, fB2); |
| 1841 Node* phiB2 = graph.NewNode(common.Phi(kMachAnyTagged, 2), phiA1, c, mB2); |
| 1842 |
| 1843 Node* add = graph.NewNode(&kIntAdd, phiA2, phiB2); |
| 1844 Node* ret = graph.NewNode(common.Return(), add, start, start); |
| 1845 Node* end = graph.NewNode(common.End(), ret, start); |
| 1846 |
| 1847 graph.SetEnd(end); |
| 1848 |
| 1849 ComputeAndVerifySchedule(35, &graph); |
| 1850 } |
| 1851 |
| 1852 |
1807 TEST(NestedFloatingDiamondWithLoop) { | 1853 TEST(NestedFloatingDiamondWithLoop) { |
1808 HandleAndZoneScope scope; | 1854 HandleAndZoneScope scope; |
1809 Graph graph(scope.main_zone()); | 1855 Graph graph(scope.main_zone()); |
1810 CommonOperatorBuilder common(scope.main_zone()); | 1856 CommonOperatorBuilder common(scope.main_zone()); |
1811 | 1857 |
1812 Node* start = graph.NewNode(common.Start(2)); | 1858 Node* start = graph.NewNode(common.Start(2)); |
1813 graph.SetStart(start); | 1859 graph.SetStart(start); |
1814 | 1860 |
1815 Node* p0 = graph.NewNode(common.Parameter(0), start); | 1861 Node* p0 = graph.NewNode(common.Parameter(0), start); |
1816 | 1862 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 graph.SetEnd(end); | 2126 graph.SetEnd(end); |
2081 | 2127 |
2082 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2128 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
2083 BasicBlock* block = schedule->block(loop); | 2129 BasicBlock* block = schedule->block(loop); |
2084 CHECK_NE(NULL, loop); | 2130 CHECK_NE(NULL, loop); |
2085 CHECK_EQ(block, schedule->block(effect)); | 2131 CHECK_EQ(block, schedule->block(effect)); |
2086 CHECK_GE(block->rpo_number(), 0); | 2132 CHECK_GE(block->rpo_number(), 0); |
2087 } | 2133 } |
2088 | 2134 |
2089 #endif | 2135 #endif |
OLD | NEW |