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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 Node* p0 = graph.NewNode(common.Parameter(0), start); | 1818 Node* p0 = graph.NewNode(common.Parameter(0), start); |
1819 | 1819 |
1820 Node* fv = graph.NewNode(common.Int32Constant(7)); | 1820 Node* fv = graph.NewNode(common.Int32Constant(7)); |
1821 Node* br = graph.NewNode(common.Branch(), p0, graph.start()); | 1821 Node* br = graph.NewNode(common.Branch(), p0, graph.start()); |
1822 Node* t = graph.NewNode(common.IfTrue(), br); | 1822 Node* t = graph.NewNode(common.IfTrue(), br); |
1823 Node* f = graph.NewNode(common.IfFalse(), br); | 1823 Node* f = graph.NewNode(common.IfFalse(), br); |
1824 | 1824 |
1825 Node* loop = graph.NewNode(common.Loop(2), f, start); | 1825 Node* loop = graph.NewNode(common.Loop(2), f, start); |
1826 Node* ind = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p0, loop); | 1826 Node* ind = graph.NewNode(common.Phi(kMachAnyTagged, 2), p0, p0, loop); |
1827 | 1827 |
1828 // TODO(mstarzinger): Make scheduler deal with non-empty loops here. | 1828 Node* add = graph.NewNode(&kIntAdd, ind, fv); |
1829 // Node* add = graph.NewNode(&kIntAdd, ind, fv); | 1829 Node* br1 = graph.NewNode(common.Branch(), add, loop); |
1830 | |
1831 Node* br1 = graph.NewNode(common.Branch(), ind, loop); | |
1832 Node* t1 = graph.NewNode(common.IfTrue(), br1); | 1830 Node* t1 = graph.NewNode(common.IfTrue(), br1); |
1833 Node* f1 = graph.NewNode(common.IfFalse(), br1); | 1831 Node* f1 = graph.NewNode(common.IfFalse(), br1); |
1834 | 1832 |
1835 loop->ReplaceInput(1, t1); // close loop. | 1833 loop->ReplaceInput(1, t1); // close loop. |
1836 ind->ReplaceInput(1, ind); // close induction variable. | 1834 ind->ReplaceInput(1, ind); // close induction variable. |
1837 | 1835 |
1838 Node* m = graph.NewNode(common.Merge(2), t, f1); | 1836 Node* m = graph.NewNode(common.Merge(2), t, f1); |
1839 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), fv, ind, m); | 1837 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), fv, ind, m); |
1840 | 1838 |
1841 Node* ret = graph.NewNode(common.Return(), phi, start, start); | 1839 Node* ret = graph.NewNode(common.Return(), phi, start, start); |
1842 Node* end = graph.NewNode(common.End(), ret, start); | 1840 Node* end = graph.NewNode(common.End(), ret, start); |
1843 | 1841 |
1844 graph.SetEnd(end); | 1842 graph.SetEnd(end); |
1845 | 1843 |
1846 ComputeAndVerifySchedule(19, &graph); | 1844 ComputeAndVerifySchedule(20, &graph); |
1847 } | 1845 } |
1848 | 1846 |
1849 | 1847 |
1850 TEST(LoopedFloatingDiamond1) { | 1848 TEST(LoopedFloatingDiamond1) { |
1851 HandleAndZoneScope scope; | 1849 HandleAndZoneScope scope; |
1852 Graph graph(scope.main_zone()); | 1850 Graph graph(scope.main_zone()); |
1853 CommonOperatorBuilder common(scope.main_zone()); | 1851 CommonOperatorBuilder common(scope.main_zone()); |
1854 SimplifiedOperatorBuilder simplified(scope.main_zone()); | 1852 SimplifiedOperatorBuilder simplified(scope.main_zone()); |
1855 | 1853 |
1856 Node* start = graph.NewNode(common.Start(2)); | 1854 Node* start = graph.NewNode(common.Start(2)); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 graph.SetEnd(end); | 2036 graph.SetEnd(end); |
2039 | 2037 |
2040 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2038 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
2041 BasicBlock* block = schedule->block(loop); | 2039 BasicBlock* block = schedule->block(loop); |
2042 CHECK_NE(NULL, loop); | 2040 CHECK_NE(NULL, loop); |
2043 CHECK_EQ(block, schedule->block(effect)); | 2041 CHECK_EQ(block, schedule->block(effect)); |
2044 CHECK_GE(block->rpo_number(), 0); | 2042 CHECK_GE(block->rpo_number(), 0); |
2045 } | 2043 } |
2046 | 2044 |
2047 #endif | 2045 #endif |
OLD | NEW |