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

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

Issue 1108563002: Detect simple tail calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed index type 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 | « src/compiler/mips64/code-generator-mips64.cc ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/mips64/instruction-selector-mips64.cc
diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc
index 5b32e10ee04f94cb8ce2409ead221d0da2f9119a..96a67eb87f4c151c9dfc57f4ba5e846147df7d6b 100644
--- a/src/compiler/mips64/instruction-selector-mips64.cc
+++ b/src/compiler/mips64/instruction-selector-mips64.cc
@@ -648,7 +648,8 @@ void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
}
-void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
+void InstructionSelector::VisitCall(Node* node, BasicBlock* handler,
+ CallMode call_mode) {
Mips64OperandGenerator g(this);
const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node);
@@ -683,14 +684,15 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
}
// Select the appropriate opcode based on the call type.
+ bool is_tail_call = call_mode == TAIL_CALL;
InstructionCode opcode;
switch (descriptor->kind()) {
case CallDescriptor::kCallCodeObject: {
- opcode = kArchCallCodeObject;
+ opcode = is_tail_call ? kArchTailCallCodeObject : kArchCallCodeObject;
break;
}
case CallDescriptor::kCallJSFunction:
- opcode = kArchCallJSFunction;
+ opcode = is_tail_call ? kArchTailCallJSFunction : kArchCallJSFunction;
break;
default:
UNREACHABLE();
@@ -699,10 +701,12 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
opcode |= MiscField::encode(flags);
// Emit the call instruction.
+ size_t size = is_tail_call ? 0 : buffer.outputs.size();
+ InstructionOperand* first_output =
+ size > 0 ? &buffer.outputs.front() : nullptr;
Instruction* call_instr =
- Emit(opcode, buffer.outputs.size(), &buffer.outputs.front(),
- buffer.instruction_args.size(), &buffer.instruction_args.front());
-
+ Emit(opcode, size, first_output, buffer.instruction_args.size(),
+ &buffer.instruction_args.front());
call_instr->MarkAsCall();
}
« no previous file with comments | « src/compiler/mips64/code-generator-mips64.cc ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698