Index: src/ppc/builtins-ppc.cc |
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc |
index 75f9c7809c0bce4e2f449c1024eb0bd04c82ff5d..884afedb21b78979195f262a8275e753b6b44bcc 100644 |
--- a/src/ppc/builtins-ppc.cc |
+++ b/src/ppc/builtins-ppc.cc |
@@ -1987,6 +1987,16 @@ 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()); |
+ __ mov(scratch1, Operand(is_tail_call_elimination_enabled)); |
+ __ lbz(scratch1, MemOperand(scratch1)); |
+ __ cmpi(scratch1, Operand::Zero()); |
+ __ beq(&done); |
+ |
// Drop possible interpreter handler/stub frame. |
{ |
Label no_interpreter_frame; |
@@ -2034,6 +2044,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 |