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

Side by Side Diff: test/unittests/compiler/scheduler-unittest.cc

Issue 899433005: [turbofan] Split pure nodes in the scheduler if beneficial. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments Created 5 years, 10 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
« no previous file with comments | « test/mjsunit/asm/redundancy2.js ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/graph-visualizer.h" 8 #include "src/compiler/graph-visualizer.h"
9 #include "src/compiler/js-operator.h" 9 #include "src/compiler/js-operator.h"
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 SchedulerTest() 26 SchedulerTest()
27 : graph_(zone()), common_(zone()), simplified_(zone()), js_(zone()) {} 27 : graph_(zone()), common_(zone()), simplified_(zone()), js_(zone()) {}
28 28
29 static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) { 29 static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) {
30 if (FLAG_trace_turbo) { 30 if (FLAG_trace_turbo) {
31 OFStream os(stdout); 31 OFStream os(stdout);
32 os << AsDOT(*graph); 32 os << AsDOT(*graph);
33 } 33 }
34 34
35 Schedule* schedule = Scheduler::ComputeSchedule(graph->zone(), graph); 35 Schedule* schedule = Scheduler::ComputeSchedule(graph->zone(), graph,
36 Scheduler::kSplitNodes);
36 37
37 if (FLAG_trace_turbo_scheduler) { 38 if (FLAG_trace_turbo_scheduler) {
38 OFStream os(stdout); 39 OFStream os(stdout);
39 os << *schedule << std::endl; 40 os << *schedule << std::endl;
40 } 41 }
41 ScheduleVerifier::Run(schedule); 42 ScheduleVerifier::Run(schedule);
42 CHECK_EQ(expected, GetScheduledNodeCount(schedule)); 43 CHECK_EQ(expected, GetScheduledNodeCount(schedule));
43 return schedule; 44 return schedule;
44 } 45 }
45 46
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 const Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0, 146 const Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0,
146 0, 1, 0, 0); 147 0, 1, 0, 0);
147 148
148 } // namespace 149 } // namespace
149 150
150 151
151 TEST_F(SchedulerTest, BuildScheduleEmpty) { 152 TEST_F(SchedulerTest, BuildScheduleEmpty) {
152 graph()->SetStart(graph()->NewNode(common()->Start(0))); 153 graph()->SetStart(graph()->NewNode(common()->Start(0)));
153 graph()->SetEnd(graph()->NewNode(common()->End(), graph()->start())); 154 graph()->SetEnd(graph()->NewNode(common()->End(), graph()->start()));
154 USE(Scheduler::ComputeSchedule(zone(), graph())); 155 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags));
155 } 156 }
156 157
157 158
158 TEST_F(SchedulerTest, BuildScheduleOneParameter) { 159 TEST_F(SchedulerTest, BuildScheduleOneParameter) {
159 graph()->SetStart(graph()->NewNode(common()->Start(0))); 160 graph()->SetStart(graph()->NewNode(common()->Start(0)));
160 161
161 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); 162 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start());
162 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(), 163 Node* ret = graph()->NewNode(common()->Return(), p1, graph()->start(),
163 graph()->start()); 164 graph()->start());
164 165
165 graph()->SetEnd(graph()->NewNode(common()->End(), ret)); 166 graph()->SetEnd(graph()->NewNode(common()->End(), ret));
166 167
167 USE(Scheduler::ComputeSchedule(zone(), graph())); 168 USE(Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kNoFlags));
168 } 169 }
169 170
170 171
171 TEST_F(SchedulerTest, BuildScheduleIfSplit) { 172 TEST_F(SchedulerTest, BuildScheduleIfSplit) {
172 graph()->SetStart(graph()->NewNode(common()->Start(3))); 173 graph()->SetStart(graph()->NewNode(common()->Start(3)));
173 174
174 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start()); 175 Node* p1 = graph()->NewNode(common()->Parameter(0), graph()->start());
175 Node* p2 = graph()->NewNode(common()->Parameter(1), graph()->start()); 176 Node* p2 = graph()->NewNode(common()->Parameter(1), graph()->start());
176 Node* p3 = graph()->NewNode(common()->Parameter(2), graph()->start()); 177 Node* p3 = graph()->NewNode(common()->Parameter(2), graph()->start());
177 Node* p4 = graph()->NewNode(common()->Parameter(3), graph()->start()); 178 Node* p4 = graph()->NewNode(common()->Parameter(3), graph()->start());
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 Node* mB2 = graph()->NewNode(common()->Merge(2), tB2, fB2); 1728 Node* mB2 = graph()->NewNode(common()->Merge(2), tB2, fB2);
1728 Node* phiB2 = 1729 Node* phiB2 =
1729 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), phiA1, c, mB2); 1730 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), phiA1, c, mB2);
1730 1731
1731 Node* add = graph()->NewNode(&kIntAdd, phiA2, phiB2); 1732 Node* add = graph()->NewNode(&kIntAdd, phiA2, phiB2);
1732 Node* ret = graph()->NewNode(common()->Return(), add, start, start); 1733 Node* ret = graph()->NewNode(common()->Return(), add, start, start);
1733 Node* end = graph()->NewNode(common()->End(), ret, start); 1734 Node* end = graph()->NewNode(common()->End(), ret, start);
1734 1735
1735 graph()->SetEnd(end); 1736 graph()->SetEnd(end);
1736 1737
1737 ComputeAndVerifySchedule(35, graph()); 1738 ComputeAndVerifySchedule(36, graph());
1738 } 1739 }
1739 1740
1740 1741
1741 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithLoop) { 1742 TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithLoop) {
1742 Node* start = graph()->NewNode(common()->Start(2)); 1743 Node* start = graph()->NewNode(common()->Start(2));
1743 graph()->SetStart(start); 1744 graph()->SetStart(start);
1744 1745
1745 Node* p0 = graph()->NewNode(common()->Parameter(0), start); 1746 Node* p0 = graph()->NewNode(common()->Parameter(0), start);
1746 1747
1747 Node* fv = graph()->NewNode(common()->Int32Constant(7)); 1748 Node* fv = graph()->NewNode(common()->Int32Constant(7));
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 1963
1963 Schedule* schedule = ComputeAndVerifySchedule(13, graph()); 1964 Schedule* schedule = ComputeAndVerifySchedule(13, graph());
1964 // Make sure the true block is marked as deferred. 1965 // Make sure the true block is marked as deferred.
1965 CHECK(schedule->block(t)->deferred()); 1966 CHECK(schedule->block(t)->deferred());
1966 CHECK(!schedule->block(f)->deferred()); 1967 CHECK(!schedule->block(f)->deferred());
1967 } 1968 }
1968 1969
1969 } // namespace compiler 1970 } // namespace compiler
1970 } // namespace internal 1971 } // namespace internal
1971 } // namespace v8 1972 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/asm/redundancy2.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698