| 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" |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 struct BuildLiveRangesPhase { | 735 struct BuildLiveRangesPhase { |
| 736 static const char* phase_name() { return "build live ranges"; } | 736 static const char* phase_name() { return "build live ranges"; } |
| 737 | 737 |
| 738 void Run(PipelineData* data, Zone* temp_zone) { | 738 void Run(PipelineData* data, Zone* temp_zone) { |
| 739 LiveRangeBuilder builder(data->register_allocation_data()); | 739 LiveRangeBuilder builder(data->register_allocation_data()); |
| 740 builder.BuildLiveRanges(); | 740 builder.BuildLiveRanges(); |
| 741 } | 741 } |
| 742 }; | 742 }; |
| 743 | 743 |
| 744 | 744 |
| 745 template <typename RegAllocator> | |
| 746 struct AllocateGeneralRegistersPhase { | 745 struct AllocateGeneralRegistersPhase { |
| 747 static const char* phase_name() { return "allocate general registers"; } | 746 static const char* phase_name() { return "allocate general registers"; } |
| 748 | 747 |
| 749 void Run(PipelineData* data, Zone* temp_zone) { | 748 void Run(PipelineData* data, Zone* temp_zone) { |
| 750 RegAllocator allocator(data->register_allocation_data(), GENERAL_REGISTERS, | 749 LinearScanAllocator allocator(data->register_allocation_data(), |
| 751 temp_zone); | 750 GENERAL_REGISTERS, temp_zone); |
| 752 allocator.AllocateRegisters(); | 751 allocator.AllocateRegisters(); |
| 753 } | 752 } |
| 754 }; | 753 }; |
| 755 | 754 |
| 756 | 755 |
| 757 template <typename RegAllocator> | |
| 758 struct AllocateDoubleRegistersPhase { | 756 struct AllocateDoubleRegistersPhase { |
| 759 static const char* phase_name() { return "allocate double registers"; } | 757 static const char* phase_name() { return "allocate double registers"; } |
| 760 | 758 |
| 761 void Run(PipelineData* data, Zone* temp_zone) { | 759 void Run(PipelineData* data, Zone* temp_zone) { |
| 762 RegAllocator allocator(data->register_allocation_data(), DOUBLE_REGISTERS, | 760 LinearScanAllocator allocator(data->register_allocation_data(), |
| 763 temp_zone); | 761 DOUBLE_REGISTERS, temp_zone); |
| 764 allocator.AllocateRegisters(); | 762 allocator.AllocateRegisters(); |
| 765 } | 763 } |
| 766 }; | 764 }; |
| 767 | 765 |
| 768 | 766 |
| 769 struct AssignSpillSlotsPhase { | 767 struct AssignSpillSlotsPhase { |
| 770 static const char* phase_name() { return "assign spill slots"; } | 768 static const char* phase_name() { return "assign spill slots"; } |
| 771 | 769 |
| 772 void Run(PipelineData* data, Zone* temp_zone) { | 770 void Run(PipelineData* data, Zone* temp_zone) { |
| 773 OperandAssigner assigner(data->register_allocation_data()); | 771 OperandAssigner assigner(data->register_allocation_data()); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 Run<BuildLiveRangesPhase>(); | 1262 Run<BuildLiveRangesPhase>(); |
| 1265 if (FLAG_trace_turbo_graph) { | 1263 if (FLAG_trace_turbo_graph) { |
| 1266 OFStream os(stdout); | 1264 OFStream os(stdout); |
| 1267 PrintableInstructionSequence printable = {config, data->sequence()}; | 1265 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1268 os << "----- Instruction sequence before register allocation -----\n" | 1266 os << "----- Instruction sequence before register allocation -----\n" |
| 1269 << printable; | 1267 << printable; |
| 1270 } | 1268 } |
| 1271 if (verifier != nullptr) { | 1269 if (verifier != nullptr) { |
| 1272 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); | 1270 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); |
| 1273 } | 1271 } |
| 1274 if (FLAG_turbo_greedy_regalloc) { | 1272 Run<AllocateGeneralRegistersPhase>(); |
| 1275 Run<AllocateGeneralRegistersPhase<GreedyAllocator>>(); | 1273 Run<AllocateDoubleRegistersPhase>(); |
| 1276 Run<AllocateDoubleRegistersPhase<GreedyAllocator>>(); | |
| 1277 } else { | |
| 1278 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); | |
| 1279 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); | |
| 1280 } | |
| 1281 Run<AssignSpillSlotsPhase>(); | 1274 Run<AssignSpillSlotsPhase>(); |
| 1282 | 1275 |
| 1283 Run<CommitAssignmentPhase>(); | 1276 Run<CommitAssignmentPhase>(); |
| 1284 Run<PopulateReferenceMapsPhase>(); | 1277 Run<PopulateReferenceMapsPhase>(); |
| 1285 Run<ConnectRangesPhase>(); | 1278 Run<ConnectRangesPhase>(); |
| 1286 Run<ResolveControlFlowPhase>(); | 1279 Run<ResolveControlFlowPhase>(); |
| 1287 if (FLAG_turbo_move_optimization) { | 1280 if (FLAG_turbo_move_optimization) { |
| 1288 Run<OptimizeMovesPhase>(); | 1281 Run<OptimizeMovesPhase>(); |
| 1289 } | 1282 } |
| 1290 | 1283 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1305 tcf << AsC1VRegisterAllocationData("CodeGen", | 1298 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1306 data->register_allocation_data()); | 1299 data->register_allocation_data()); |
| 1307 } | 1300 } |
| 1308 | 1301 |
| 1309 data->DeleteRegisterAllocationZone(); | 1302 data->DeleteRegisterAllocationZone(); |
| 1310 } | 1303 } |
| 1311 | 1304 |
| 1312 } // namespace compiler | 1305 } // namespace compiler |
| 1313 } // namespace internal | 1306 } // namespace internal |
| 1314 } // namespace v8 | 1307 } // namespace v8 |
| OLD | NEW |