Index: src/mips64/builtins-mips64.cc |
diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc |
index 2534de5f3d5f141c1328153fc1369c1b54d53a1c..ee156b80afb03923ed90c8e50dbbb5bffb918975 100644 |
--- a/src/mips64/builtins-mips64.cc |
+++ b/src/mips64/builtins-mips64.cc |
@@ -1956,6 +1956,15 @@ void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); |
Comment cmnt(masm, "[ PrepareForTailCall"); |
+ // Prepare for tail call only if ES2015 tail call elimination is enabled. |
+ Label done; |
+ ExternalReference is_tail_call_elimination_enabled = |
+ ExternalReference::is_tail_call_elimination_enabled_address( |
+ masm->isolate()); |
+ __ li(at, Operand(is_tail_call_elimination_enabled)); |
+ __ lb(scratch1, MemOperand(at)); |
+ __ Branch(&done, eq, scratch1, Operand(zero_reg)); |
+ |
// Drop possible interpreter handler/stub frame. |
{ |
Label no_interpreter_frame; |
@@ -1998,6 +2007,7 @@ void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
ParameterCount callee_args_count(args_reg); |
__ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
scratch3); |
+ __ bind(&done); |
} |
} // namespace |