| 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 17 matching lines...) Expand all Loading... |
| 28 #include "src/compiler/js-context-relaxation.h" | 28 #include "src/compiler/js-context-relaxation.h" |
| 29 #include "src/compiler/js-context-specialization.h" | 29 #include "src/compiler/js-context-specialization.h" |
| 30 #include "src/compiler/js-frame-specialization.h" | 30 #include "src/compiler/js-frame-specialization.h" |
| 31 #include "src/compiler/js-generic-lowering.h" | 31 #include "src/compiler/js-generic-lowering.h" |
| 32 #include "src/compiler/js-inlining.h" | 32 #include "src/compiler/js-inlining.h" |
| 33 #include "src/compiler/js-intrinsic-lowering.h" | 33 #include "src/compiler/js-intrinsic-lowering.h" |
| 34 #include "src/compiler/js-type-feedback.h" | 34 #include "src/compiler/js-type-feedback.h" |
| 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/live-range-separator.h" |
| 38 #include "src/compiler/load-elimination.h" | 39 #include "src/compiler/load-elimination.h" |
| 39 #include "src/compiler/loop-analysis.h" | 40 #include "src/compiler/loop-analysis.h" |
| 40 #include "src/compiler/loop-peeling.h" | 41 #include "src/compiler/loop-peeling.h" |
| 41 #include "src/compiler/machine-operator-reducer.h" | 42 #include "src/compiler/machine-operator-reducer.h" |
| 42 #include "src/compiler/move-optimizer.h" | 43 #include "src/compiler/move-optimizer.h" |
| 43 #include "src/compiler/osr.h" | 44 #include "src/compiler/osr.h" |
| 44 #include "src/compiler/pipeline-statistics.h" | 45 #include "src/compiler/pipeline-statistics.h" |
| 45 #include "src/compiler/preprocess-live-ranges.h" | |
| 46 #include "src/compiler/register-allocator.h" | 46 #include "src/compiler/register-allocator.h" |
| 47 #include "src/compiler/register-allocator-verifier.h" | 47 #include "src/compiler/register-allocator-verifier.h" |
| 48 #include "src/compiler/schedule.h" | 48 #include "src/compiler/schedule.h" |
| 49 #include "src/compiler/scheduler.h" | 49 #include "src/compiler/scheduler.h" |
| 50 #include "src/compiler/select-lowering.h" | 50 #include "src/compiler/select-lowering.h" |
| 51 #include "src/compiler/simplified-lowering.h" | 51 #include "src/compiler/simplified-lowering.h" |
| 52 #include "src/compiler/simplified-operator-reducer.h" | 52 #include "src/compiler/simplified-operator-reducer.h" |
| 53 #include "src/compiler/tail-call-optimization.h" | 53 #include "src/compiler/tail-call-optimization.h" |
| 54 #include "src/compiler/typer.h" | 54 #include "src/compiler/typer.h" |
| 55 #include "src/compiler/value-numbering-reducer.h" | 55 #include "src/compiler/value-numbering-reducer.h" |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 struct BuildLiveRangesPhase { | 786 struct BuildLiveRangesPhase { |
| 787 static const char* phase_name() { return "build live ranges"; } | 787 static const char* phase_name() { return "build live ranges"; } |
| 788 | 788 |
| 789 void Run(PipelineData* data, Zone* temp_zone) { | 789 void Run(PipelineData* data, Zone* temp_zone) { |
| 790 LiveRangeBuilder builder(data->register_allocation_data(), temp_zone); | 790 LiveRangeBuilder builder(data->register_allocation_data(), temp_zone); |
| 791 builder.BuildLiveRanges(); | 791 builder.BuildLiveRanges(); |
| 792 } | 792 } |
| 793 }; | 793 }; |
| 794 | 794 |
| 795 | 795 |
| 796 struct PreprocessLiveRangesPhase { | 796 struct SplinterLiveRangesPhase { |
| 797 static const char* phase_name() { return "preprocess live ranges"; } | 797 static const char* phase_name() { return "splinter live ranges"; } |
| 798 | 798 |
| 799 void Run(PipelineData* data, Zone* temp_zone) { | 799 void Run(PipelineData* data, Zone* temp_zone) { |
| 800 PreprocessLiveRanges live_range_preprocessor( | 800 LiveRangeSeparator live_range_splinterer(data->register_allocation_data(), |
| 801 data->register_allocation_data(), temp_zone); | 801 temp_zone); |
| 802 live_range_preprocessor.PreprocessRanges(); | 802 live_range_splinterer.Splinter(); |
| 803 } | 803 } |
| 804 }; | 804 }; |
| 805 | 805 |
| 806 | 806 |
| 807 template <typename RegAllocator> | 807 template <typename RegAllocator> |
| 808 struct AllocateGeneralRegistersPhase { | 808 struct AllocateGeneralRegistersPhase { |
| 809 static const char* phase_name() { return "allocate general registers"; } | 809 static const char* phase_name() { return "allocate general registers"; } |
| 810 | 810 |
| 811 void Run(PipelineData* data, Zone* temp_zone) { | 811 void Run(PipelineData* data, Zone* temp_zone) { |
| 812 RegAllocator allocator(data->register_allocation_data(), GENERAL_REGISTERS, | 812 RegAllocator allocator(data->register_allocation_data(), GENERAL_REGISTERS, |
| 813 temp_zone); | 813 temp_zone); |
| 814 allocator.AllocateRegisters(); | 814 allocator.AllocateRegisters(); |
| 815 } | 815 } |
| 816 }; | 816 }; |
| 817 | 817 |
| 818 | 818 |
| 819 template <typename RegAllocator> | 819 template <typename RegAllocator> |
| 820 struct AllocateDoubleRegistersPhase { | 820 struct AllocateDoubleRegistersPhase { |
| 821 static const char* phase_name() { return "allocate double registers"; } | 821 static const char* phase_name() { return "allocate double registers"; } |
| 822 | 822 |
| 823 void Run(PipelineData* data, Zone* temp_zone) { | 823 void Run(PipelineData* data, Zone* temp_zone) { |
| 824 RegAllocator allocator(data->register_allocation_data(), DOUBLE_REGISTERS, | 824 RegAllocator allocator(data->register_allocation_data(), DOUBLE_REGISTERS, |
| 825 temp_zone); | 825 temp_zone); |
| 826 allocator.AllocateRegisters(); | 826 allocator.AllocateRegisters(); |
| 827 } | 827 } |
| 828 }; | 828 }; |
| 829 | 829 |
| 830 | 830 |
| 831 struct MergeSplintersPhase { |
| 832 static const char* phase_name() { return "merge splintered ranges"; } |
| 833 void Run(PipelineData* pipeline_data, Zone* temp_zone) { |
| 834 RegisterAllocationData* data = pipeline_data->register_allocation_data(); |
| 835 LiveRangeMerger live_range_merger(data, temp_zone); |
| 836 live_range_merger.Merge(); |
| 837 } |
| 838 }; |
| 839 |
| 840 |
| 831 struct LocateSpillSlotsPhase { | 841 struct LocateSpillSlotsPhase { |
| 832 static const char* phase_name() { return "locate spill slots"; } | 842 static const char* phase_name() { return "locate spill slots"; } |
| 833 | 843 |
| 834 void Run(PipelineData* data, Zone* temp_zone) { | 844 void Run(PipelineData* data, Zone* temp_zone) { |
| 835 SpillSlotLocator locator(data->register_allocation_data()); | 845 SpillSlotLocator locator(data->register_allocation_data()); |
| 836 locator.LocateSpillSlots(); | 846 locator.LocateSpillSlots(); |
| 837 } | 847 } |
| 838 }; | 848 }; |
| 839 | 849 |
| 840 | 850 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 if (FLAG_trace_turbo_graph) { | 1341 if (FLAG_trace_turbo_graph) { |
| 1332 OFStream os(stdout); | 1342 OFStream os(stdout); |
| 1333 PrintableInstructionSequence printable = {config, data->sequence()}; | 1343 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1334 os << "----- Instruction sequence before register allocation -----\n" | 1344 os << "----- Instruction sequence before register allocation -----\n" |
| 1335 << printable; | 1345 << printable; |
| 1336 } | 1346 } |
| 1337 if (verifier != nullptr) { | 1347 if (verifier != nullptr) { |
| 1338 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); | 1348 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); |
| 1339 } | 1349 } |
| 1340 | 1350 |
| 1341 if (FLAG_turbo_preprocess_ranges) { | 1351 Run<SplinterLiveRangesPhase>(); |
| 1342 Run<PreprocessLiveRangesPhase>(); | |
| 1343 } | |
| 1344 | 1352 |
| 1345 // TODO(mtrofin): re-enable greedy once we have bots for range preprocessing. | 1353 // TODO(mtrofin): re-enable greedy once we have bots for range preprocessing. |
| 1346 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); | 1354 Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); |
| 1347 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); | 1355 Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); |
| 1348 | 1356 |
| 1357 Run<MergeSplintersPhase>(); |
| 1358 |
| 1349 if (FLAG_turbo_frame_elision) { | 1359 if (FLAG_turbo_frame_elision) { |
| 1350 Run<LocateSpillSlotsPhase>(); | 1360 Run<LocateSpillSlotsPhase>(); |
| 1351 Run<FrameElisionPhase>(); | 1361 Run<FrameElisionPhase>(); |
| 1352 } | 1362 } |
| 1353 | 1363 |
| 1354 Run<AssignSpillSlotsPhase>(); | 1364 Run<AssignSpillSlotsPhase>(); |
| 1355 | 1365 |
| 1356 Run<CommitAssignmentPhase>(); | 1366 Run<CommitAssignmentPhase>(); |
| 1357 Run<PopulateReferenceMapsPhase>(); | 1367 Run<PopulateReferenceMapsPhase>(); |
| 1358 Run<ConnectRangesPhase>(); | 1368 Run<ConnectRangesPhase>(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1378 tcf << AsC1VRegisterAllocationData("CodeGen", | 1388 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1379 data->register_allocation_data()); | 1389 data->register_allocation_data()); |
| 1380 } | 1390 } |
| 1381 | 1391 |
| 1382 data->DeleteRegisterAllocationZone(); | 1392 data->DeleteRegisterAllocationZone(); |
| 1383 } | 1393 } |
| 1384 | 1394 |
| 1385 } // namespace compiler | 1395 } // namespace compiler |
| 1386 } // namespace internal | 1396 } // namespace internal |
| 1387 } // namespace v8 | 1397 } // namespace v8 |
| OLD | NEW |