Commit 471f6baf authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[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}
parent 33b8bc24
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment