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