Index: src/builtins.h |
diff --git a/src/builtins.h b/src/builtins.h |
index 8eb89a9a8e903f83ffc3d4440301452674584c4b..c87c84ff0c529c261a6da09c3e8db3d75bfe3172 100644 |
--- a/src/builtins.h |
+++ b/src/builtins.h |
@@ -159,11 +159,22 @@ inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) { |
V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
kNoExtraICState) \ |
V(CallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
+ V(TailCallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
+ kNoExtraICState) \ |
+ V(TailCallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
+ kNoExtraICState) \ |
+ V(TailCallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
V(CallBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
+ V(TailCallBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
V(Call_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
kNoExtraICState) \ |
V(Call_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
+ V(TailCall_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
+ kNoExtraICState) \ |
+ V(TailCall_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
+ kNoExtraICState) \ |
+ V(TailCall_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
\ |
V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
V(ConstructBoundFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
@@ -339,8 +350,12 @@ class Builtins { |
#undef DECLARE_BUILTIN_ACCESSOR_A |
// Convenience wrappers. |
- Handle<Code> CallFunction(ConvertReceiverMode = ConvertReceiverMode::kAny); |
- Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny); |
+ Handle<Code> CallFunction( |
+ ConvertReceiverMode = ConvertReceiverMode::kAny, |
+ TailCallMode tail_call_mode = TailCallMode::kDisallow); |
+ Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny, |
+ TailCallMode tail_call_mode = TailCallMode::kDisallow); |
+ Handle<Code> CallBoundFunction(TailCallMode tail_call_mode); |
Code* builtin(Name name) { |
// Code::cast cannot be used here since we access builtins |
@@ -405,30 +420,71 @@ class Builtins { |
// ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) |
static void Generate_CallFunction(MacroAssembler* masm, |
- ConvertReceiverMode mode); |
+ ConvertReceiverMode mode, |
+ TailCallMode tail_call_mode); |
static void Generate_CallFunction_ReceiverIsNullOrUndefined( |
MacroAssembler* masm) { |
- Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined); |
+ Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, |
+ TailCallMode::kDisallow); |
} |
static void Generate_CallFunction_ReceiverIsNotNullOrUndefined( |
MacroAssembler* masm) { |
- Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined); |
+ Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, |
+ TailCallMode::kDisallow); |
} |
static void Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) { |
- Generate_CallFunction(masm, ConvertReceiverMode::kAny); |
+ Generate_CallFunction(masm, ConvertReceiverMode::kAny, |
+ TailCallMode::kDisallow); |
+ } |
+ static void Generate_TailCallFunction_ReceiverIsNullOrUndefined( |
+ MacroAssembler* masm) { |
+ Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, |
+ TailCallMode::kAllow); |
+ } |
+ static void Generate_TailCallFunction_ReceiverIsNotNullOrUndefined( |
+ MacroAssembler* masm) { |
+ Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, |
+ TailCallMode::kAllow); |
+ } |
+ static void Generate_TailCallFunction_ReceiverIsAny(MacroAssembler* masm) { |
+ Generate_CallFunction(masm, ConvertReceiverMode::kAny, |
+ TailCallMode::kAllow); |
} |
// ES6 section 9.4.1.1 [[Call]] ( thisArgument, argumentsList) |
- static void Generate_CallBoundFunction(MacroAssembler* masm); |
+ static void Generate_CallBoundFunctionImpl(MacroAssembler* masm, |
+ TailCallMode tail_call_mode); |
+ static void Generate_CallBoundFunction(MacroAssembler* masm) { |
+ Generate_CallBoundFunctionImpl(masm, TailCallMode::kDisallow); |
+ } |
+ static void Generate_TailCallBoundFunction(MacroAssembler* masm) { |
+ Generate_CallBoundFunctionImpl(masm, TailCallMode::kAllow); |
+ } |
// ES6 section 7.3.12 Call(F, V, [argumentsList]) |
- static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode); |
+ static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode, |
+ TailCallMode tail_call_mode); |
static void Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) { |
- Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined); |
+ Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, |
+ TailCallMode::kDisallow); |
} |
static void Generate_Call_ReceiverIsNotNullOrUndefined(MacroAssembler* masm) { |
- Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined); |
+ Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, |
+ TailCallMode::kDisallow); |
} |
static void Generate_Call_ReceiverIsAny(MacroAssembler* masm) { |
- Generate_Call(masm, ConvertReceiverMode::kAny); |
+ Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kDisallow); |
+ } |
+ static void Generate_TailCall_ReceiverIsNullOrUndefined( |
+ MacroAssembler* masm) { |
+ Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, |
+ TailCallMode::kAllow); |
+ } |
+ static void Generate_TailCall_ReceiverIsNotNullOrUndefined( |
+ MacroAssembler* masm) { |
+ Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, |
+ TailCallMode::kAllow); |
+ } |
+ static void Generate_TailCall_ReceiverIsAny(MacroAssembler* masm) { |
+ Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow); |
} |
// ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget) |