| Index: src/compiler/instruction-selector.cc
|
| diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
|
| index c4af7e88f8d7e3f36381d4bc61a0e8ccb75c5c8e..2503b6ee43e4782e87f632521788a2e2ef5dc924 100644
|
| --- a/src/compiler/instruction-selector.cc
|
| +++ b/src/compiler/instruction-selector.cc
|
| @@ -29,12 +29,13 @@ InstructionSelector::InstructionSelector(
|
| source_position_mode_(source_position_mode),
|
| features_(features),
|
| schedule_(schedule),
|
| - current_block_(NULL),
|
| + current_block_(nullptr),
|
| instructions_(zone),
|
| defined_(node_count, false, zone),
|
| used_(node_count, false, zone),
|
| virtual_registers_(node_count,
|
| - InstructionOperand::kInvalidVirtualRegister, zone) {
|
| + InstructionOperand::kInvalidVirtualRegister, zone),
|
| + scheduler_(nullptr) {
|
| instructions_.reserve(node_count);
|
| }
|
|
|
| @@ -61,17 +62,51 @@ void InstructionSelector::SelectInstructions() {
|
| }
|
|
|
| // Schedule the selected instructions.
|
| + if (FLAG_turbo_instruction_scheduling) {
|
| + scheduler_ = new (zone()) InstructionScheduler(zone(), sequence());
|
| + }
|
| +
|
| for (auto const block : *blocks) {
|
| InstructionBlock* instruction_block =
|
| sequence()->InstructionBlockAt(RpoNumber::FromInt(block->rpo_number()));
|
| size_t end = instruction_block->code_end();
|
| size_t start = instruction_block->code_start();
|
| DCHECK_LE(end, start);
|
| - sequence()->StartBlock(RpoNumber::FromInt(block->rpo_number()));
|
| + StartBlock(RpoNumber::FromInt(block->rpo_number()));
|
| while (start-- > end) {
|
| - sequence()->AddInstruction(instructions_[start]);
|
| + AddInstruction(instructions_[start]);
|
| }
|
| - sequence()->EndBlock(RpoNumber::FromInt(block->rpo_number()));
|
| + EndBlock(RpoNumber::FromInt(block->rpo_number()));
|
| + }
|
| +}
|
| +
|
| +
|
| +void InstructionSelector::StartBlock(RpoNumber rpo) {
|
| + if (FLAG_turbo_instruction_scheduling) {
|
| + DCHECK(scheduler_ != nullptr);
|
| + scheduler_->StartBlock(rpo);
|
| + } else {
|
| + sequence()->StartBlock(rpo);
|
| + }
|
| +}
|
| +
|
| +
|
| +void InstructionSelector::EndBlock(RpoNumber rpo) {
|
| + if (FLAG_turbo_instruction_scheduling) {
|
| + DCHECK(scheduler_ != nullptr);
|
| + scheduler_->EndBlock(rpo);
|
| + } else {
|
| + sequence()->EndBlock(rpo);
|
| + }
|
| +}
|
| +
|
| +
|
| +void InstructionSelector::AddInstruction(Instruction* instr) {
|
| + if (FLAG_turbo_instruction_scheduling) {
|
| + DCHECK(scheduler_ != nullptr);
|
| + scheduler_->AddInstruction(instr);
|
| + } else {
|
| + sequence()->AddInstruction(instr);
|
| }
|
| }
|
|
|
| @@ -1434,7 +1469,7 @@ void InstructionSelector::VisitDeoptimize(Node* value) {
|
|
|
| void InstructionSelector::VisitThrow(Node* value) {
|
| OperandGenerator g(this);
|
| - Emit(kArchNop, g.NoOutput()); // TODO(titzer)
|
| + Emit(kArchThrowTerminator, g.NoOutput()); // TODO(titzer)
|
| }
|
|
|
|
|
|
|