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