When Crankshaft aborts compilation, use TurboFan next time

When we try to optimize a function with Crankshaft, but compilation
bails out, don't disable optimization for that function entirely,
just disable Crankshaft, so TurboFan will be used for the next attempt.

Thereby this widens the TurboFan intake valve.

Review URL: https://codereview.chromium.org/1751873002

Cr-Commit-Position: refs/heads/master@{#34396}
This commit is contained in:
jkummerow 2016-03-01 07:12:56 -08:00 committed by Commit bot
parent 6f17848caa
commit 4af7757fdf
3 changed files with 16 additions and 4 deletions

View File

@ -248,7 +248,7 @@ namespace internal {
V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
V(kUnsupportedPhiUseOfConstVariable, \
"Unsupported phi use of const variable") \
"Unsupported phi use of const or let variable") \
V(kUnexpectedReturnFromBytecodeHandler, \
"Unexpectedly returned from a bytecode handler") \
V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \

View File

@ -904,8 +904,9 @@ static bool Renumber(ParseInfo* parse_info) {
FunctionLiteral* lit = parse_info->literal();
shared_info->set_ast_node_count(lit->ast_node_count());
MaybeDisableOptimization(shared_info, lit->dont_optimize_reason());
shared_info->set_dont_crankshaft(lit->flags() &
AstProperties::kDontCrankshaft);
shared_info->set_dont_crankshaft(
shared_info->dont_crankshaft() ||
(lit->flags() & AstProperties::kDontCrankshaft));
}
return true;
}

View File

@ -387,7 +387,18 @@ class CompilationInfo {
void DisableFutureOptimization() {
if (GetFlag(kDisableFutureOptimization) && has_shared_info()) {
shared_info()->DisableOptimization(bailout_reason());
// If Crankshaft tried to optimize this function, bailed out, and
// doesn't want to try again, then use TurboFan next time.
if (!shared_info()->dont_crankshaft()) {
shared_info()->set_dont_crankshaft(true);
if (FLAG_trace_opt) {
PrintF("[disabled Crankshaft for ");
shared_info()->ShortPrint();
PrintF(", reason: %s]\n", GetBailoutReason(bailout_reason()));
}
} else {
shared_info()->DisableOptimization(bailout_reason());
}
}
}