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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 1760253003: [crankshaft] Support ES6 tail call elimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-crank-2
Patch Set: Addressing comments Created 4 years, 9 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/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index e8e41d49fdd44d9e9a20906c73a6f84477277f64..70af6092af2e5c20d040d1b2e00bf616005cb638 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -7995,8 +7995,8 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunction(
HValue* op_vals[] = {context(), function, arity};
- // TODO(ishell): use tail_call_mode here.
- Callable callable = CodeFactory::Call(isolate(), convert_mode);
+ Callable callable =
+ CodeFactory::Call(isolate(), convert_mode, tail_call_mode);
HConstant* stub = Add<HConstant>(callable.code());
return New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(),
@@ -8013,9 +8013,8 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunctionViaIC(
HValue* op_vals[] = {context(), function, index_val, vector_val};
- // TODO(ishell): use tail_call_mode here.
Callable callable = CodeFactory::CallICInOptimizedCode(
- isolate(), arity, ConvertReceiverMode::kNullOrUndefined);
+ isolate(), arity, ConvertReceiverMode::kNullOrUndefined, tail_call_mode);
HConstant* stub = Add<HConstant>(callable.code());
return New<HCallWithDescriptor>(stub, argument_count, callable.descriptor(),
@@ -8025,9 +8024,8 @@ HInstruction* HOptimizedGraphBuilder::NewCallFunctionViaIC(
HInstruction* HOptimizedGraphBuilder::NewCallConstantFunction(
Handle<JSFunction> function, int argument_count,
TailCallMode tail_call_mode) {
- // TODO(ishell): use tail_call_mode here.
HValue* target = Add<HConstant>(function);
- return New<HInvokeFunction>(target, function, argument_count);
+ return New<HInvokeFunction>(target, function, argument_count, tail_call_mode);
}
@@ -9377,12 +9375,10 @@ void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function,
TailCallMode syntactic_tail_call_mode = expr->tail_call_mode();
TailCallMode tail_call_mode =
function_state()->ComputeTailCallMode(syntactic_tail_call_mode);
- USE(tail_call_mode);
- // TODO(ishell): use tail_call_mode here.
PushArgumentsFromEnvironment(arguments_count);
- HInvokeFunction* call =
- New<HInvokeFunction>(function, known_function, arguments_count);
+ HInvokeFunction* call = New<HInvokeFunction>(function, known_function,
+ arguments_count, tail_call_mode);
Drop(1); // Function
ast_context()->ReturnInstruction(call, expr->id());
}
@@ -9437,16 +9433,12 @@ void HOptimizedGraphBuilder::BuildFunctionApply(Call* expr) {
TailCallMode syntactic_tail_call_mode = expr->tail_call_mode();
TailCallMode tail_call_mode =
function_state()->ComputeTailCallMode(syntactic_tail_call_mode);
- USE(tail_call_mode);
- // TODO(ishell): use tail_call_mode here.
HInstruction* elements = Add<HArgumentsElements>(false);
HInstruction* length = Add<HArgumentsLength>(elements);
HValue* wrapped_receiver = BuildWrapReceiver(receiver, checked_function);
- HInstruction* result = New<HApplyArguments>(function,
- wrapped_receiver,
- length,
- elements);
+ HInstruction* result = New<HApplyArguments>(
+ function, wrapped_receiver, length, elements, tail_call_mode);
ast_context()->ReturnInstruction(result, expr->id());
} else {
// We are inside inlined function and we know exactly what is inside
@@ -9714,9 +9706,6 @@ bool HOptimizedGraphBuilder::CanBeFunctionApplyArguments(Call* expr) {
void HOptimizedGraphBuilder::VisitCall(Call* expr) {
- if (expr->tail_call_mode() == TailCallMode::kAllow) {
- return Bailout(kTailCall);
- }
DCHECK(!HasStackOverflow());
DCHECK(current_block() != NULL);
DCHECK(current_block()->HasPredecessor());
« no previous file with comments | « src/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698