Index: src/compiler/ast-graph-builder.cc |
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc |
index b236775154bf59a1962cfcfea71a4a8e9f48a0f9..fcef520d4b946e29e4c09b5af23eafcd4ed246d0 100644 |
--- a/src/compiler/ast-graph-builder.cc |
+++ b/src/compiler/ast-graph-builder.cc |
@@ -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()); |
} |
@@ -3797,6 +3790,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; |