Commit 8aa72152 authored by svenpanne's avatar svenpanne Committed by Commit bot

Simplified 'return' handling in the instruction selector.

The RawMachineAssembler now behaves like the rest of TurboFan,
removing the need for some special cases.

Review URL: https://codereview.chromium.org/1090393003

Cr-Commit-Position: refs/heads/master@{#28028}
parent fe9efc12
......@@ -558,11 +558,8 @@ void InstructionSelector::VisitControl(BasicBlock* block) {
return VisitSwitch(input, sw);
}
case BasicBlock::kReturn: {
// If the result itself is a return, return its input.
Node* value = (input != nullptr && input->opcode() == IrOpcode::kReturn)
? input->InputAt(0)
: input;
return VisitReturn(value);
DCHECK_EQ(IrOpcode::kReturn, input->opcode());
return VisitReturn(input->InputAt(0));
}
case BasicBlock::kDeoptimize: {
// If the result itself is a return, return its input.
......@@ -1045,14 +1042,11 @@ void InstructionSelector::VisitGoto(BasicBlock* target) {
void InstructionSelector::VisitReturn(Node* value) {
DCHECK_NOT_NULL(value);
OperandGenerator g(this);
if (value != NULL) {
Emit(kArchRet, g.NoOutput(),
g.UseLocation(value, linkage()->GetReturnLocation(),
linkage()->GetReturnType()));
} else {
Emit(kArchRet, g.NoOutput());
}
Emit(kArchRet, g.NoOutput(),
g.UseLocation(value, linkage()->GetReturnLocation(),
linkage()->GetReturnType()));
}
......
......@@ -101,7 +101,8 @@ void RawMachineAssembler::Switch(Node* index, Label* default_label,
void RawMachineAssembler::Return(Node* value) {
schedule()->AddReturn(CurrentBlock(), value);
Node* ret = NewNode(common()->Return(), value);
schedule()->AddReturn(CurrentBlock(), ret);
current_block_ = NULL;
}
......@@ -183,7 +184,9 @@ Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
Node* node = graph()->NewNode(op, input_count, inputs, incomplete);
BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start()
: CurrentBlock();
schedule()->AddNode(block, node);
if (op->opcode() != IrOpcode::kReturn) {
schedule()->AddNode(block, node);
}
return node;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment