| 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 register_allocation_data_(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 register_allocation_data_(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 register_allocation_data_(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 RegisterAllocationData* register_allocation_data() const { |
| 213 return register_allocation_data_; |
| 214 } |
| 204 | 215 |
| 205 void DeleteGraphZone() { | 216 void DeleteGraphZone() { |
| 206 // Destroy objects with destructors first. | 217 // Destroy objects with destructors first. |
| 207 source_positions_.Reset(nullptr); | 218 source_positions_.Reset(nullptr); |
| 208 typer_.Reset(nullptr); | 219 typer_.Reset(nullptr); |
| 209 if (graph_zone_ == nullptr) return; | 220 if (graph_zone_ == nullptr) return; |
| 210 // Destroy zone and clear pointers. | 221 // Destroy zone and clear pointers. |
| 211 graph_zone_scope_.Destroy(); | 222 graph_zone_scope_.Destroy(); |
| 212 graph_zone_ = nullptr; | 223 graph_zone_ = nullptr; |
| 213 graph_ = nullptr; | 224 graph_ = nullptr; |
| 214 loop_assignment_ = nullptr; | 225 loop_assignment_ = nullptr; |
| 215 machine_ = nullptr; | 226 machine_ = nullptr; |
| 216 common_ = nullptr; | 227 common_ = nullptr; |
| 217 javascript_ = nullptr; | 228 javascript_ = nullptr; |
| 218 jsgraph_ = nullptr; | 229 jsgraph_ = nullptr; |
| 219 js_type_feedback_ = nullptr; | 230 js_type_feedback_ = nullptr; |
| 220 schedule_ = nullptr; | 231 schedule_ = nullptr; |
| 221 } | 232 } |
| 222 | 233 |
| 223 void DeleteInstructionZone() { | 234 void DeleteInstructionZone() { |
| 224 if (instruction_zone_ == nullptr) return; | 235 if (instruction_zone_ == nullptr) return; |
| 225 instruction_zone_scope_.Destroy(); | 236 instruction_zone_scope_.Destroy(); |
| 226 instruction_zone_ = nullptr; | 237 instruction_zone_ = nullptr; |
| 227 sequence_ = nullptr; | 238 sequence_ = nullptr; |
| 228 frame_ = nullptr; | 239 frame_ = nullptr; |
| 229 register_allocator_ = nullptr; | 240 } |
| 241 |
| 242 void DeleteRegisterAllocationZone() { |
| 243 if (register_allocation_zone_ == nullptr) return; |
| 244 register_allocation_zone_scope_.Destroy(); |
| 245 register_allocation_zone_ = nullptr; |
| 246 register_allocation_data_ = nullptr; |
| 230 } | 247 } |
| 231 | 248 |
| 232 void InitializeInstructionSequence() { | 249 void InitializeInstructionSequence() { |
| 233 DCHECK(!sequence_); | 250 DCHECK(sequence_ == nullptr); |
| 234 InstructionBlocks* instruction_blocks = | 251 InstructionBlocks* instruction_blocks = |
| 235 InstructionSequence::InstructionBlocksFor(instruction_zone(), | 252 InstructionSequence::InstructionBlocksFor(instruction_zone(), |
| 236 schedule()); | 253 schedule()); |
| 237 sequence_ = new (instruction_zone()) InstructionSequence( | 254 sequence_ = new (instruction_zone()) InstructionSequence( |
| 238 info()->isolate(), instruction_zone(), instruction_blocks); | 255 info()->isolate(), instruction_zone(), instruction_blocks); |
| 239 } | 256 } |
| 240 | 257 |
| 241 void InitializeRegisterAllocator(Zone* local_zone, | 258 void InitializeLiveRangeBuilder(const RegisterConfiguration* config, |
| 242 const RegisterConfiguration* config, | 259 const char* debug_name) { |
| 243 const char* debug_name) { | 260 DCHECK(frame_ == nullptr); |
| 244 DCHECK(!register_allocator_); | 261 DCHECK(register_allocation_data_ == nullptr); |
| 245 DCHECK(!frame_); | |
| 246 frame_ = new (instruction_zone()) Frame(); | 262 frame_ = new (instruction_zone()) Frame(); |
| 247 register_allocator_ = new (instruction_zone()) | 263 register_allocation_data_ = new (register_allocation_zone()) |
| 248 RegisterAllocator(config, local_zone, frame(), sequence(), debug_name); | 264 RegisterAllocationData(config, register_allocation_zone(), frame(), |
| 265 sequence(), debug_name); |
| 249 } | 266 } |
| 250 | 267 |
| 251 private: | 268 private: |
| 252 Isolate* isolate_; | 269 Isolate* isolate_; |
| 253 CompilationInfo* info_; | 270 CompilationInfo* info_; |
| 254 Zone* outer_zone_; | 271 Zone* outer_zone_; |
| 255 ZonePool* const zone_pool_; | 272 ZonePool* const zone_pool_; |
| 256 PipelineStatistics* pipeline_statistics_; | 273 PipelineStatistics* pipeline_statistics_; |
| 257 bool compilation_failed_; | 274 bool compilation_failed_; |
| 258 Handle<Code> code_; | 275 Handle<Code> code_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 274 SmartPointer<Typer> typer_; | 291 SmartPointer<Typer> typer_; |
| 275 Schedule* schedule_; | 292 Schedule* schedule_; |
| 276 | 293 |
| 277 // All objects in the following group of fields are allocated in | 294 // 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 | 295 // instruction_zone_. They are all set to NULL when the instruction_zone_ is |
| 279 // destroyed. | 296 // destroyed. |
| 280 ZonePool::Scope instruction_zone_scope_; | 297 ZonePool::Scope instruction_zone_scope_; |
| 281 Zone* instruction_zone_; | 298 Zone* instruction_zone_; |
| 282 InstructionSequence* sequence_; | 299 InstructionSequence* sequence_; |
| 283 Frame* frame_; | 300 Frame* frame_; |
| 284 RegisterAllocator* register_allocator_; | 301 |
| 302 // All objects in the following group of fields are allocated in |
| 303 // register_allocation_zone_. They are all set to NULL when the zone is |
| 304 // destroyed. |
| 305 ZonePool::Scope register_allocation_zone_scope_; |
| 306 Zone* register_allocation_zone_; |
| 307 RegisterAllocationData* register_allocation_data_; |
| 285 | 308 |
| 286 DISALLOW_COPY_AND_ASSIGN(PipelineData); | 309 DISALLOW_COPY_AND_ASSIGN(PipelineData); |
| 287 }; | 310 }; |
| 288 | 311 |
| 289 | 312 |
| 290 struct TurboCfgFile : public std::ofstream { | 313 struct TurboCfgFile : public std::ofstream { |
| 291 explicit TurboCfgFile(Isolate* isolate) | 314 explicit TurboCfgFile(Isolate* isolate) |
| 292 : std::ofstream(isolate->GetTurboCfgFileName().c_str(), | 315 : std::ofstream(isolate->GetTurboCfgFileName().c_str(), |
| 293 std::ios_base::app) {} | 316 std::ios_base::app) {} |
| 294 }; | 317 }; |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 data->source_positions()); | 709 data->source_positions()); |
| 687 selector.SelectInstructions(); | 710 selector.SelectInstructions(); |
| 688 } | 711 } |
| 689 }; | 712 }; |
| 690 | 713 |
| 691 | 714 |
| 692 struct MeetRegisterConstraintsPhase { | 715 struct MeetRegisterConstraintsPhase { |
| 693 static const char* phase_name() { return "meet register constraints"; } | 716 static const char* phase_name() { return "meet register constraints"; } |
| 694 | 717 |
| 695 void Run(PipelineData* data, Zone* temp_zone) { | 718 void Run(PipelineData* data, Zone* temp_zone) { |
| 696 data->register_allocator()->MeetRegisterConstraints(); | 719 LiveRangeBuilder builder(data->register_allocation_data()); |
| 720 builder.MeetRegisterConstraints(); |
| 697 } | 721 } |
| 698 }; | 722 }; |
| 699 | 723 |
| 700 | 724 |
| 701 struct ResolvePhisPhase { | 725 struct ResolvePhisPhase { |
| 702 static const char* phase_name() { return "resolve phis"; } | 726 static const char* phase_name() { return "resolve phis"; } |
| 703 | 727 |
| 704 void Run(PipelineData* data, Zone* temp_zone) { | 728 void Run(PipelineData* data, Zone* temp_zone) { |
| 705 data->register_allocator()->ResolvePhis(); | 729 LiveRangeBuilder builder(data->register_allocation_data()); |
| 730 builder.ResolvePhis(); |
| 706 } | 731 } |
| 707 }; | 732 }; |
| 708 | 733 |
| 709 | 734 |
| 710 struct BuildLiveRangesPhase { | 735 struct BuildLiveRangesPhase { |
| 711 static const char* phase_name() { return "build live ranges"; } | 736 static const char* phase_name() { return "build live ranges"; } |
| 712 | 737 |
| 713 void Run(PipelineData* data, Zone* temp_zone) { | 738 void Run(PipelineData* data, Zone* temp_zone) { |
| 714 data->register_allocator()->BuildLiveRanges(); | 739 LiveRangeBuilder builder(data->register_allocation_data()); |
| 740 builder.BuildLiveRanges(); |
| 715 } | 741 } |
| 716 }; | 742 }; |
| 717 | 743 |
| 718 | 744 |
| 719 struct AllocateGeneralRegistersPhase { | 745 struct AllocateGeneralRegistersPhase { |
| 720 static const char* phase_name() { return "allocate general registers"; } | 746 static const char* phase_name() { return "allocate general registers"; } |
| 721 | 747 |
| 722 void Run(PipelineData* data, Zone* temp_zone) { | 748 void Run(PipelineData* data, Zone* temp_zone) { |
| 723 data->register_allocator()->AllocateGeneralRegisters(); | 749 LinearScanAllocator allocator(data->register_allocation_data(), |
| 750 GENERAL_REGISTERS); |
| 751 allocator.AllocateRegisters(); |
| 724 } | 752 } |
| 725 }; | 753 }; |
| 726 | 754 |
| 727 | 755 |
| 728 struct AllocateDoubleRegistersPhase { | 756 struct AllocateDoubleRegistersPhase { |
| 729 static const char* phase_name() { return "allocate double registers"; } | 757 static const char* phase_name() { return "allocate double registers"; } |
| 730 | 758 |
| 731 void Run(PipelineData* data, Zone* temp_zone) { | 759 void Run(PipelineData* data, Zone* temp_zone) { |
| 732 data->register_allocator()->AllocateDoubleRegisters(); | 760 LinearScanAllocator allocator(data->register_allocation_data(), |
| 761 DOUBLE_REGISTERS); |
| 762 allocator.AllocateRegisters(); |
| 733 } | 763 } |
| 734 }; | 764 }; |
| 735 | 765 |
| 736 | 766 |
| 737 struct AssignSpillSlotsPhase { | 767 struct AssignSpillSlotsPhase { |
| 738 static const char* phase_name() { return "assign spill slots"; } | 768 static const char* phase_name() { return "assign spill slots"; } |
| 739 | 769 |
| 740 void Run(PipelineData* data, Zone* temp_zone) { | 770 void Run(PipelineData* data, Zone* temp_zone) { |
| 741 data->register_allocator()->AssignSpillSlots(); | 771 OperandAssigner assigner(data->register_allocation_data()); |
| 772 assigner.AssignSpillSlots(); |
| 742 } | 773 } |
| 743 }; | 774 }; |
| 744 | 775 |
| 745 | 776 |
| 746 struct CommitAssignmentPhase { | 777 struct CommitAssignmentPhase { |
| 747 static const char* phase_name() { return "commit assignment"; } | 778 static const char* phase_name() { return "commit assignment"; } |
| 748 | 779 |
| 749 void Run(PipelineData* data, Zone* temp_zone) { | 780 void Run(PipelineData* data, Zone* temp_zone) { |
| 750 data->register_allocator()->CommitAssignment(); | 781 OperandAssigner assigner(data->register_allocation_data()); |
| 782 assigner.CommitAssignment(); |
| 751 } | 783 } |
| 752 }; | 784 }; |
| 753 | 785 |
| 754 | 786 |
| 755 struct PopulateReferenceMapsPhase { | 787 struct PopulateReferenceMapsPhase { |
| 756 static const char* phase_name() { return "populate pointer maps"; } | 788 static const char* phase_name() { return "populate pointer maps"; } |
| 757 | 789 |
| 758 void Run(PipelineData* data, Zone* temp_zone) { | 790 void Run(PipelineData* data, Zone* temp_zone) { |
| 759 data->register_allocator()->PopulateReferenceMaps(); | 791 ReferenceMapPopulator populator(data->register_allocation_data()); |
| 792 populator.PopulateReferenceMaps(); |
| 760 } | 793 } |
| 761 }; | 794 }; |
| 762 | 795 |
| 763 | 796 |
| 764 struct ConnectRangesPhase { | 797 struct ConnectRangesPhase { |
| 765 static const char* phase_name() { return "connect ranges"; } | 798 static const char* phase_name() { return "connect ranges"; } |
| 766 | 799 |
| 767 void Run(PipelineData* data, Zone* temp_zone) { | 800 void Run(PipelineData* data, Zone* temp_zone) { |
| 768 data->register_allocator()->ConnectRanges(); | 801 LiveRangeConnector connector(data->register_allocation_data()); |
| 802 connector.ConnectRanges(temp_zone); |
| 769 } | 803 } |
| 770 }; | 804 }; |
| 771 | 805 |
| 772 | 806 |
| 773 struct ResolveControlFlowPhase { | 807 struct ResolveControlFlowPhase { |
| 774 static const char* phase_name() { return "resolve control flow"; } | 808 static const char* phase_name() { return "resolve control flow"; } |
| 775 | 809 |
| 776 void Run(PipelineData* data, Zone* temp_zone) { | 810 void Run(PipelineData* data, Zone* temp_zone) { |
| 777 data->register_allocator()->ResolveControlFlow(); | 811 LiveRangeConnector connector(data->register_allocation_data()); |
| 812 connector.ResolveControlFlow(); |
| 778 } | 813 } |
| 779 }; | 814 }; |
| 780 | 815 |
| 781 | 816 |
| 782 struct OptimizeMovesPhase { | 817 struct OptimizeMovesPhase { |
| 783 static const char* phase_name() { return "optimize moves"; } | 818 static const char* phase_name() { return "optimize moves"; } |
| 784 | 819 |
| 785 void Run(PipelineData* data, Zone* temp_zone) { | 820 void Run(PipelineData* data, Zone* temp_zone) { |
| 786 MoveOptimizer move_optimizer(temp_zone, data->sequence()); | 821 MoveOptimizer move_optimizer(temp_zone, data->sequence()); |
| 787 move_optimizer.Run(); | 822 move_optimizer.Run(); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 verifier_zone.Reset(new Zone()); | 1244 verifier_zone.Reset(new Zone()); |
| 1210 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( | 1245 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( |
| 1211 verifier_zone.get(), config, data->sequence()); | 1246 verifier_zone.get(), config, data->sequence()); |
| 1212 } | 1247 } |
| 1213 | 1248 |
| 1214 SmartArrayPointer<char> debug_name; | 1249 SmartArrayPointer<char> debug_name; |
| 1215 #ifdef DEBUG | 1250 #ifdef DEBUG |
| 1216 debug_name = GetDebugName(data->info()); | 1251 debug_name = GetDebugName(data->info()); |
| 1217 #endif | 1252 #endif |
| 1218 | 1253 |
| 1219 ZonePool::Scope zone_scope(data->zone_pool()); | 1254 data->InitializeLiveRangeBuilder(config, debug_name.get()); |
| 1220 data->InitializeRegisterAllocator(zone_scope.zone(), config, | |
| 1221 debug_name.get()); | |
| 1222 if (info()->is_osr()) { | 1255 if (info()->is_osr()) { |
| 1223 OsrHelper osr_helper(info()); | 1256 OsrHelper osr_helper(info()); |
| 1224 osr_helper.SetupFrame(data->frame()); | 1257 osr_helper.SetupFrame(data->frame()); |
| 1225 } | 1258 } |
| 1226 | 1259 |
| 1227 Run<MeetRegisterConstraintsPhase>(); | 1260 Run<MeetRegisterConstraintsPhase>(); |
| 1228 Run<ResolvePhisPhase>(); | 1261 Run<ResolvePhisPhase>(); |
| 1229 Run<BuildLiveRangesPhase>(); | 1262 Run<BuildLiveRangesPhase>(); |
| 1230 if (FLAG_trace_turbo_graph) { | 1263 if (FLAG_trace_turbo_graph) { |
| 1231 OFStream os(stdout); | 1264 OFStream os(stdout); |
| 1232 PrintableInstructionSequence printable = {config, data->sequence()}; | 1265 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1233 os << "----- Instruction sequence before register allocation -----\n" | 1266 os << "----- Instruction sequence before register allocation -----\n" |
| 1234 << printable; | 1267 << printable; |
| 1235 } | 1268 } |
| 1236 if (verifier != nullptr) { | 1269 if (verifier != nullptr) { |
| 1237 CHECK(!data->register_allocator()->ExistsUseWithoutDefinition()); | 1270 CHECK(!data->register_allocation_data()->ExistsUseWithoutDefinition()); |
| 1238 } | 1271 } |
| 1239 Run<AllocateGeneralRegistersPhase>(); | 1272 Run<AllocateGeneralRegistersPhase>(); |
| 1240 Run<AllocateDoubleRegistersPhase>(); | 1273 Run<AllocateDoubleRegistersPhase>(); |
| 1241 Run<AssignSpillSlotsPhase>(); | 1274 Run<AssignSpillSlotsPhase>(); |
| 1242 | 1275 |
| 1243 Run<CommitAssignmentPhase>(); | 1276 Run<CommitAssignmentPhase>(); |
| 1244 Run<PopulateReferenceMapsPhase>(); | 1277 Run<PopulateReferenceMapsPhase>(); |
| 1245 Run<ConnectRangesPhase>(); | 1278 Run<ConnectRangesPhase>(); |
| 1246 Run<ResolveControlFlowPhase>(); | 1279 Run<ResolveControlFlowPhase>(); |
| 1247 if (FLAG_turbo_move_optimization) { | 1280 if (FLAG_turbo_move_optimization) { |
| 1248 Run<OptimizeMovesPhase>(); | 1281 Run<OptimizeMovesPhase>(); |
| 1249 } | 1282 } |
| 1250 | 1283 |
| 1251 if (FLAG_trace_turbo_graph) { | 1284 if (FLAG_trace_turbo_graph) { |
| 1252 OFStream os(stdout); | 1285 OFStream os(stdout); |
| 1253 PrintableInstructionSequence printable = {config, data->sequence()}; | 1286 PrintableInstructionSequence printable = {config, data->sequence()}; |
| 1254 os << "----- Instruction sequence after register allocation -----\n" | 1287 os << "----- Instruction sequence after register allocation -----\n" |
| 1255 << printable; | 1288 << printable; |
| 1256 } | 1289 } |
| 1257 | 1290 |
| 1258 if (verifier != nullptr) { | 1291 if (verifier != nullptr) { |
| 1259 verifier->VerifyAssignment(); | 1292 verifier->VerifyAssignment(); |
| 1260 verifier->VerifyGapMoves(); | 1293 verifier->VerifyGapMoves(); |
| 1261 } | 1294 } |
| 1262 | 1295 |
| 1263 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { | 1296 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { |
| 1264 TurboCfgFile tcf(data->isolate()); | 1297 TurboCfgFile tcf(data->isolate()); |
| 1265 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); | 1298 tcf << AsC1VRegisterAllocationData("CodeGen", |
| 1299 data->register_allocation_data()); |
| 1266 } | 1300 } |
| 1301 |
| 1302 data->DeleteRegisterAllocationZone(); |
| 1267 } | 1303 } |
| 1268 | 1304 |
| 1269 } // namespace compiler | 1305 } // namespace compiler |
| 1270 } // namespace internal | 1306 } // namespace internal |
| 1271 } // namespace v8 | 1307 } // namespace v8 |
| OLD | NEW |