Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Unified Diff: runtime/vm/code_generator.cc

Issue 1559653002: Investigate & fix issues around usage_count and deoptimization_count (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: d Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 723faeb7683efdf8b0aff2fa05ae45e3d72afcaa..d7c92d7feda298ad796111523904d79065fc929e 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -1245,7 +1245,6 @@ DEFINE_RUNTIME_ENTRY(InvokeClosureNoSuchMethod, 3) {
static bool CanOptimizeFunction(const Function& function, Thread* thread) {
- const intptr_t kLowInvocationCount = -100000000;
Isolate* isolate = thread->isolate();
if (isolate->debugger()->IsStepping() ||
isolate->debugger()->HasBreakpoint(function, thread->zone())) {
@@ -1258,14 +1257,16 @@ static bool CanOptimizeFunction(const Function& function, Thread* thread) {
FLAG_max_deoptimization_counter_threshold) {
if (FLAG_trace_failed_optimization_attempts ||
FLAG_stop_on_excessive_deoptimization) {
- OS::PrintErr("Too Many Deoptimizations: %s\n",
+ THR_Print("Too many deoptimizations: %s\n",
function.ToFullyQualifiedCString());
if (FLAG_stop_on_excessive_deoptimization) {
FATAL("Stop on excessive deoptimization");
}
}
- // TODO(srdjan): Investigate excessive deoptimization.
- function.set_usage_counter(kLowInvocationCount);
+ // The function will not be optimized any longer. This situation can occur
+ // mostly with small optimization counter thresholds.
+ function.SetIsOptimizable(false);
+ function.set_usage_counter(INT_MIN);
return false;
}
if (FLAG_optimization_filter != NULL) {
@@ -1287,16 +1288,17 @@ static bool CanOptimizeFunction(const Function& function, Thread* thread) {
}
delete[] filter;
if (!found) {
- function.set_usage_counter(kLowInvocationCount);
+ function.set_usage_counter(INT_MIN);
return false;
}
}
if (!function.IsOptimizable()) {
+ // Huge methods (code size above --huge_method_cutoff_in_code_size) become
+ // non-optimizable only after the code has been generated.
if (FLAG_trace_failed_optimization_attempts) {
- OS::PrintErr("Not Optimizable: %s\n", function.ToFullyQualifiedCString());
+ THR_Print("Not optimizable: %s\n", function.ToFullyQualifiedCString());
}
- // TODO(5442338): Abort as this should not happen.
- function.set_usage_counter(kLowInvocationCount);
+ function.set_usage_counter(INT_MIN);
return false;
}
return true;
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698