| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 common_(nullptr), | 74 common_(nullptr), |
| 75 javascript_(nullptr), | 75 javascript_(nullptr), |
| 76 jsgraph_(nullptr), | 76 jsgraph_(nullptr), |
| 77 js_type_feedback_(nullptr), | 77 js_type_feedback_(nullptr), |
| 78 typer_(nullptr), | 78 typer_(nullptr), |
| 79 schedule_(nullptr), | 79 schedule_(nullptr), |
| 80 instruction_zone_scope_(zone_pool_), | 80 instruction_zone_scope_(zone_pool_), |
| 81 instruction_zone_(instruction_zone_scope_.zone()), | 81 instruction_zone_(instruction_zone_scope_.zone()), |
| 82 sequence_(nullptr), | 82 sequence_(nullptr), |
| 83 frame_(nullptr), | 83 frame_(nullptr), |
| 84 register_allocator_(nullptr) { | 84 register_allocation_zone_scope_(zone_pool_), |
| 85 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
| 86 live_range_builder_(nullptr) { |
| 85 PhaseScope scope(pipeline_statistics, "init pipeline data"); | 87 PhaseScope scope(pipeline_statistics, "init pipeline data"); |
| 86 graph_ = new (graph_zone_) Graph(graph_zone_); | 88 graph_ = new (graph_zone_) Graph(graph_zone_); |
| 87 source_positions_.Reset(new SourcePositionTable(graph_)); | 89 source_positions_.Reset(new SourcePositionTable(graph_)); |
| 88 machine_ = new (graph_zone_) MachineOperatorBuilder( | 90 machine_ = new (graph_zone_) MachineOperatorBuilder( |
| 89 graph_zone_, kMachPtr, | 91 graph_zone_, kMachPtr, |
| 90 InstructionSelector::SupportedMachineOperatorFlags()); | 92 InstructionSelector::SupportedMachineOperatorFlags()); |
| 91 common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_); | 93 common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_); |
| 92 javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_); | 94 javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_); |
| 93 jsgraph_ = new (graph_zone_) | 95 jsgraph_ = new (graph_zone_) |
| 94 JSGraph(isolate_, graph_, common_, javascript_, machine_); | 96 JSGraph(isolate_, graph_, common_, javascript_, machine_); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 114 common_(nullptr), | 116 common_(nullptr), |
| 115 javascript_(nullptr), | 117 javascript_(nullptr), |
| 116 jsgraph_(nullptr), | 118 jsgraph_(nullptr), |
| 117 js_type_feedback_(nullptr), | 119 js_type_feedback_(nullptr), |
| 118 typer_(nullptr), | 120 typer_(nullptr), |
| 119 schedule_(schedule), | 121 schedule_(schedule), |
| 120 instruction_zone_scope_(zone_pool_), | 122 instruction_zone_scope_(zone_pool_), |
| 121 instruction_zone_(instruction_zone_scope_.zone()), | 123 instruction_zone_(instruction_zone_scope_.zone()), |
| 122 sequence_(nullptr), | 124 sequence_(nullptr), |
| 123 frame_(nullptr), | 125 frame_(nullptr), |
| 124 register_allocator_(nullptr) {} | 126 register_allocation_zone_scope_(zone_pool_), |
| 127 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
| 128 live_range_builder_(nullptr) {} |
| 125 | 129 |
| 126 // For register allocation testing entry point. | 130 // For register allocation testing entry point. |
| 127 PipelineData(ZonePool* zone_pool, CompilationInfo* info, | 131 PipelineData(ZonePool* zone_pool, CompilationInfo* info, |
| 128 InstructionSequence* sequence) | 132 InstructionSequence* sequence) |
| 129 : isolate_(info->isolate()), | 133 : isolate_(info->isolate()), |
| 130 info_(info), | 134 info_(info), |
| 131 outer_zone_(nullptr), | 135 outer_zone_(nullptr), |
| 132 zone_pool_(zone_pool), | 136 zone_pool_(zone_pool), |
| 133 pipeline_statistics_(nullptr), | 137 pipeline_statistics_(nullptr), |
| 134 compilation_failed_(false), | 138 compilation_failed_(false), |
| 135 code_(Handle<Code>::null()), | 139 code_(Handle<Code>::null()), |
| 136 graph_zone_scope_(zone_pool_), | 140 graph_zone_scope_(zone_pool_), |
| 137 graph_zone_(nullptr), | 141 graph_zone_(nullptr), |
| 138 graph_(nullptr), | 142 graph_(nullptr), |
| 139 loop_assignment_(nullptr), | 143 loop_assignment_(nullptr), |
| 140 machine_(nullptr), | 144 machine_(nullptr), |
| 141 common_(nullptr), | 145 common_(nullptr), |
| 142 javascript_(nullptr), | 146 javascript_(nullptr), |
| 143 jsgraph_(nullptr), | 147 jsgraph_(nullptr), |
| 144 js_type_feedback_(nullptr), | 148 js_type_feedback_(nullptr), |
| 145 typer_(nullptr), | 149 typer_(nullptr), |
| 146 schedule_(nullptr), | 150 schedule_(nullptr), |
| 147 instruction_zone_scope_(zone_pool_), | 151 instruction_zone_scope_(zone_pool_), |
| 148 instruction_zone_(sequence->zone()), | 152 instruction_zone_(sequence->zone()), |
| 149 sequence_(sequence), | 153 sequence_(sequence), |
| 150 frame_(nullptr), | 154 frame_(nullptr), |
| 151 register_allocator_(nullptr) {} | 155 register_allocation_zone_scope_(zone_pool_), |
| 156 register_allocation_zone_(register_allocation_zone_scope_.zone()), |
| 157 live_range_builder_(nullptr) {} |
| 152 | 158 |
| 153 ~PipelineData() { | 159 ~PipelineData() { |
| 160 DeleteRegisterAllocationZone(); |
| 154 DeleteInstructionZone(); | 161 DeleteInstructionZone(); |
| 155 DeleteGraphZone(); | 162 DeleteGraphZone(); |
| 156 } | 163 } |
| 157 | 164 |
| 158 Isolate* isolate() const { return isolate_; } | 165 Isolate* isolate() const { return isolate_; } |
| 159 CompilationInfo* info() const { return info_; } | 166 CompilationInfo* info() const { return info_; } |
| 160 ZonePool* zone_pool() const { return zone_pool_; } | 167 ZonePool* zone_pool() const { return zone_pool_; } |
| 161 PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; } | 168 PipelineStatistics* pipeline_statistics() { return pipeline_statistics_; } |
| 162 bool compilation_failed() const { return compilation_failed_; } | 169 bool compilation_failed() const { return compilation_failed_; } |
| 163 void set_compilation_failed() { compilation_failed_ = true; } | 170 void set_compilation_failed() { compilation_failed_ = true; } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 193 | 200 |
| 194 Schedule* schedule() const { return schedule_; } | 201 Schedule* schedule() const { return schedule_; } |
| 195 void set_schedule(Schedule* schedule) { | 202 void set_schedule(Schedule* schedule) { |
| 196 DCHECK(!schedule_); | 203 DCHECK(!schedule_); |
| 197 schedule_ = schedule; | 204 schedule_ = schedule; |
| 198 } | 205 } |
| 199 | 206 |
| 200 Zone* instruction_zone() const { return instruction_zone_; } | 207 Zone* instruction_zone() const { return instruction_zone_; } |
| 201 InstructionSequence* sequence() const { return sequence_; } | 208 InstructionSequence* sequence() const { return sequence_; } |
| 202 Frame* frame() const { return frame_; } | 209 Frame* frame() const { return frame_; } |
| 203 RegisterAllocator* register_allocator() const { return register_allocator_; } | 210 |
| 211 Zone* register_allocation_zone() const { return register_allocation_zone_; } |
| 212 LiveRangeBuilder* live_range_builder() const { return live_range_builder_; } |
| 204 | 213 |
| 205 void DeleteGraphZone() { | 214 void DeleteGraphZone() { |
| 206 // Destroy objects with destructors first. | 215 // Destroy objects with destructors first. |
| 207 source_positions_.Reset(nullptr); | 216 source_positions_.Reset(nullptr); |
| 208 typer_.Reset(nullptr); | 217 typer_.Reset(nullptr); |
| 209 if (graph_zone_ == nullptr) return; | 218 if (graph_zone_ == nullptr) return; |
| 210 // Destroy zone and clear pointers. | 219 // Destroy zone and clear pointers. |
| 211 graph_zone_scope_.Destroy(); | 220 graph_zone_scope_.Destroy(); |
| 212 graph_zone_ = nullptr; | 221 graph_zone_ = nullptr; |
| 213 graph_ = nullptr; | 222 graph_ = nullptr; |
| 214 loop_assignment_ = nullptr; | 223 loop_assignment_ = nullptr; |
| 215 machine_ = nullptr; | 224 machine_ = nullptr; |
| 216 common_ = nullptr; | 225 common_ = nullptr; |
| 217 javascript_ = nullptr; | 226 javascript_ = nullptr; |
| 218 jsgraph_ = nullptr; | 227 jsgraph_ = nullptr; |
| 219 js_type_feedback_ = nullptr; | 228 js_type_feedback_ = nullptr; |
| 220 schedule_ = nullptr; | 229 schedule_ = nullptr; |
| 221 } | 230 } |
| 222 | 231 |
| 223 void DeleteInstructionZone() { | 232 void DeleteInstructionZone() { |
| 224 if (instruction_zone_ == nullptr) return; | 233 if (instruction_zone_ == nullptr) return; |
| 225 instruction_zone_scope_.Destroy(); | 234 instruction_zone_scope_.Destroy(); |
| 226 instruction_zone_ = nullptr; | 235 instruction_zone_ = nullptr; |
| 227 sequence_ = nullptr; | 236 sequence_ = nullptr; |
| 228 frame_ = nullptr; | 237 frame_ = nullptr; |
| 229 register_allocator_ = nullptr; | 238 } |
| 239 |
| 240 void DeleteRegisterAllocationZone() { |
| 241 if (register_allocation_zone_ == nullptr) return; |
| 242 register_allocation_zone_scope_.Destroy(); |
| 243 register_allocation_zone_ = nullptr; |
| 244 live_range_builder_ = nullptr; |
| 230 } | 245 } |
| 231 | 246 |
| 232 void InitializeInstructionSequence() { | 247 void InitializeInstructionSequence() { |
| 233 DCHECK(!sequence_); | 248 DCHECK(sequence_ == nullptr); |
| 234 InstructionBlocks* instruction_blocks = | 249 InstructionBlocks* instruction_blocks = |
| 235 InstructionSequence::InstructionBlocksFor(instruction_zone(), | 250 InstructionSequence::InstructionBlocksFor(instruction_zone(), |
| 236 schedule()); | 251 schedule()); |
| 237 sequence_ = new (instruction_zone()) InstructionSequence( | 252 sequence_ = new (instruction_zone()) InstructionSequence( |
| 238 info()->isolate(), instruction_zone(), instruction_blocks); | 253 info()->isolate(), instruction_zone(), instruction_blocks); |
| 239 } | 254 } |
| 240 | 255 |
| 241 void InitializeRegisterAllocator(Zone* local_zone, | 256 void InitializeLiveRangeBuilder(const RegisterConfiguration* config, |
| 242 const RegisterConfiguration* config, | 257 const char* debug_name) { |
| 243 const char* debug_name) { | 258 DCHECK(frame_ == nullptr); |
| 244 DCHECK(!register_allocator_); | 259 DCHECK(live_range_builder_ == nullptr); |
| 245 DCHECK(!frame_); | |
| 246 frame_ = new (instruction_zone()) Frame(); | 260 frame_ = new (instruction_zone()) Frame(); |
| 247 register_allocator_ = new (instruction_zone()) | 261 live_range_builder_ = new (register_allocation_zone()) LiveRangeBuilder( |
| 248 RegisterAllocator(config, local_zone, frame(), sequence(), debug_name); | 262 config, register_allocation_zone(), frame(), sequence(), debug_name); |
| 249 } | 263 } |
| 250 | 264 |
| 251 private: | 265 private: |
| 252 Isolate* isolate_; | 266 Isolate* isolate_; |
| 253 CompilationInfo* info_; | 267 CompilationInfo* info_; |
| 254 Zone* outer_zone_; | 268 Zone* outer_zone_; |
| 255 ZonePool* const zone_pool_; | 269 ZonePool* const zone_pool_; |
| 256 PipelineStatistics* pipeline_statistics_; | 270 PipelineStatistics* pipeline_statistics_; |
| 257 bool compilation_failed_; | 271 bool compilation_failed_; |
| 258 Handle<Code> code_; | 272 Handle<Code> code_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 274 SmartPointer<Typer> typer_; | 288 SmartPointer<Typer> typer_; |
| 275 Schedule* schedule_; | 289 Schedule* schedule_; |
| 276 | 290 |
| 277 // All objects in the following group of fields are allocated in | 291 // All objects in the following group of fields are allocated in |
| 278 // instruction_zone_. They are all set to NULL when the instruction_zone_ is | 292 // instruction_zone_. They are all set to NULL when the instruction_zone_ is |
| 279 // destroyed. | 293 // destroyed. |
| 280 ZonePool::Scope instruction_zone_scope_; | 294 ZonePool::Scope instruction_zone_scope_; |
| 281 Zone* instruction_zone_; | 295 Zone* instruction_zone_; |
| 282 InstructionSequence* sequence_; | 296 InstructionSequence* sequence_; |
| 283 Frame* frame_; | 297 Frame* frame_; |
| 284 RegisterAllocator* register_allocator_; | 298 |
| 299 // All objects in the following group of fields are allocated in |
| 300 // register_allocation_zone_. They are all set to NULL when the zone is |
| 301 // destroyed. |
| 302 ZonePool::Scope register_allocation_zone_scope_; |
| 303 Zone* register_allocation_zone_; |
| 304 LiveRangeBuilder* live_range_builder_; |
| 285 | 305 |
| 286 DISALLOW_COPY_AND_ASSIGN(PipelineData); | 306 DISALLOW_COPY_AND_ASSIGN(PipelineData); |
| 287 }; | 307 }; |
| 288 | 308 |
| 289 | 309 |
| 290 struct TurboCfgFile : public std::ofstream { | 310 struct TurboCfgFile : public std::ofstream { |
| 291 explicit TurboCfgFile(Isolate* isolate) | 311 explicit TurboCfgFile(Isolate* isolate) |
| 292 : std::ofstream(isolate->GetTurboCfgFileName().c_str(), | 312 : std::ofstream(isolate->GetTurboCfgFileName().c_str(), |
| 293 std::ios_base::app) {} | 313 std::ios_base::app) {} |
| 294 }; | 314 }; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 data->source_positions()); | 706 data->source_positions()); |
| 687 selector.SelectInstructions(); | 707 selector.SelectInstructions(); |
| 688 } | 708 } |
| 689 }; | 709 }; |
| 690 | 710 |
| 691 | 711 |
| 692 struct MeetRegisterConstraintsPhase { | 712 struct MeetRegisterConstraintsPhase { |
| 693 static const char* phase_name() { return "meet register constraints"; } | 713 static const char* phase_name() { return "meet register constraints"; } |
| 694 | 714 |
| 695 void Run(PipelineData* data, Zone* temp_zone) { | 715 void Run(PipelineData* data, Zone* temp_zone) { |
| 696 data->register_allocator()->MeetRegisterConstraints(); | 716 data->live_range_builder()->MeetRegisterConstraints(); |
| 697 } | 717 } |
| 698 }; | 718 }; |
| 699 | 719 |
| 700 | 720 |
| 701 struct ResolvePhisPhase { | 721 struct ResolvePhisPhase { |
| 702 static const char* phase_name() { return "resolve phis"; } | 722 static const char* phase_name() { return "resolve phis"; } |
| 703 | 723 |
| 704 void Run(PipelineData* data, Zone* temp_zone) { | 724 void Run(PipelineData* data, Zone* temp_zone) { |
| 705 data->register_allocator()->ResolvePhis(); | 725 data->live_range_builder()->ResolvePhis(); |
| 706 } | 726 } |
| 707 }; | 727 }; |
| 708 | 728 |
| 709 | 729 |
| 710 struct BuildLiveRangesPhase { | 730 struct BuildLiveRangesPhase { |
| 711 static const char* phase_name() { return "build live ranges"; } | 731 static const char* phase_name() { return "build live ranges"; } |
| 712 | 732 |
| 713 void Run(PipelineData* data, Zone* temp_zone) { | 733 void Run(PipelineData* data, Zone* temp_zone) { |
| 714 data->register_allocator()->BuildLiveRanges(); | 734 data->live_range_builder()->BuildLiveRanges(); |
| 715 } | 735 } |
| 716 }; | 736 }; |
| 717 | 737 |
| 718 | 738 |
| 719 struct AllocateGeneralRegistersPhase { | 739 struct AllocateGeneralRegistersPhase { |
| 720 static const char* phase_name() { return "allocate general registers"; } | 740 static const char* phase_name() { return "allocate general registers"; } |
| 721 | 741 |
| 722 void Run(PipelineData* data, Zone* temp_zone) { | 742 void Run(PipelineData* data, Zone* temp_zone) { |
| 723 data->register_allocator()->AllocateGeneralRegisters(); | 743 LinearScanAllocator allocator(data->live_range_builder(), |
| 744 GENERAL_REGISTERS); |
| 745 allocator.AllocateRegisters(); |
| 724 } | 746 } |
| 725 }; | 747 }; |
| 726 | 748 |
| 727 | 749 |
| 728 struct AllocateDoubleRegistersPhase { | 750 struct AllocateDoubleRegistersPhase { |
| 729 static const char* phase_name() { return "allocate double registers"; } | 751 static const char* phase_name() { return "allocate double registers"; } |
| 730 | 752 |
| 731 void Run(PipelineData* data, Zone* temp_zone) { | 753 void Run(PipelineData* data, Zone* temp_zone) { |
| 732 data->register_allocator()->AllocateDoubleRegisters(); | 754 LinearScanAllocator allocator(data->live_range_builder(), DOUBLE_REGISTERS); |
| 755 allocator.AllocateRegisters(); |
| 733 } | 756 } |
| 734 }; | 757 }; |
| 735 | 758 |
| 736 | 759 |
| 737 struct AssignSpillSlotsPhase { | 760 struct AssignSpillSlotsPhase { |
| 738 static const char* phase_name() { return "assign spill slots"; } | 761 static const char* phase_name() { return "assign spill slots"; } |
| 739 | 762 |
| 740 void Run(PipelineData* data, Zone* temp_zone) { | 763 void Run(PipelineData* data, Zone* temp_zone) { |
| 741 data->register_allocator()->AssignSpillSlots(); | 764 OperandAssigner assigner(data->live_range_builder()); |
| 765 assigner.AssignSpillSlots(); |
| 742 } | 766 } |
| 743 }; | 767 }; |
| 744 | 768 |
| 745 | 769 |
| 746 struct CommitAssignmentPhase { | 770 struct CommitAssignmentPhase { |
| 747 static const char* phase_name() { return "commit assignment"; } | 771 static const char* phase_name() { return "commit assignment"; } |
| 748 | 772 |
| 749 void Run(PipelineData* data, Zone* temp_zone) { | 773 void Run(PipelineData* data, Zone* temp_zone) { |
| 750 data->register_allocator()->CommitAssignment(); | 774 OperandAssigner assigner(data->live_range_builder()); |
| 775 assigner.CommitAssignment(); |
| 751 } | 776 } |
| 752 }; | 777 }; |
| 753 | 778 |
| 754 | 779 |
| 755 struct PopulateReferenceMapsPhase { | 780 struct PopulateReferenceMapsPhase { |
| 756 static const char* phase_name() { return "populate pointer maps"; } | 781 static const char* phase_name() { return "populate pointer maps"; } |
| 757 | 782 |
| 758 void Run(PipelineData* data, Zone* temp_zone) { | 783 void Run(PipelineData* data, Zone* temp_zone) { |
| 759 data->register_allocator()->PopulateReferenceMaps(); | 784 ReferenceMapPopulator populator(data->live_range_builder()); |
| 785 populator.PopulateReferenceMaps(); |
| 760 } | 786 } |
| 761 }; | 787 }; |
| 762 | 788 |
| 763 | 789 |
| 764 struct ConnectRangesPhase { | 790 struct ConnectRangesPhase { |
| 765 static const char* phase_name() { return "connect ranges"; } | 791 static const char* phase_name() { return "connect ranges"; } |
| 766 | 792 |
| 767 void Run(PipelineData* data, Zone* temp_zone) { | 793 void Run(PipelineData* data, Zone* temp_zone) { |
| 768 data->register_allocator()->ConnectRanges(); | 794 LiveRangeConnector connector(data->live_range_builder()); |
| 795 connector.ConnectRanges(temp_zone); |
| 769 } | 796 } |
| 770 }; | 797 }; |
| 771 | 798 |
| 772 | 799 |
| 773 struct ResolveControlFlowPhase { | 800 struct ResolveControlFlowPhase { |
| 774 static const char* phase_name() { return "resolve control flow"; } | 801 static const char* phase_name() { return "resolve control flow"; } |
| 775 | 802 |
| 776 void Run(PipelineData* data, Zone* temp_zone) { | 803 void Run(PipelineData* data, Zone* temp_zone) { |
| 777 data->register_allocator()->ResolveControlFlow(); | 804 LiveRangeConnector connector(data->live_range_builder()); |
| 805 connector.ResolveControlFlow(); |
| 778 } | 806 } |
| 779 }; | 807 }; |
| 780 | 808 |
| 781 | 809 |
| 782 struct OptimizeMovesPhase { | 810 struct OptimizeMovesPhase { |
| 783 static const char* phase_name() { return "optimize moves"; } | 811 static const char* phase_name() { return "optimize moves"; } |
| 784 | 812 |
| 785 void Run(PipelineData* data, Zone* temp_zone) { | 813 void Run(PipelineData* data, Zone* temp_zone) { |
| 786 MoveOptimizer move_optimizer(temp_zone, data->sequence()); | 814 MoveOptimizer move_optimizer(temp_zone, data->sequence()); |
| 787 move_optimizer.Run(); | 815 move_optimizer.Run(); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 verifier_zone.Reset(new Zone()); | 1237 verifier_zone.Reset(new Zone()); |
| 1210 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( | 1238 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( |
| 1211 verifier_zone.get(), config, data->sequence()); | 1239 verifier_zone.get(), config, data->sequence()); |
| 1212 } | 1240 } |
| 1213 | 1241 |
| 1214 SmartArrayPointer<char> debug_name; | 1242 SmartArrayPointer<char> debug_name; |
| 1215 #ifdef DEBUG | 1243 #ifdef DEBUG |
| 1216 debug_name = GetDebugName(data->info()); | 1244 debug_name = GetDebugName(data->info()); |
| 1217 #endif | 1245 #endif |
| 1218 | 1246 |
| 1219 ZonePool::Scope zone_scope(data->zone_pool()); | 1247 data->InitializeLiveRangeBuilder(config, debug_name.get()); |
| 1220 data->InitializeRegisterAllocator(zone_scope.zone(), config, | |
| 1221 debug_name.get()); | |
| 1222 if (info()->is_osr()) { | 1248 if (info()->is_osr()) { |
| 1223 OsrHelper osr_helper(info()); | 1249 OsrHelper osr_helper(info()); |
| 1224 osr_helper.SetupFrame(data->frame()); | 1250 osr_helper.SetupFrame(data->frame()); |
| 1225 } | 1251 } |
| 1226 | 1252 |
| 1227 Run<MeetRegisterConstraintsPhase>(); | 1253 Run<MeetRegisterConstraintsPhase>(); |
| 1228 Run<ResolvePhisPhase>(); | 1254 Run<ResolvePhisPhase>(); |
| 1229 Run<BuildLiveRangesPhase>(); | 1255 Run<BuildLiveRangesPhase>(); |
| 1230 if (FLAG_trace_turbo_graph) { | 1256 if (FLAG_trace_turbo_graph) { |
| 1231 OFStream os(stdout); | 1257 OFStream os(stdout); |
| 1232 PrintableInstructionSequence printable = {config, data->sequence()}; | 1258 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1233 os << "----- Instruction sequence before register allocation -----\n" | 1259 os << "----- Instruction sequence before register allocation -----\n" |
| 1234 << printable; | 1260 << printable; |
| 1235 } | 1261 } |
| 1236 if (verifier != nullptr) { | 1262 if (verifier != nullptr) { |
| 1237 CHECK(!data->register_allocator()->ExistsUseWithoutDefinition()); | 1263 CHECK(!data->live_range_builder()->ExistsUseWithoutDefinition()); |
| 1238 } | 1264 } |
| 1239 Run<AllocateGeneralRegistersPhase>(); | 1265 Run<AllocateGeneralRegistersPhase>(); |
| 1240 Run<AllocateDoubleRegistersPhase>(); | 1266 Run<AllocateDoubleRegistersPhase>(); |
| 1241 Run<AssignSpillSlotsPhase>(); | 1267 Run<AssignSpillSlotsPhase>(); |
| 1242 | 1268 |
| 1243 Run<CommitAssignmentPhase>(); | 1269 Run<CommitAssignmentPhase>(); |
| 1244 Run<PopulateReferenceMapsPhase>(); | 1270 Run<PopulateReferenceMapsPhase>(); |
| 1245 Run<ConnectRangesPhase>(); | 1271 Run<ConnectRangesPhase>(); |
| 1246 Run<ResolveControlFlowPhase>(); | 1272 Run<ResolveControlFlowPhase>(); |
| 1247 if (FLAG_turbo_move_optimization) { | 1273 if (FLAG_turbo_move_optimization) { |
| 1248 Run<OptimizeMovesPhase>(); | 1274 Run<OptimizeMovesPhase>(); |
| 1249 } | 1275 } |
| 1250 | 1276 |
| 1251 if (FLAG_trace_turbo_graph) { | 1277 if (FLAG_trace_turbo_graph) { |
| 1252 OFStream os(stdout); | 1278 OFStream os(stdout); |
| 1253 PrintableInstructionSequence printable = {config, data->sequence()}; | 1279 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1254 os << "----- Instruction sequence after register allocation -----\n" | 1280 os << "----- Instruction sequence after register allocation -----\n" |
| 1255 << printable; | 1281 << printable; |
| 1256 } | 1282 } |
| 1257 | 1283 |
| 1258 if (verifier != nullptr) { | 1284 if (verifier != nullptr) { |
| 1259 verifier->VerifyAssignment(); | 1285 verifier->VerifyAssignment(); |
| 1260 verifier->VerifyGapMoves(); | 1286 verifier->VerifyGapMoves(); |
| 1261 } | 1287 } |
| 1262 | 1288 |
| 1263 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { | 1289 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { |
| 1264 TurboCfgFile tcf(data->isolate()); | 1290 TurboCfgFile tcf(data->isolate()); |
| 1265 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); | 1291 tcf << AsC1VLiveRangeBuilder("CodeGen", data->live_range_builder()); |
| 1266 } | 1292 } |
| 1293 |
| 1294 data->DeleteRegisterAllocationZone(); |
| 1267 } | 1295 } |
| 1268 | 1296 |
| 1269 } // namespace compiler | 1297 } // namespace compiler |
| 1270 } // namespace internal | 1298 } // namespace internal |
| 1271 } // namespace v8 | 1299 } // namespace v8 |
| OLD | NEW |