[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:
parent
33b8bc24a1
commit
471f6baf95
@ -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());
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user