[compiler] Move generator optimization heuristics.

This moves the decision whether to optimize generator or async functions
into the AstNumberingVisitor. Optimization heuristics that are based on
the function source should be encapsulated in this class.

R=neis@chromium.org

Review-Url: https://codereview.chromium.org/2065543002
Cr-Commit-Position: refs/heads/master@{#36924}
This commit is contained in:
mstarzinger 2016-06-13 04:42:19 -07:00 committed by Commit bot
parent 33b8bc24a1
commit 471f6baf95
2 changed files with 4 additions and 6 deletions

View File

@ -579,6 +579,10 @@ bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
DisableCrankshaft(kRestParameter);
}
if (IsGeneratorFunction(node->kind()) || IsAsyncFunction(node->kind())) {
DisableOptimization(kGenerator);
}
VisitDeclarations(scope->declarations());
VisitStatements(node->body());

View File

@ -2085,12 +2085,6 @@ Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
shared->set_num_literals(number_of_literals);
if (IsGeneratorFunction(kind)) {
shared->set_instance_class_name(isolate()->heap()->Generator_string());
shared->DisableOptimization(kGenerator);
}
if (IsAsyncFunction(kind)) {
// TODO(caitp): Enable optimization of async functions when they are enabled
// for generators functions.
shared->DisableOptimization(kGenerator);
}
return shared;
}