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 "test/unittests/compiler/instruction-selector-unittest.h" | 5 #include "test/unittests/compiler/instruction-selector-unittest.h" |
6 | 6 |
7 #include "src/compiler/graph.h" | 7 #include "src/compiler/graph.h" |
8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
| 9 #include "src/compiler/visualizer.h" |
9 #include "src/flags.h" | 10 #include "src/flags.h" |
10 #include "test/unittests/compiler/compiler-test-utils.h" | 11 #include "test/unittests/compiler/compiler-test-utils.h" |
11 | 12 |
12 namespace v8 { | 13 namespace v8 { |
13 namespace internal { | 14 namespace internal { |
14 namespace compiler { | 15 namespace compiler { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 typedef RawMachineAssembler::Label MLabel; | 19 typedef RawMachineAssembler::Label MLabel; |
19 | 20 |
20 } // namespace | 21 } // namespace |
21 | 22 |
22 | 23 |
23 InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {} | 24 InstructionSelectorTest::InstructionSelectorTest() : rng_(FLAG_random_seed) {} |
24 | 25 |
25 | 26 |
26 InstructionSelectorTest::~InstructionSelectorTest() {} | 27 InstructionSelectorTest::~InstructionSelectorTest() {} |
27 | 28 |
28 | 29 |
29 InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( | 30 InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( |
30 InstructionSelector::Features features, | 31 InstructionSelector::Features features, |
31 InstructionSelectorTest::StreamBuilderMode mode) { | 32 InstructionSelectorTest::StreamBuilderMode mode) { |
32 Schedule* schedule = Export(); | 33 Schedule* schedule = Export(); |
33 if (FLAG_trace_turbo) { | 34 if (FLAG_trace_turbo) { |
34 OFStream out(stdout); | 35 OFStream out(stdout); |
35 out << "=== Schedule before instruction selection ===" << std::endl | 36 out << "=== Schedule before instruction selection ===" << std::endl |
36 << *schedule; | 37 << ScheduleAsJSON(*schedule); |
37 } | 38 } |
38 size_t const node_count = graph()->NodeCount(); | 39 size_t const node_count = graph()->NodeCount(); |
39 EXPECT_NE(0u, node_count); | 40 EXPECT_NE(0u, node_count); |
40 Linkage linkage(call_descriptor()); | 41 Linkage linkage(call_descriptor()); |
41 InstructionBlocks* instruction_blocks = | 42 InstructionBlocks* instruction_blocks = |
42 InstructionSequence::InstructionBlocksFor(test_->zone(), schedule); | 43 InstructionSequence::InstructionBlocksFor(test_->zone(), schedule); |
43 InstructionSequence sequence(test_->isolate(), test_->zone(), | 44 InstructionSequence sequence(test_->isolate(), test_->zone(), |
44 instruction_blocks); | 45 instruction_blocks); |
45 SourcePositionTable source_position_table(graph()); | 46 SourcePositionTable source_position_table(graph()); |
46 InstructionSelector selector(test_->zone(), node_count, &linkage, &sequence, | 47 InstructionSelector selector(test_->zone(), node_count, &linkage, &sequence, |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); | 565 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); |
565 // Continuation. | 566 // Continuation. |
566 | 567 |
567 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); | 568 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); |
568 EXPECT_EQ(index, s.size()); | 569 EXPECT_EQ(index, s.size()); |
569 } | 570 } |
570 | 571 |
571 } // namespace compiler | 572 } // namespace compiler |
572 } // namespace internal | 573 } // namespace internal |
573 } // namespace v8 | 574 } // namespace v8 |
OLD | NEW |