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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1652013002: [turbofan] Properly call %TraceExit on explicit return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michis comments. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 // Build a stack-check before the body. 604 // Build a stack-check before the body.
605 if (stack_check) { 605 if (stack_check) {
606 Node* node = NewNode(javascript()->StackCheck()); 606 Node* node = NewNode(javascript()->StackCheck());
607 PrepareFrameState(node, BailoutId::FunctionEntry()); 607 PrepareFrameState(node, BailoutId::FunctionEntry());
608 } 608 }
609 609
610 // Visit statements in the function body. 610 // Visit statements in the function body.
611 VisitStatements(info()->literal()->body()); 611 VisitStatements(info()->literal()->body());
612 612
613 // Emit tracing call if requested to do so.
614 if (FLAG_trace) {
615 // TODO(mstarzinger): Only traces implicit return.
616 Node* return_value = jsgraph()->UndefinedConstant();
617 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value);
618 }
619
620 // Return 'undefined' in case we can fall off the end. 613 // Return 'undefined' in case we can fall off the end.
621 BuildReturn(jsgraph()->UndefinedConstant()); 614 BuildReturn(jsgraph()->UndefinedConstant());
622 } 615 }
623 616
624 617
625 void AstGraphBuilder::ClearNonLiveSlotsInFrameStates() { 618 void AstGraphBuilder::ClearNonLiveSlotsInFrameStates() {
626 if (!FLAG_analyze_environment_liveness || 619 if (!FLAG_analyze_environment_liveness ||
627 !info()->is_deoptimization_enabled()) { 620 !info()->is_deoptimization_enabled()) {
628 return; 621 return;
629 } 622 }
(...skipping 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3790 javascript()->CallRuntime(Runtime::kThrowUnsupportedSuperError); 3783 javascript()->CallRuntime(Runtime::kThrowUnsupportedSuperError);
3791 Node* call = NewNode(op); 3784 Node* call = NewNode(op);
3792 PrepareFrameState(call, bailout_id); 3785 PrepareFrameState(call, bailout_id);
3793 Node* control = NewNode(common()->Throw(), call); 3786 Node* control = NewNode(common()->Throw(), call);
3794 UpdateControlDependencyToLeaveFunction(control); 3787 UpdateControlDependencyToLeaveFunction(control);
3795 return call; 3788 return call;
3796 } 3789 }
3797 3790
3798 3791
3799 Node* AstGraphBuilder::BuildReturn(Node* return_value) { 3792 Node* AstGraphBuilder::BuildReturn(Node* return_value) {
3793 // Emit tracing call if requested to do so.
3794 if (FLAG_trace) {
3795 return_value =
3796 NewNode(javascript()->CallRuntime(Runtime::kTraceExit), return_value);
3797 }
3800 Node* control = NewNode(common()->Return(), return_value); 3798 Node* control = NewNode(common()->Return(), return_value);
3801 UpdateControlDependencyToLeaveFunction(control); 3799 UpdateControlDependencyToLeaveFunction(control);
3802 return control; 3800 return control;
3803 } 3801 }
3804 3802
3805 3803
3806 Node* AstGraphBuilder::BuildThrow(Node* exception_value) { 3804 Node* AstGraphBuilder::BuildThrow(Node* exception_value) {
3807 NewNode(javascript()->CallRuntime(Runtime::kReThrow), exception_value); 3805 NewNode(javascript()->CallRuntime(Runtime::kReThrow), exception_value);
3808 Node* control = NewNode(common()->Throw(), exception_value); 3806 Node* control = NewNode(common()->Throw(), exception_value);
3809 UpdateControlDependencyToLeaveFunction(control); 3807 UpdateControlDependencyToLeaveFunction(control);
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
4340 // Phi does not exist yet, introduce one. 4338 // Phi does not exist yet, introduce one.
4341 value = NewPhi(inputs, value, control); 4339 value = NewPhi(inputs, value, control);
4342 value->ReplaceInput(inputs - 1, other); 4340 value->ReplaceInput(inputs - 1, other);
4343 } 4341 }
4344 return value; 4342 return value;
4345 } 4343 }
4346 4344
4347 } // namespace compiler 4345 } // namespace compiler
4348 } // namespace internal 4346 } // namespace internal
4349 } // namespace v8 4347 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698