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