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/compiler/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
11 #include "src/compiler/ast-graph-builder.h" | 11 #include "src/compiler/ast-graph-builder.h" |
12 #include "src/compiler/basic-block-instrumentor.h" | 12 #include "src/compiler/basic-block-instrumentor.h" |
13 #include "src/compiler/change-lowering.h" | 13 #include "src/compiler/change-lowering.h" |
14 #include "src/compiler/code-generator.h" | 14 #include "src/compiler/code-generator.h" |
15 #include "src/compiler/control-reducer.h" | 15 #include "src/compiler/control-reducer.h" |
16 #include "src/compiler/graph-replay.h" | 16 #include "src/compiler/graph-replay.h" |
17 #include "src/compiler/graph-visualizer.h" | 17 #include "src/compiler/graph-visualizer.h" |
18 #include "src/compiler/instruction.h" | 18 #include "src/compiler/instruction.h" |
19 #include "src/compiler/instruction-selector.h" | 19 #include "src/compiler/instruction-selector.h" |
20 #include "src/compiler/js-context-specialization.h" | 20 #include "src/compiler/js-context-specialization.h" |
21 #include "src/compiler/js-generic-lowering.h" | 21 #include "src/compiler/js-generic-lowering.h" |
22 #include "src/compiler/js-inlining.h" | 22 #include "src/compiler/js-inlining.h" |
23 #include "src/compiler/js-typed-lowering.h" | 23 #include "src/compiler/js-typed-lowering.h" |
24 #include "src/compiler/jump-threading.h" | 24 #include "src/compiler/jump-threading.h" |
25 #include "src/compiler/machine-operator-reducer.h" | 25 #include "src/compiler/machine-operator-reducer.h" |
| 26 #include "src/compiler/move-optimizer.h" |
26 #include "src/compiler/pipeline-statistics.h" | 27 #include "src/compiler/pipeline-statistics.h" |
27 #include "src/compiler/register-allocator.h" | 28 #include "src/compiler/register-allocator.h" |
28 #include "src/compiler/register-allocator-verifier.h" | 29 #include "src/compiler/register-allocator-verifier.h" |
29 #include "src/compiler/schedule.h" | 30 #include "src/compiler/schedule.h" |
30 #include "src/compiler/scheduler.h" | 31 #include "src/compiler/scheduler.h" |
31 #include "src/compiler/select-lowering.h" | 32 #include "src/compiler/select-lowering.h" |
32 #include "src/compiler/simplified-lowering.h" | 33 #include "src/compiler/simplified-lowering.h" |
33 #include "src/compiler/simplified-operator-reducer.h" | 34 #include "src/compiler/simplified-operator-reducer.h" |
34 #include "src/compiler/typer.h" | 35 #include "src/compiler/typer.h" |
35 #include "src/compiler/value-numbering-reducer.h" | 36 #include "src/compiler/value-numbering-reducer.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 573 |
573 struct ResolveControlFlowPhase { | 574 struct ResolveControlFlowPhase { |
574 static const char* phase_name() { return "resolve control flow"; } | 575 static const char* phase_name() { return "resolve control flow"; } |
575 | 576 |
576 void Run(PipelineData* data, Zone* temp_zone) { | 577 void Run(PipelineData* data, Zone* temp_zone) { |
577 data->register_allocator()->ResolveControlFlow(); | 578 data->register_allocator()->ResolveControlFlow(); |
578 } | 579 } |
579 }; | 580 }; |
580 | 581 |
581 | 582 |
| 583 struct OptimizeMovesPhase { |
| 584 static const char* phase_name() { return "optimize moves"; } |
| 585 |
| 586 void Run(PipelineData* data, Zone* temp_zone) { |
| 587 MoveOptimizer move_optimizer(temp_zone, data->sequence()); |
| 588 move_optimizer.Run(); |
| 589 } |
| 590 }; |
| 591 |
| 592 |
582 struct JumpThreadingPhase { | 593 struct JumpThreadingPhase { |
583 static const char* phase_name() { return "jump threading"; } | 594 static const char* phase_name() { return "jump threading"; } |
584 | 595 |
585 void Run(PipelineData* data, Zone* temp_zone) { | 596 void Run(PipelineData* data, Zone* temp_zone) { |
586 ZoneVector<BasicBlock::RpoNumber> result(temp_zone); | 597 ZoneVector<BasicBlock::RpoNumber> result(temp_zone); |
587 if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence())) { | 598 if (JumpThreading::ComputeForwarding(temp_zone, result, data->sequence())) { |
588 JumpThreading::ApplyForwarding(result, data->sequence()); | 599 JumpThreading::ApplyForwarding(result, data->sequence()); |
589 } | 600 } |
590 } | 601 } |
591 }; | 602 }; |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 if (!data->register_allocator()->AllocationOk()) { | 991 if (!data->register_allocator()->AllocationOk()) { |
981 data->set_compilation_failed(); | 992 data->set_compilation_failed(); |
982 return; | 993 return; |
983 } | 994 } |
984 if (FLAG_turbo_reuse_spill_slots) { | 995 if (FLAG_turbo_reuse_spill_slots) { |
985 Run<ReuseSpillSlotsPhase>(); | 996 Run<ReuseSpillSlotsPhase>(); |
986 } | 997 } |
987 Run<PopulatePointerMapsPhase>(); | 998 Run<PopulatePointerMapsPhase>(); |
988 Run<ConnectRangesPhase>(); | 999 Run<ConnectRangesPhase>(); |
989 Run<ResolveControlFlowPhase>(); | 1000 Run<ResolveControlFlowPhase>(); |
| 1001 Run<OptimizeMovesPhase>(); |
990 | 1002 |
991 if (FLAG_trace_turbo) { | 1003 if (FLAG_trace_turbo) { |
992 OFStream os(stdout); | 1004 OFStream os(stdout); |
993 PrintableInstructionSequence printable = {config, data->sequence()}; | 1005 PrintableInstructionSequence printable = {config, data->sequence()}; |
994 os << "----- Instruction sequence after register allocation -----\n" | 1006 os << "----- Instruction sequence after register allocation -----\n" |
995 << printable; | 1007 << printable; |
996 } | 1008 } |
997 | 1009 |
998 if (verifier != nullptr) { | 1010 if (verifier != nullptr) { |
999 verifier->VerifyAssignment(); | 1011 verifier->VerifyAssignment(); |
(...skipping 12 matching lines...) Expand all Loading... |
1012 } | 1024 } |
1013 | 1025 |
1014 | 1026 |
1015 void Pipeline::TearDown() { | 1027 void Pipeline::TearDown() { |
1016 InstructionOperand::TearDownCaches(); | 1028 InstructionOperand::TearDownCaches(); |
1017 } | 1029 } |
1018 | 1030 |
1019 } // namespace compiler | 1031 } // namespace compiler |
1020 } // namespace internal | 1032 } // namespace internal |
1021 } // namespace v8 | 1033 } // namespace v8 |
OLD | NEW |