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

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

Issue 1391333003: Adding support for multiple returns in compiled functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc
index 7200bf0e7a210e11016ff6e50e42a73bcd32710b..403051a5a14ca651fa8cee1c76e3c0080813efae 100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -504,7 +504,7 @@ void InstructionSelector::VisitControl(BasicBlock* block) {
}
case BasicBlock::kReturn: {
DCHECK_EQ(IrOpcode::kReturn, input->opcode());
- return VisitReturn(input->InputAt(0));
+ return VisitReturn(input);
}
case BasicBlock::kDeoptimize: {
// If the result itself is a return, return its input.
@@ -1009,15 +1009,20 @@ void InstructionSelector::VisitGoto(BasicBlock* target) {
}
-void InstructionSelector::VisitReturn(Node* value) {
- DCHECK_NOT_NULL(value);
+void InstructionSelector::VisitReturn(Node* input) {
OperandGenerator g(this);
if (linkage()->GetIncomingDescriptor()->ReturnCount() == 0) {
Emit(kArchRet, g.NoOutput());
} else {
- Emit(kArchRet, g.NoOutput(),
- g.UseLocation(value, linkage()->GetReturnLocation(),
- linkage()->GetReturnType()));
+ const int input_count = input->op()->ValueInputCount();
+ auto value_locations = zone()->NewArray<InstructionOperand>(input_count);
+ for (int i = 0; i < input_count; ++i) {
+ DCHECK_NOT_NULL(input->InputAt(i));
+ value_locations[i] =
+ g.UseLocation(input->InputAt(i), linkage()->GetReturnLocation(i),
+ linkage()->GetReturnType());
titzer 2015/10/07 23:57:05 GetReturnType(i) ?
bradn 2015/10/08 17:13:37 Done.
+ }
+ Emit(kArchRet, 0, nullptr, input_count, value_locations);
}
}

Powered by Google App Engine
This is Rietveld 408576698