InitializeAstVisitor(zone);
}
- void Renumber(FunctionLiteral* node);
+ bool Renumber(FunctionLiteral* node);
private:
// AST node visitor interface.
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);
}
-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.
}
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
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
// 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());
}
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;
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.