Commit 4af7757f authored by jkummerow's avatar jkummerow Committed by Commit bot

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}
parent 6f17848c
...@@ -248,7 +248,7 @@ namespace internal { ...@@ -248,7 +248,7 @@ namespace internal {
V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \ V(kUnsupportedNonPrimitiveCompare, "Unsupported non-primitive compare") \
V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \ V(kUnsupportedPhiUseOfArguments, "Unsupported phi use of arguments") \
V(kUnsupportedPhiUseOfConstVariable, \ V(kUnsupportedPhiUseOfConstVariable, \
"Unsupported phi use of const variable") \ "Unsupported phi use of const or let variable") \
V(kUnexpectedReturnFromBytecodeHandler, \ V(kUnexpectedReturnFromBytecodeHandler, \
"Unexpectedly returned from a bytecode handler") \ "Unexpectedly returned from a bytecode handler") \
V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \ V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \
......
...@@ -904,8 +904,9 @@ static bool Renumber(ParseInfo* parse_info) { ...@@ -904,8 +904,9 @@ static bool Renumber(ParseInfo* parse_info) {
FunctionLiteral* lit = parse_info->literal(); FunctionLiteral* lit = parse_info->literal();
shared_info->set_ast_node_count(lit->ast_node_count()); shared_info->set_ast_node_count(lit->ast_node_count());
MaybeDisableOptimization(shared_info, lit->dont_optimize_reason()); MaybeDisableOptimization(shared_info, lit->dont_optimize_reason());
shared_info->set_dont_crankshaft(lit->flags() & shared_info->set_dont_crankshaft(
AstProperties::kDontCrankshaft); shared_info->dont_crankshaft() ||
(lit->flags() & AstProperties::kDontCrankshaft));
} }
return true; return true;
} }
......
...@@ -387,7 +387,18 @@ class CompilationInfo { ...@@ -387,7 +387,18 @@ class CompilationInfo {
void DisableFutureOptimization() { void DisableFutureOptimization() {
if (GetFlag(kDisableFutureOptimization) && has_shared_info()) { 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());
}
} }
} }
......
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