| 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 24 matching lines...) Expand all Loading... |
| 35 #include "src/compiler/js-type-feedback-lowering.h" | 35 #include "src/compiler/js-type-feedback-lowering.h" |
| 36 #include "src/compiler/js-typed-lowering.h" | 36 #include "src/compiler/js-typed-lowering.h" |
| 37 #include "src/compiler/jump-threading.h" | 37 #include "src/compiler/jump-threading.h" |
| 38 #include "src/compiler/load-elimination.h" | 38 #include "src/compiler/load-elimination.h" |
| 39 #include "src/compiler/loop-analysis.h" | 39 #include "src/compiler/loop-analysis.h" |
| 40 #include "src/compiler/loop-peeling.h" | 40 #include "src/compiler/loop-peeling.h" |
| 41 #include "src/compiler/machine-operator-reducer.h" | 41 #include "src/compiler/machine-operator-reducer.h" |
| 42 #include "src/compiler/move-optimizer.h" | 42 #include "src/compiler/move-optimizer.h" |
| 43 #include "src/compiler/osr.h" | 43 #include "src/compiler/osr.h" |
| 44 #include "src/compiler/pipeline-statistics.h" | 44 #include "src/compiler/pipeline-statistics.h" |
| 45 #include "src/compiler/preprocess-live-ranges.h" |
| 45 #include "src/compiler/register-allocator.h" | 46 #include "src/compiler/register-allocator.h" |
| 46 #include "src/compiler/register-allocator-verifier.h" | 47 #include "src/compiler/register-allocator-verifier.h" |
| 47 #include "src/compiler/schedule.h" | 48 #include "src/compiler/schedule.h" |
| 48 #include "src/compiler/scheduler.h" | 49 #include "src/compiler/scheduler.h" |
| 49 #include "src/compiler/select-lowering.h" | 50 #include "src/compiler/select-lowering.h" |
| 50 #include "src/compiler/simplified-lowering.h" | 51 #include "src/compiler/simplified-lowering.h" |
| 51 #include "src/compiler/simplified-operator-reducer.h" | 52 #include "src/compiler/simplified-operator-reducer.h" |
| 52 #include "src/compiler/tail-call-optimization.h" | 53 #include "src/compiler/tail-call-optimization.h" |
| 53 #include "src/compiler/typer.h" | 54 #include "src/compiler/typer.h" |
| 54 #include "src/compiler/value-numbering-reducer.h" | 55 #include "src/compiler/value-numbering-reducer.h" |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 struct BuildLiveRangesPhase { | 779 struct BuildLiveRangesPhase { |
| 779 static const char* phase_name() { return "build live ranges"; } | 780 static const char* phase_name() { return "build live ranges"; } |
| 780 | 781 |
| 781 void Run(PipelineData* data, Zone* temp_zone) { | 782 void Run(PipelineData* data, Zone* temp_zone) { |
| 782 LiveRangeBuilder builder(data->register_allocation_data(), temp_zone); | 783 LiveRangeBuilder builder(data->register_allocation_data(), temp_zone); |
| 783 builder.BuildLiveRanges(); | 784 builder.BuildLiveRanges(); |
| 784 } | 785 } |
| 785 }; | 786 }; |
| 786 | 787 |
| 787 | 788 |
| 789 struct PreprocessLiveRangesPhase { |
| 790 static const char* phase_name() { return "preprocess live ranges"; } |
| 791 |
| 792 void Run(PipelineData* data, Zone* temp_zone) { |
| 793 PreprocessLiveRanges live_range_preprocessor( |
| 794 data->register_allocation_data(), temp_zone); |
| 795 live_range_preprocessor.PreprocessRanges(); |
| 796 } |
| 797 }; |
| 798 |
| 799 |
| 788 template <typename RegAllocator> | 800 template <typename RegAllocator> |
| 789 struct AllocateGeneralRegistersPhase { | 801 struct AllocateGeneralRegistersPhase { |
| 790 static const char* phase_name() { return "allocate general registers"; } | 802 static const char* phase_name() { return "allocate general registers"; } |
| 791 | 803 |
| 792 void Run(PipelineData* data, Zone* temp_zone) { | 804 void Run(PipelineData* data, Zone* temp_zone) { |
| 793 RegAllocator allocator(data->register_allocation_data(), GENERAL_REGISTERS, | 805 RegAllocator allocator(data->register_allocation_data(), GENERAL_REGISTERS, |
| 794 temp_zone); | 806 temp_zone); |
| 795 allocator.AllocateRegisters(); | 807 allocator.AllocateRegisters(); |
| 796 } | 808 } |
| 797 }; | 809 }; |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 Run<BuildLiveRangesPhase>(); | 1325 Run<BuildLiveRangesPhase>(); |
| 1314 if (FLAG_trace_turbo_graph) { | 1326 if (FLAG_trace_turbo_graph) { |
| 1315 OFStream os(stdout); | 1327 OFStream os(stdout); |
| 1316 PrintableInstructionSequence printable = {config, data->sequence()}; | 1328 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1317 os << "----- Instruction sequence before register allocation -----\n" | 1329 os << "----- Instruction sequence before register allocation -----\n" |
| 1318 << printable; | 1330 << printable; |
| 1319 } | 1331 } |
| 1320 if (verifier != nullptr) { | 1332 if (verifier != nullptr) { |
| 1321 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); | 1333 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); |
| 1322 } | 1334 } |
| 1323 if (FLAG_turbo_greedy_regalloc) { | 1335 |
| 1324 Run<AllocateGeneralRegistersPhase<GreedyAllocator>>(); | 1336 if (FLAG_turbo_preprocess_ranges) { |
| 1325 Run<AllocateDoubleRegistersPhase<GreedyAllocator>>(); | 1337 Run<PreprocessLiveRangesPhase>(); |
| 1326 } else { | |
| 1327 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); | |
| 1328 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); | |
| 1329 } | 1338 } |
| 1330 | 1339 |
| 1340 // TODO(mtrofin): re-enable greedy once we have bots for range preprocessing. |
| 1341 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); |
| 1342 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); |
| 1343 |
| 1331 if (FLAG_turbo_frame_elision) { | 1344 if (FLAG_turbo_frame_elision) { |
| 1332 Run<LocateSpillSlotsPhase>(); | 1345 Run<LocateSpillSlotsPhase>(); |
| 1333 Run<FrameElisionPhase>(); | 1346 Run<FrameElisionPhase>(); |
| 1334 } | 1347 } |
| 1335 | 1348 |
| 1336 Run<AssignSpillSlotsPhase>(); | 1349 Run<AssignSpillSlotsPhase>(); |
| 1337 | 1350 |
| 1338 Run<CommitAssignmentPhase>(); | 1351 Run<CommitAssignmentPhase>(); |
| 1339 Run<PopulateReferenceMapsPhase>(); | 1352 Run<PopulateReferenceMapsPhase>(); |
| 1340 Run<ConnectRangesPhase>(); | 1353 Run<ConnectRangesPhase>(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1360 tcf << AsC1VRegisterAllocationData("CodeGen", | 1373 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1361 data->register_allocation_data()); | 1374 data->register_allocation_data()); |
| 1362 } | 1375 } |
| 1363 | 1376 |
| 1364 data->DeleteRegisterAllocationZone(); | 1377 data->DeleteRegisterAllocationZone(); |
| 1365 } | 1378 } |
| 1366 | 1379 |
| 1367 } // namespace compiler | 1380 } // namespace compiler |
| 1368 } // namespace internal | 1381 } // namespace internal |
| 1369 } // namespace v8 | 1382 } // namespace v8 |
| OLD | NEW |