[turbofan] Skip function entry stack check for inlinee.
This is currently the cleanest approach to avoid the useless stack check during inlining. We might be able to just remove the useless stack checks later when we have a phase that also takes care of removing redundant stack checks on loop back edges (which we do not generate currently). On the other hand, the flag introduced here might be useful when building code stubs/builtins/dom stubs using JS based DSL, because you certainly don't want a JS-level stack check in a code stub. R=jarin@chromium.org BUG=v8:3952 LOG=n Review URL: https://codereview.chromium.org/994433002 Cr-Commit-Position: refs/heads/master@{#27058}
This commit is contained in:
parent
9bce5b347f
commit
4b6afb8432
@ -430,7 +430,7 @@ Node* AstGraphBuilder::NewCurrentContextOsrValue() {
|
||||
}
|
||||
|
||||
|
||||
bool AstGraphBuilder::CreateGraph(bool constant_context) {
|
||||
bool AstGraphBuilder::CreateGraph(bool constant_context, bool stack_check) {
|
||||
Scope* scope = info()->scope();
|
||||
DCHECK(graph() != NULL);
|
||||
|
||||
@ -469,10 +469,10 @@ bool AstGraphBuilder::CreateGraph(bool constant_context) {
|
||||
Node* inner_context =
|
||||
BuildLocalFunctionContext(function_context_.get(), closure);
|
||||
ContextScope top_context(this, scope, inner_context);
|
||||
CreateGraphBody();
|
||||
CreateGraphBody(stack_check);
|
||||
} else {
|
||||
// Simply use the outer function context in building the graph.
|
||||
CreateGraphBody();
|
||||
CreateGraphBody(stack_check);
|
||||
}
|
||||
|
||||
// Finish the basic structure of the graph.
|
||||
@ -483,7 +483,7 @@ bool AstGraphBuilder::CreateGraph(bool constant_context) {
|
||||
}
|
||||
|
||||
|
||||
void AstGraphBuilder::CreateGraphBody() {
|
||||
void AstGraphBuilder::CreateGraphBody(bool stack_check) {
|
||||
Scope* scope = info()->scope();
|
||||
|
||||
// Build the arguments object if it is used.
|
||||
@ -508,8 +508,10 @@ void AstGraphBuilder::CreateGraphBody() {
|
||||
VisitDeclarations(scope->declarations());
|
||||
|
||||
// Build a stack-check before the body.
|
||||
Node* node = NewNode(javascript()->StackCheck());
|
||||
PrepareFrameState(node, BailoutId::FunctionEntry());
|
||||
if (stack_check) {
|
||||
Node* node = NewNode(javascript()->StackCheck());
|
||||
PrepareFrameState(node, BailoutId::FunctionEntry());
|
||||
}
|
||||
|
||||
// Visit statements in the function body.
|
||||
VisitStatements(info()->function()->body());
|
||||
|
@ -31,7 +31,7 @@ class AstGraphBuilder : public AstVisitor {
|
||||
LoopAssignmentAnalysis* loop_assignment = NULL);
|
||||
|
||||
// Creates a graph by visiting the entire AST.
|
||||
bool CreateGraph(bool constant_context);
|
||||
bool CreateGraph(bool constant_context, bool stack_check = true);
|
||||
|
||||
// Helpers to create new control nodes.
|
||||
Node* NewIfTrue() { return NewNode(common()->IfTrue()); }
|
||||
@ -125,7 +125,7 @@ class AstGraphBuilder : public AstVisitor {
|
||||
void set_exit_control(Node* exit) { exit_control_ = exit; }
|
||||
|
||||
// Create the main graph body by visiting the AST.
|
||||
void CreateGraphBody();
|
||||
void CreateGraphBody(bool stack_check);
|
||||
|
||||
// Create the node that represents the outer context of the function.
|
||||
void CreateFunctionContext(bool constant_context);
|
||||
|
@ -357,7 +357,7 @@ Reduction JSInliner::Reduce(Node* node) {
|
||||
jsgraph_->javascript(), jsgraph_->machine());
|
||||
|
||||
AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph);
|
||||
graph_builder.CreateGraph(false);
|
||||
graph_builder.CreateGraph(false, false);
|
||||
Inlinee::UnifyReturn(&jsgraph);
|
||||
|
||||
CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone());
|
||||
|
Loading…
Reference in New Issue
Block a user