| 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/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
| 6 #include "src/compiler/register-allocator.h" | 6 #include "src/compiler/register-allocator.h" |
| 7 #include "src/compiler/register-allocator-verifier.h" | 7 #include "src/compiler/register-allocator-verifier.h" |
| 8 #include "test/unittests/test-utils.h" | 8 #include "test/unittests/test-utils.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 RegisterConfiguration* config() { | 144 RegisterConfiguration* config() { |
| 145 if (config_.is_empty()) { | 145 if (config_.is_empty()) { |
| 146 config_.Reset(new RegisterConfiguration( | 146 config_.Reset(new RegisterConfiguration( |
| 147 num_general_registers_, num_double_registers_, num_double_registers_, | 147 num_general_registers_, num_double_registers_, num_double_registers_, |
| 148 general_register_names_, double_register_names_)); | 148 general_register_names_, double_register_names_)); |
| 149 } | 149 } |
| 150 return config_.get(); | 150 return config_.get(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 Frame* frame() { | 153 Frame* frame() { |
| 154 if (frame_.is_empty()) { | 154 if (frame_ == nullptr) { |
| 155 frame_.Reset(new Frame()); | 155 frame_ = new (zone()) Frame(); |
| 156 } | 156 } |
| 157 return frame_.get(); | 157 return frame_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 InstructionSequence* sequence() { | 160 InstructionSequence* sequence() { |
| 161 if (sequence_.is_empty()) { | 161 if (sequence_ == nullptr) { |
| 162 sequence_.Reset(new InstructionSequence(zone(), &instruction_blocks_)); | 162 sequence_ = |
| 163 new (zone()) InstructionSequence(zone(), &instruction_blocks_); |
| 163 } | 164 } |
| 164 return sequence_.get(); | 165 return sequence_; |
| 165 } | 166 } |
| 166 | 167 |
| 167 RegisterAllocator* allocator() { | 168 RegisterAllocator* allocator() { |
| 168 if (allocator_.is_empty()) { | 169 if (allocator_.is_empty()) { |
| 169 allocator_.Reset( | 170 allocator_.Reset( |
| 170 new RegisterAllocator(config(), zone(), frame(), sequence())); | 171 new RegisterAllocator(config(), zone(), frame(), sequence())); |
| 171 } | 172 } |
| 172 return allocator_.get(); | 173 return allocator_.get(); |
| 173 } | 174 } |
| 174 | 175 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 struct LoopData { | 510 struct LoopData { |
| 510 Rpo loop_header_; | 511 Rpo loop_header_; |
| 511 int expected_blocks_; | 512 int expected_blocks_; |
| 512 }; | 513 }; |
| 513 | 514 |
| 514 typedef std::vector<LoopData> LoopBlocks; | 515 typedef std::vector<LoopData> LoopBlocks; |
| 515 typedef std::map<int, const Instruction*> Instructions; | 516 typedef std::map<int, const Instruction*> Instructions; |
| 516 typedef std::vector<BlockCompletion> Completions; | 517 typedef std::vector<BlockCompletion> Completions; |
| 517 | 518 |
| 518 SmartPointer<RegisterConfiguration> config_; | 519 SmartPointer<RegisterConfiguration> config_; |
| 519 SmartPointer<Frame> frame_; | 520 Frame* frame_; |
| 520 SmartPointer<RegisterAllocator> allocator_; | 521 SmartPointer<RegisterAllocator> allocator_; |
| 521 SmartPointer<InstructionSequence> sequence_; | 522 InstructionSequence* sequence_; |
| 522 int num_general_registers_; | 523 int num_general_registers_; |
| 523 int num_double_registers_; | 524 int num_double_registers_; |
| 524 | 525 |
| 525 // Block building state. | 526 // Block building state. |
| 526 InstructionBlocks instruction_blocks_; | 527 InstructionBlocks instruction_blocks_; |
| 527 Instructions instructions_; | 528 Instructions instructions_; |
| 528 int current_instruction_index_; | 529 int current_instruction_index_; |
| 529 Completions completions_; | 530 Completions completions_; |
| 530 LoopBlocks loop_blocks_; | 531 LoopBlocks loop_blocks_; |
| 531 InstructionBlock* current_block_; | 532 InstructionBlock* current_block_; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 StartBlock(); | 744 StartBlock(); |
| 744 Return(DefineConstant()); | 745 Return(DefineConstant()); |
| 745 EndBlock(); | 746 EndBlock(); |
| 746 | 747 |
| 747 Allocate(); | 748 Allocate(); |
| 748 } | 749 } |
| 749 | 750 |
| 750 } // namespace compiler | 751 } // namespace compiler |
| 751 } // namespace internal | 752 } // namespace internal |
| 752 } // namespace v8 | 753 } // namespace v8 |
| OLD | NEW |