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/adapters.h" | 10 #include "src/base/adapters.h" |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 static const char* phase_name() { return "allocate double registers"; } | 772 static const char* phase_name() { return "allocate double registers"; } |
773 | 773 |
774 void Run(PipelineData* data, Zone* temp_zone) { | 774 void Run(PipelineData* data, Zone* temp_zone) { |
775 RegAllocator allocator(data->register_allocation_data(), DOUBLE_REGISTERS, | 775 RegAllocator allocator(data->register_allocation_data(), DOUBLE_REGISTERS, |
776 temp_zone); | 776 temp_zone); |
777 allocator.AllocateRegisters(); | 777 allocator.AllocateRegisters(); |
778 } | 778 } |
779 }; | 779 }; |
780 | 780 |
781 | 781 |
| 782 struct LocateSpillSlotsPhase { |
| 783 static const char* phase_name() { return "locate spill slots"; } |
| 784 |
| 785 void Run(PipelineData* data, Zone* temp_zone) { |
| 786 SpillSlotLocator locator(data->register_allocation_data()); |
| 787 locator.LocateSpillSlots(); |
| 788 } |
| 789 }; |
| 790 |
| 791 |
782 struct AssignSpillSlotsPhase { | 792 struct AssignSpillSlotsPhase { |
783 static const char* phase_name() { return "assign spill slots"; } | 793 static const char* phase_name() { return "assign spill slots"; } |
784 | 794 |
785 void Run(PipelineData* data, Zone* temp_zone) { | 795 void Run(PipelineData* data, Zone* temp_zone) { |
786 OperandAssigner assigner(data->register_allocation_data()); | 796 OperandAssigner assigner(data->register_allocation_data()); |
787 assigner.AssignSpillSlots(); | 797 assigner.AssignSpillSlots(); |
788 } | 798 } |
789 }; | 799 }; |
790 | 800 |
791 | 801 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 BeginPhaseKind("register allocation"); | 1203 BeginPhaseKind("register allocation"); |
1194 | 1204 |
1195 bool run_verifier = FLAG_turbo_verify_allocation; | 1205 bool run_verifier = FLAG_turbo_verify_allocation; |
1196 // Allocate registers. | 1206 // Allocate registers. |
1197 AllocateRegisters(RegisterConfiguration::ArchDefault(), run_verifier); | 1207 AllocateRegisters(RegisterConfiguration::ArchDefault(), run_verifier); |
1198 if (data->compilation_failed()) { | 1208 if (data->compilation_failed()) { |
1199 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); | 1209 info()->AbortOptimization(kNotEnoughVirtualRegistersRegalloc); |
1200 return Handle<Code>(); | 1210 return Handle<Code>(); |
1201 } | 1211 } |
1202 | 1212 |
1203 if (FLAG_turbo_frame_elision) { | |
1204 Run<FrameElisionPhase>(); | |
1205 } | |
1206 | |
1207 BeginPhaseKind("code generation"); | 1213 BeginPhaseKind("code generation"); |
1208 | 1214 |
1209 // Optimimize jumps. | 1215 // Optimimize jumps. |
1210 if (FLAG_turbo_jt) { | 1216 if (FLAG_turbo_jt) { |
1211 Run<JumpThreadingPhase>(); | 1217 Run<JumpThreadingPhase>(); |
1212 } | 1218 } |
1213 | 1219 |
1214 // Generate final machine code. | 1220 // Generate final machine code. |
1215 Run<GenerateCodePhase>(&linkage); | 1221 Run<GenerateCodePhase>(&linkage); |
1216 | 1222 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 if (verifier != nullptr) { | 1298 if (verifier != nullptr) { |
1293 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); | 1299 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); |
1294 } | 1300 } |
1295 if (FLAG_turbo_greedy_regalloc) { | 1301 if (FLAG_turbo_greedy_regalloc) { |
1296 Run<AllocateGeneralRegistersPhase<GreedyAllocator>>(); | 1302 Run<AllocateGeneralRegistersPhase<GreedyAllocator>>(); |
1297 Run<AllocateDoubleRegistersPhase<GreedyAllocator>>(); | 1303 Run<AllocateDoubleRegistersPhase<GreedyAllocator>>(); |
1298 } else { | 1304 } else { |
1299 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); | 1305 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); |
1300 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); | 1306 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); |
1301 } | 1307 } |
| 1308 |
| 1309 if (FLAG_turbo_frame_elision) { |
| 1310 Run<LocateSpillSlotsPhase>(); |
| 1311 Run<FrameElisionPhase>(); |
| 1312 } |
| 1313 |
1302 Run<AssignSpillSlotsPhase>(); | 1314 Run<AssignSpillSlotsPhase>(); |
1303 | 1315 |
1304 Run<CommitAssignmentPhase>(); | 1316 Run<CommitAssignmentPhase>(); |
1305 Run<PopulateReferenceMapsPhase>(); | 1317 Run<PopulateReferenceMapsPhase>(); |
1306 Run<ConnectRangesPhase>(); | 1318 Run<ConnectRangesPhase>(); |
1307 Run<ResolveControlFlowPhase>(); | 1319 Run<ResolveControlFlowPhase>(); |
1308 if (FLAG_turbo_move_optimization) { | 1320 if (FLAG_turbo_move_optimization) { |
1309 Run<OptimizeMovesPhase>(); | 1321 Run<OptimizeMovesPhase>(); |
1310 } | 1322 } |
1311 | 1323 |
(...skipping 14 matching lines...) Expand all Loading... |
1326 tcf << AsC1VRegisterAllocationData("CodeGen", | 1338 tcf << AsC1VRegisterAllocationData("CodeGen", |
1327 data->register_allocation_data()); | 1339 data->register_allocation_data()); |
1328 } | 1340 } |
1329 | 1341 |
1330 data->DeleteRegisterAllocationZone(); | 1342 data->DeleteRegisterAllocationZone(); |
1331 } | 1343 } |
1332 | 1344 |
1333 } // namespace compiler | 1345 } // namespace compiler |
1334 } // namespace internal | 1346 } // namespace internal |
1335 } // namespace v8 | 1347 } // namespace v8 |
OLD | NEW |