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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 void InitializeInstructionSequence() { | 249 void InitializeInstructionSequence() { |
250 DCHECK(sequence_ == nullptr); | 250 DCHECK(sequence_ == nullptr); |
251 InstructionBlocks* instruction_blocks = | 251 InstructionBlocks* instruction_blocks = |
252 InstructionSequence::InstructionBlocksFor(instruction_zone(), | 252 InstructionSequence::InstructionBlocksFor(instruction_zone(), |
253 schedule()); | 253 schedule()); |
254 sequence_ = new (instruction_zone()) InstructionSequence( | 254 sequence_ = new (instruction_zone()) InstructionSequence( |
255 info()->isolate(), instruction_zone(), instruction_blocks); | 255 info()->isolate(), instruction_zone(), instruction_blocks); |
256 } | 256 } |
257 | 257 |
258 void InitializeLiveRangeBuilder(const RegisterConfiguration* config, | 258 void InitializeRegisterAllocationData(const RegisterConfiguration* config, |
259 const char* debug_name) { | 259 const char* debug_name) { |
260 DCHECK(frame_ == nullptr); | 260 DCHECK(frame_ == nullptr); |
261 DCHECK(register_allocation_data_ == nullptr); | 261 DCHECK(register_allocation_data_ == nullptr); |
262 frame_ = new (instruction_zone()) Frame(); | 262 frame_ = new (instruction_zone()) Frame(); |
263 register_allocation_data_ = new (register_allocation_zone()) | 263 register_allocation_data_ = new (register_allocation_zone()) |
264 RegisterAllocationData(config, register_allocation_zone(), frame(), | 264 RegisterAllocationData(config, register_allocation_zone(), frame(), |
265 sequence(), debug_name); | 265 sequence(), debug_name); |
266 } | 266 } |
267 | 267 |
268 private: | 268 private: |
269 Isolate* isolate_; | 269 Isolate* isolate_; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 ConstraintBuilder builder(data->register_allocation_data()); | 729 ConstraintBuilder builder(data->register_allocation_data()); |
730 builder.ResolvePhis(); | 730 builder.ResolvePhis(); |
731 } | 731 } |
732 }; | 732 }; |
733 | 733 |
734 | 734 |
735 struct BuildLiveRangesPhase { | 735 struct BuildLiveRangesPhase { |
736 static const char* phase_name() { return "build live ranges"; } | 736 static const char* phase_name() { return "build live ranges"; } |
737 | 737 |
738 void Run(PipelineData* data, Zone* temp_zone) { | 738 void Run(PipelineData* data, Zone* temp_zone) { |
739 LiveRangeBuilder builder(data->register_allocation_data()); | 739 LiveRangeBuilder builder(data->register_allocation_data(), temp_zone); |
740 builder.BuildLiveRanges(); | 740 builder.BuildLiveRanges(); |
741 } | 741 } |
742 }; | 742 }; |
743 | 743 |
744 | 744 |
745 template <typename RegAllocator> | 745 template <typename RegAllocator> |
746 struct AllocateGeneralRegistersPhase { | 746 struct AllocateGeneralRegistersPhase { |
747 static const char* phase_name() { return "allocate general registers"; } | 747 static const char* phase_name() { return "allocate general registers"; } |
748 | 748 |
749 void Run(PipelineData* data, Zone* temp_zone) { | 749 void Run(PipelineData* data, Zone* temp_zone) { |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 verifier_zone.Reset(new Zone()); | 1248 verifier_zone.Reset(new Zone()); |
1249 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( | 1249 verifier = new (verifier_zone.get()) RegisterAllocatorVerifier( |
1250 verifier_zone.get(), config, data->sequence()); | 1250 verifier_zone.get(), config, data->sequence()); |
1251 } | 1251 } |
1252 | 1252 |
1253 SmartArrayPointer<char> debug_name; | 1253 SmartArrayPointer<char> debug_name; |
1254 #ifdef DEBUG | 1254 #ifdef DEBUG |
1255 debug_name = GetDebugName(data->info()); | 1255 debug_name = GetDebugName(data->info()); |
1256 #endif | 1256 #endif |
1257 | 1257 |
1258 data->InitializeLiveRangeBuilder(config, debug_name.get()); | 1258 data->InitializeRegisterAllocationData(config, debug_name.get()); |
1259 if (info()->is_osr()) { | 1259 if (info()->is_osr()) { |
1260 OsrHelper osr_helper(info()); | 1260 OsrHelper osr_helper(info()); |
1261 osr_helper.SetupFrame(data->frame()); | 1261 osr_helper.SetupFrame(data->frame()); |
1262 } | 1262 } |
1263 | 1263 |
1264 Run<MeetRegisterConstraintsPhase>(); | 1264 Run<MeetRegisterConstraintsPhase>(); |
1265 Run<ResolvePhisPhase>(); | 1265 Run<ResolvePhisPhase>(); |
1266 Run<BuildLiveRangesPhase>(); | 1266 Run<BuildLiveRangesPhase>(); |
1267 if (FLAG_trace_turbo_graph) { | 1267 if (FLAG_trace_turbo_graph) { |
1268 OFStream os(stdout); | 1268 OFStream os(stdout); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 tcf << AsC1VRegisterAllocationData("CodeGen", | 1307 tcf << AsC1VRegisterAllocationData("CodeGen", |
1308 data->register_allocation_data()); | 1308 data->register_allocation_data()); |
1309 } | 1309 } |
1310 | 1310 |
1311 data->DeleteRegisterAllocationZone(); | 1311 data->DeleteRegisterAllocationZone(); |
1312 } | 1312 } |
1313 | 1313 |
1314 } // namespace compiler | 1314 } // namespace compiler |
1315 } // namespace internal | 1315 } // namespace internal |
1316 } // namespace v8 | 1316 } // namespace v8 |
OLD | NEW |