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

Unified Diff: src/builtins.h

Issue 1609893003: [es6] Tail calls support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing Created 4 years, 11 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/bootstrapper.cc ('k') | src/builtins.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « src/bootstrapper.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698