Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/cctest/compiler/test-scheduler.cc

Issue 602083003: Fix scheduler to correctly schedule nested diamonds. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix rebase bug Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/verifier.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common-operator.h" 9 #include "src/compiler/common-operator.h"
9 #include "src/compiler/generic-node-inl.h" 10 #include "src/compiler/generic-node-inl.h"
10 #include "src/compiler/generic-node.h" 11 #include "src/compiler/generic-node.h"
11 #include "src/compiler/graph.h" 12 #include "src/compiler/graph.h"
12 #include "src/compiler/graph-visualizer.h" 13 #include "src/compiler/graph-visualizer.h"
13 #include "src/compiler/js-operator.h" 14 #include "src/compiler/js-operator.h"
14 #include "src/compiler/machine-operator.h" 15 #include "src/compiler/machine-operator.h"
15 #include "src/compiler/node.h" 16 #include "src/compiler/node.h"
16 #include "src/compiler/operator.h" 17 #include "src/compiler/operator.h"
17 #include "src/compiler/schedule.h" 18 #include "src/compiler/schedule.h"
18 #include "src/compiler/scheduler.h" 19 #include "src/compiler/scheduler.h"
20 #include "src/compiler/simplified-operator.h"
19 #include "src/compiler/verifier.h" 21 #include "src/compiler/verifier.h"
20 22
21 using namespace v8::internal; 23 using namespace v8::internal;
22 using namespace v8::internal::compiler; 24 using namespace v8::internal::compiler;
23 25
24 // TODO(titzer): pull RPO tests out to their own file. 26 // TODO(titzer): pull RPO tests out to their own file.
25 struct TestLoop { 27 struct TestLoop {
26 int count; 28 int count;
27 BasicBlock** nodes; 29 BasicBlock** nodes;
28 BasicBlock* header() { return nodes[0]; } 30 BasicBlock* header() { return nodes[0]; }
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 Node* add = graph.NewNode(machine.Int32Add(), d1, d2); 1712 Node* add = graph.NewNode(machine.Int32Add(), d1, d2);
1711 Node* d3 = CreateDiamond(&graph, &common, add); 1713 Node* d3 = CreateDiamond(&graph, &common, add);
1712 Node* ret = graph.NewNode(common.Return(), d3, start, start); 1714 Node* ret = graph.NewNode(common.Return(), d3, start, start);
1713 Node* end = graph.NewNode(common.End(), ret, start); 1715 Node* end = graph.NewNode(common.End(), ret, start);
1714 1716
1715 graph.SetEnd(end); 1717 graph.SetEnd(end);
1716 1718
1717 ComputeAndVerifySchedule(33, &graph); 1719 ComputeAndVerifySchedule(33, &graph);
1718 } 1720 }
1719 1721
1722
1723 TEST(NestedFloatingDiamonds) {
1724 HandleAndZoneScope scope;
1725 Graph graph(scope.main_zone());
1726 CommonOperatorBuilder common(scope.main_zone());
1727 SimplifiedOperatorBuilder simplified(scope.main_zone());
1728 MachineOperatorBuilder machine;
1729
1730 Node* start = graph.NewNode(common.Start(2));
1731 graph.SetStart(start);
1732
1733 Node* p0 = graph.NewNode(common.Parameter(0), start);
1734
1735 Node* fv = graph.NewNode(common.Int32Constant(7));
1736 Node* br = graph.NewNode(common.Branch(), p0, graph.start());
1737 Node* t = graph.NewNode(common.IfTrue(), br);
1738 Node* f = graph.NewNode(common.IfFalse(), br);
1739
1740 Node* map = graph.NewNode(
1741 simplified.LoadElement(AccessBuilder::ForFixedArrayElement()), p0, p0, p0,
1742 start, f);
1743 Node* br1 = graph.NewNode(common.Branch(), map, graph.start());
1744 Node* t1 = graph.NewNode(common.IfTrue(), br1);
1745 Node* f1 = graph.NewNode(common.IfFalse(), br1);
1746 Node* m1 = graph.NewNode(common.Merge(2), t1, f1);
1747 Node* ttrue = graph.NewNode(common.Int32Constant(1));
1748 Node* ffalse = graph.NewNode(common.Int32Constant(0));
1749 Node* phi1 = graph.NewNode(common.Phi(kMachAnyTagged, 2), ttrue, ffalse, m1);
1750
1751
1752 Node* m = graph.NewNode(common.Merge(2), t, f);
1753 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), fv, phi1, m);
1754 Node* ephi1 = graph.NewNode(common.EffectPhi(2), start, map, m);
1755
1756 Node* ret = graph.NewNode(common.Return(), phi, ephi1, start);
1757 Node* end = graph.NewNode(common.End(), ret, start);
1758
1759 graph.SetEnd(end);
1760
1761 ComputeAndVerifySchedule(23, &graph);
1762 }
1763
1764
1765 TEST(PhisPushedDownToDifferentBranches) {
1766 HandleAndZoneScope scope;
1767 Graph graph(scope.main_zone());
1768 CommonOperatorBuilder common(scope.main_zone());
1769 SimplifiedOperatorBuilder simplified(scope.main_zone());
1770 MachineOperatorBuilder machine;
1771
1772 Node* start = graph.NewNode(common.Start(2));
1773 graph.SetStart(start);
1774
1775 Node* p0 = graph.NewNode(common.Parameter(0), start);
1776 Node* p1 = graph.NewNode(common.Parameter(1), start);
1777
1778 Node* v1 = graph.NewNode(common.Int32Constant(1));
1779 Node* v2 = graph.NewNode(common.Int32Constant(2));
1780 Node* v3 = graph.NewNode(common.Int32Constant(3));
1781 Node* v4 = graph.NewNode(common.Int32Constant(4));
1782 Node* br = graph.NewNode(common.Branch(), p0, graph.start());
1783 Node* t = graph.NewNode(common.IfTrue(), br);
1784 Node* f = graph.NewNode(common.IfFalse(), br);
1785 Node* m = graph.NewNode(common.Merge(2), t, f);
1786 Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 2), v1, v2, m);
1787 Node* phi2 = graph.NewNode(common.Phi(kMachAnyTagged, 2), v3, v4, m);
1788
1789 Node* br2 = graph.NewNode(common.Branch(), p1, graph.start());
1790 Node* t2 = graph.NewNode(common.IfTrue(), br2);
1791 Node* f2 = graph.NewNode(common.IfFalse(), br2);
1792 Node* m2 = graph.NewNode(common.Merge(2), t2, f2);
1793 Node* phi3 = graph.NewNode(common.Phi(kMachAnyTagged, 2), phi, phi2, m2);
1794
1795 Node* ret = graph.NewNode(common.Return(), phi3, start, start);
1796 Node* end = graph.NewNode(common.End(), ret, start);
1797
1798 graph.SetEnd(end);
1799
1800 ComputeAndVerifySchedule(24, &graph);
1801 }
1802
1720 #endif 1803 #endif
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698