Reviewers: Sven Panne,
Description:
Move more don't-crankshaft computation to numbering pass
The "do I inline?" decision needs many of the same inputs as the "should
I even try to crankshaft?" decision. This change consolidates these
checks in the numbering pass. It also removes the is_generator() check,
as that's already handled when visiting the initial Yield expression.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/775693003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+23, -39 lines):
M src/ast-numbering.cc
M src/hydrogen.cc
Index: src/ast-numbering.cc
diff --git a/src/ast-numbering.cc b/src/ast-numbering.cc
index
e9b9050ae7d0caec6cb018e0e11b54e94fbd1b1b..c2dd70e1bbe75086a0de3e9097aac6d2b3dc49c1
100644
--- a/src/ast-numbering.cc
+++ b/src/ast-numbering.cc
@@ -23,7 +23,7 @@ class AstNumberingVisitor FINAL : public AstVisitor {
InitializeAstVisitor(zone);
}
- void Renumber(FunctionLiteral* node);
+ bool Renumber(FunctionLiteral* node);
private:
// AST node visitor interface.
@@ -31,6 +31,8 @@ class AstNumberingVisitor FINAL : public AstVisitor {
AST_NODE_LIST(DEFINE_VISIT)
#undef DEFINE_VISIT
+ bool Finish(FunctionLiteral* node);
+
void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE;
void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE;
void VisitArguments(ZoneList<Expression*>* arguments);
@@ -537,14 +539,26 @@ void
AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) {
}
-void AstNumberingVisitor::Renumber(FunctionLiteral* node) {
- if (node->scope()->HasIllegalRedeclaration()) {
- node->scope()->VisitIllegalRedeclaration(this);
- node->set_ast_properties(&properties_);
- return;
- }
+bool AstNumberingVisitor::Finish(FunctionLiteral* node) {
+ node->set_ast_properties(&properties_);
+ node->set_dont_optimize_reason(dont_optimize_reason());
+ return !HasStackOverflow();
+}
+
+bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
Scope* scope = node->scope();
+
+ if (scope->HasIllegalRedeclaration()) {
+ scope->VisitIllegalRedeclaration(this);
+ DisableCrankshaft(kFunctionWithIllegalRedeclaration);
+ return Finish(node);
+ }
+ if (scope->calls_eval()) DisableCrankshaft(kFunctionCallsEval);
+ if (scope->arguments() != NULL
&& !scope->arguments()->IsStackAllocated()) {
+ DisableCrankshaft(kContextAllocatedArguments);
+ }
+
VisitDeclarations(scope->declarations());
if (scope->is_function_scope() && scope->function() != NULL) {
// Visit the name of the named function expression.
@@ -552,15 +566,13 @@ void AstNumberingVisitor::Renumber(FunctionLiteral*
node) {
}
VisitStatements(node->body());
- node->set_ast_properties(&properties_);
- node->set_dont_optimize_reason(dont_optimize_reason());
+ return Finish(node);
}
bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) {
AstNumberingVisitor visitor(zone);
- visitor.Renumber(function);
- return !visitor.HasStackOverflow();
+ return visitor.Renumber(function);
}
}
} // namespace v8::internal
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
eec5de3a0c23004efeeec5ad0d206dfc37ea157e..707cf9c801443e52821d5bfd650b012fa8dd6e79
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4290,19 +4290,7 @@ void
HOptimizedGraphBuilder::VisitExpressions(ZoneList<Expression*>* exprs,
bool HOptimizedGraphBuilder::BuildGraph() {
- if (current_info()->function()->is_generator()) {
- Bailout(kFunctionIsAGenerator);
- return false;
- }
Scope* scope = current_info()->scope();
- if (scope->HasIllegalRedeclaration()) {
- Bailout(kFunctionWithIllegalRedeclaration);
- return false;
- }
- if (scope->calls_eval()) {
- Bailout(kFunctionCallsEval);
- return false;
- }
SetUpScope(scope);
// Add an edge to the body entry. This is warty: the graph's start
@@ -4538,10 +4526,6 @@ void HOptimizedGraphBuilder::SetUpScope(Scope*
scope) {
// Handle the arguments and arguments shadow variables specially (they do
// not have declarations).
if (scope->arguments() != NULL) {
- if (!scope->arguments()->IsStackAllocated()) {
- return Bailout(kContextAllocatedArguments);
- }
-
environment()->Bind(scope->arguments(),
graph()->GetArgumentsObject());
}
@@ -7931,11 +7915,6 @@ bool
HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
return false;
}
- if (target_info.scope()->HasIllegalRedeclaration()) {
- TraceInline(target, caller, "target has illegal redeclaration");
- return false;
- }
-
if (target_info.scope()->num_heap_slots() > 0) {
TraceInline(target, caller, "target has context-allocated variables");
return false;
@@ -7962,13 +7941,6 @@ bool
HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target,
TraceInline(target, caller, "target uses arguments object");
return false;
}
-
- if (!function->scope()->arguments()->IsStackAllocated()) {
- TraceInline(target,
- caller,
- "target uses non-stackallocated arguments object");
- return false;
- }
}
// All declarations must be inlineable.
--
--
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.