Reviewers: jarin,
Description:
[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.
[email protected]
Please review this at https://codereview.chromium.org/994433002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+11, -9 lines):
M src/compiler/ast-graph-builder.h
M src/compiler/ast-graph-builder.cc
M src/compiler/js-inlining.cc
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
80d7e046cb7db3496154d9ae810f7cd97446ff6b..d8008ac44a0f370815efc19d570aa464f3fc675c
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());
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h
b/src/compiler/ast-graph-builder.h
index
0ce24652db3ad3aceb9fdb57e4e342499fb1cc60..c577333bf5904bd01f5eacb1506c8a7898d088a6
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);
Index: src/compiler/js-inlining.cc
diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc
index
e1d3fcbc0465dfd47ddea53208adff2b53025188..6a739c2cc36bf026b9ed01e6e2b6f71b5e6664f5
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());
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.