OLD | NEW |
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" | |
9 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
10 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
11 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
12 #include "src/compiler/operator.h" | 11 #include "src/compiler/operator.h" |
13 #include "src/compiler/schedule.h" | 12 #include "src/compiler/schedule.h" |
14 #include "src/compiler/scheduler.h" | 13 #include "src/compiler/scheduler.h" |
15 #include "src/compiler/simplified-operator.h" | 14 #include "src/compiler/simplified-operator.h" |
16 #include "src/compiler/verifier.h" | 15 #include "src/compiler/verifier.h" |
| 16 #include "src/compiler/visualizer.h" |
17 #include "test/unittests/compiler/compiler-test-utils.h" | 17 #include "test/unittests/compiler/compiler-test-utils.h" |
18 #include "test/unittests/test-utils.h" | 18 #include "test/unittests/test-utils.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 | 20 |
21 using testing::AnyOf; | 21 using testing::AnyOf; |
22 | 22 |
23 namespace v8 { | 23 namespace v8 { |
24 namespace internal { | 24 namespace internal { |
25 namespace compiler { | 25 namespace compiler { |
26 | 26 |
27 class SchedulerTest : public TestWithZone { | 27 class SchedulerTest : public TestWithZone { |
28 public: | 28 public: |
29 SchedulerTest() | 29 SchedulerTest() |
30 : graph_(zone()), common_(zone()), simplified_(zone()), js_(zone()) {} | 30 : graph_(zone()), common_(zone()), simplified_(zone()), js_(zone()) {} |
31 | 31 |
32 Schedule* ComputeAndVerifySchedule(size_t expected) { | 32 Schedule* ComputeAndVerifySchedule(size_t expected) { |
33 if (FLAG_trace_turbo) { | 33 if (FLAG_trace_turbo) { |
34 OFStream os(stdout); | 34 OFStream os(stdout); |
35 os << AsDOT(*graph()); | 35 os << AsDOT(*graph()); |
36 } | 36 } |
37 | 37 |
38 Schedule* schedule = | 38 Schedule* schedule = |
39 Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kSplitNodes); | 39 Scheduler::ComputeSchedule(zone(), graph(), Scheduler::kSplitNodes); |
40 | 40 |
41 if (FLAG_trace_turbo_scheduler) { | 41 if (FLAG_trace_turbo_scheduler) { |
42 OFStream os(stdout); | 42 OFStream os(stdout); |
43 os << *schedule << std::endl; | 43 os << ScheduleAsJSON(*schedule) << std::endl; |
44 } | 44 } |
45 ScheduleVerifier::Run(schedule); | 45 ScheduleVerifier::Run(schedule); |
46 EXPECT_EQ(expected, GetScheduledNodeCount(schedule)); | 46 EXPECT_EQ(expected, GetScheduledNodeCount(schedule)); |
47 return schedule; | 47 return schedule; |
48 } | 48 } |
49 | 49 |
50 size_t GetScheduledNodeCount(const Schedule* schedule) { | 50 size_t GetScheduledNodeCount(const Schedule* schedule) { |
51 size_t node_count = 0; | 51 size_t node_count = 0; |
52 for (auto block : *schedule->rpo_order()) { | 52 for (auto block : *schedule->rpo_order()) { |
53 node_count += block->NodeCount(); | 53 node_count += block->NodeCount(); |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 Node* end = graph()->NewNode(common()->End(), ret); | 2030 Node* end = graph()->NewNode(common()->End(), ret); |
2031 | 2031 |
2032 graph()->SetEnd(end); | 2032 graph()->SetEnd(end); |
2033 | 2033 |
2034 ComputeAndVerifySchedule(16); | 2034 ComputeAndVerifySchedule(16); |
2035 } | 2035 } |
2036 | 2036 |
2037 } // namespace compiler | 2037 } // namespace compiler |
2038 } // namespace internal | 2038 } // namespace internal |
2039 } // namespace v8 | 2039 } // namespace v8 |
OLD | NEW |