Commit 329c1e53 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Properly call %TraceExit on explicit return.

So far TurboFan only calls %TraceExit for the implicit
return of undefined, when the function contains no explicit
return statement. To make --trace useful, we also need to
call %TraceExit for ReturnStatement.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1652013002

Cr-Commit-Position: refs/heads/master@{#33659}
parent ae1f32a1
......@@ -610,13 +610,6 @@ void AstGraphBuilder::CreateGraphBody(bool stack_check) {
// Visit statements in the function body.
VisitStatements(info()->literal()->body());
// Emit tracing call if requested to do so.
if (FLAG_trace) {
// TODO(mstarzinger): Only traces implicit return.
Node* return_value = jsgraph()->UndefinedConstant();
NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value);
}
// Return 'undefined' in case we can fall off the end.
BuildReturn(jsgraph()->UndefinedConstant());
}
......@@ -3791,6 +3784,11 @@ Node* AstGraphBuilder::BuildThrowUnsupportedSuperError(BailoutId bailout_id) {
Node* AstGraphBuilder::BuildReturn(Node* return_value) {
// Emit tracing call if requested to do so.
if (FLAG_trace) {
return_value =
NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value);
}
Node* control = NewNode(common()->Return(), return_value);
UpdateControlDependencyToLeaveFunction(control);
return control;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment