Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: src/compiler/instruction-selector.cc

Issue 1090393003: Simplified 'return' handling in the instruction selector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/raw-machine-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
index 29f8ed4dc7aaab04139900e61122a74be76994a0..005e038a89c7c30902039f9be9093c43ad6924e7 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -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()));
}
« no previous file with comments | « no previous file | src/compiler/raw-machine-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698