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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 | 382 |
383 static InstructionBlock* InstructionBlockFor(Zone* zone, | 383 static InstructionBlock* InstructionBlockFor(Zone* zone, |
384 const BasicBlock* block) { | 384 const BasicBlock* block) { |
385 InstructionBlock* instr_block = new (zone) InstructionBlock( | 385 InstructionBlock* instr_block = new (zone) InstructionBlock( |
386 zone, block->id(), block->GetRpoNumber(), GetRpo(block->loop_header()), | 386 zone, block->id(), block->GetRpoNumber(), GetRpo(block->loop_header()), |
387 GetLoopEndRpo(block), block->deferred()); | 387 GetLoopEndRpo(block), block->deferred()); |
388 // Map successors and precessors | 388 // Map successors and precessors |
389 instr_block->successors().reserve(block->SuccessorCount()); | 389 instr_block->successors().reserve(block->SuccessorCount()); |
390 for (auto it = block->successors_begin(); it != block->successors_end(); | 390 for (BasicBlock* successor : block->successors()) { |
391 ++it) { | 391 instr_block->successors().push_back(successor->GetRpoNumber()); |
392 instr_block->successors().push_back((*it)->GetRpoNumber()); | |
393 } | 392 } |
394 instr_block->predecessors().reserve(block->PredecessorCount()); | 393 instr_block->predecessors().reserve(block->PredecessorCount()); |
395 for (auto it = block->predecessors_begin(); it != block->predecessors_end(); | 394 for (BasicBlock* predecessor : block->predecessors()) { |
396 ++it) { | 395 instr_block->predecessors().push_back(predecessor->GetRpoNumber()); |
397 instr_block->predecessors().push_back((*it)->GetRpoNumber()); | |
398 } | 396 } |
399 return instr_block; | 397 return instr_block; |
400 } | 398 } |
401 | 399 |
402 | 400 |
403 InstructionBlocks* InstructionSequence::InstructionBlocksFor( | 401 InstructionBlocks* InstructionSequence::InstructionBlocksFor( |
404 Zone* zone, const Schedule* schedule) { | 402 Zone* zone, const Schedule* schedule) { |
405 InstructionBlocks* blocks = zone->NewArray<InstructionBlocks>(1); | 403 InstructionBlocks* blocks = zone->NewArray<InstructionBlocks>(1); |
406 new (blocks) InstructionBlocks( | 404 new (blocks) InstructionBlocks( |
407 static_cast<int>(schedule->rpo_order()->size()), NULL, zone); | 405 static_cast<int>(schedule->rpo_order()->size()), NULL, zone); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 os << " B" << succ_block->id(); | 691 os << " B" << succ_block->id(); |
694 } | 692 } |
695 os << "\n"; | 693 os << "\n"; |
696 } | 694 } |
697 return os; | 695 return os; |
698 } | 696 } |
699 | 697 |
700 } // namespace compiler | 698 } // namespace compiler |
701 } // namespace internal | 699 } // namespace internal |
702 } // namespace v8 | 700 } // namespace v8 |
OLD | NEW |