Index: src/x64/builtins-x64.cc |
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc |
index 2c772995b86f2c8ceab4e6fddd50fd535cec1050..316378348c20fdb37668f50af1a482fd051f153e 100644 |
--- a/src/x64/builtins-x64.cc |
+++ b/src/x64/builtins-x64.cc |
@@ -2052,6 +2052,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 active. |
+ Label done; |
+ ExternalReference is_tail_call_elimination_enabled = |
+ ExternalReference::is_tail_call_elimination_enabled_address( |
+ masm->isolate()); |
+ __ Move(kScratchRegister, is_tail_call_elimination_enabled); |
+ __ cmpb(Operand(kScratchRegister, 0), Immediate(0)); |
+ __ j(equal, &done); |
+ |
// Drop possible interpreter handler/stub frame. |
{ |
Label no_interpreter_frame; |
@@ -2091,6 +2100,7 @@ void PrepareForTailCall(MacroAssembler* masm, Register args_reg, |
ParameterCount callee_args_count(args_reg); |
__ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, |
scratch3, ReturnAddressState::kOnStack); |
+ __ bind(&done); |
} |
} // namespace |