diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc index 80d7e046cb..d8008ac44a 100644 --- a/src/compiler/ast-graph-builder.cc +++ b/src/compiler/ast-graph-builder.cc @@ -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()); diff --git a/src/compiler/ast-graph-builder.h b/src/compiler/ast-graph-builder.h index 0ce24652db..c577333bf5 100644 --- a/src/compiler/ast-graph-builder.h +++ b/src/compiler/ast-graph-builder.h @@ -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); diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc index e1d3fcbc04..6a739c2cc3 100644 --- a/src/compiler/js-inlining.cc +++ b/src/compiler/js-inlining.cc @@ -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());