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/bit-vector.h" | 5 #include "src/bit-vector.h" |
6 #include "src/compiler/instruction.h" | 6 #include "src/compiler/instruction.h" |
7 #include "src/compiler/register-allocator-verifier.h" | 7 #include "src/compiler/register-allocator-verifier.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 void BlockAssessments::DropRegisters() { | 294 void BlockAssessments::DropRegisters() { |
295 for (auto iterator = map().begin(), end = map().end(); iterator != end;) { | 295 for (auto iterator = map().begin(), end = map().end(); iterator != end;) { |
296 auto current = iterator; | 296 auto current = iterator; |
297 ++iterator; | 297 ++iterator; |
298 InstructionOperand op = current->first; | 298 InstructionOperand op = current->first; |
299 if (op.IsAnyRegister()) map().erase(current); | 299 if (op.IsAnyRegister()) map().erase(current); |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
| 303 void BlockAssessments::Print() const { |
| 304 OFStream os(stdout); |
| 305 for (const auto pair : map()) { |
| 306 const InstructionOperand op = pair.first; |
| 307 const Assessment* assessment = pair.second; |
| 308 // Use operator<< so we can write the assessment on the same |
| 309 // line. Since we need a register configuration, just pick |
| 310 // Turbofan for now. |
| 311 PrintableInstructionOperand wrapper = {RegisterConfiguration::Turbofan(), |
| 312 op}; |
| 313 os << wrapper << " : "; |
| 314 if (assessment->kind() == AssessmentKind::Final) { |
| 315 os << "v" << FinalAssessment::cast(assessment)->virtual_register(); |
| 316 } else { |
| 317 os << "P"; |
| 318 } |
| 319 os << std::endl; |
| 320 } |
| 321 os << std::endl; |
| 322 } |
| 323 |
303 BlockAssessments* RegisterAllocatorVerifier::CreateForBlock( | 324 BlockAssessments* RegisterAllocatorVerifier::CreateForBlock( |
304 const InstructionBlock* block) { | 325 const InstructionBlock* block) { |
305 RpoNumber current_block_id = block->rpo_number(); | 326 RpoNumber current_block_id = block->rpo_number(); |
306 | 327 |
307 BlockAssessments* ret = new (zone()) BlockAssessments(zone()); | 328 BlockAssessments* ret = new (zone()) BlockAssessments(zone()); |
308 if (block->PredecessorCount() == 0) { | 329 if (block->PredecessorCount() == 0) { |
309 // TODO(mtrofin): the following check should hold, however, in certain | 330 // TODO(mtrofin): the following check should hold, however, in certain |
310 // unit tests it is invalidated by the last block. Investigate and | 331 // unit tests it is invalidated by the last block. Investigate and |
311 // normalize the CFG. | 332 // normalize the CFG. |
312 // CHECK(current_block_id.ToInt() == 0); | 333 // CHECK(current_block_id.ToInt() == 0); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 new (zone()) FinalAssessment(vreg, pending); | 571 new (zone()) FinalAssessment(vreg, pending); |
551 break; | 572 break; |
552 } | 573 } |
553 } | 574 } |
554 } | 575 } |
555 } | 576 } |
556 | 577 |
557 } // namespace compiler | 578 } // namespace compiler |
558 } // namespace internal | 579 } // namespace internal |
559 } // namespace v8 | 580 } // namespace v8 |
OLD | NEW |