Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index ed0a0c8e69b028729943f93024e3f3373b7a056c..e86baa02aa3faee01657ee2a7bc980dfc25210b0 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -262,8 +262,11 @@ static bool AlwaysFullCompiler(Isolate* isolate) { |
void RecompileJob::RecordOptimizationStats() { |
Handle<JSFunction> function = info()->closure(); |
- int opt_count = function->shared()->opt_count(); |
- function->shared()->set_opt_count(opt_count + 1); |
+ if (!function->IsOptimized()) { |
+ // Concurrent recompilation and OSR may race. Increment only once. |
+ int opt_count = function->shared()->opt_count(); |
+ function->shared()->set_opt_count(opt_count + 1); |
+ } |
double ms_creategraph = time_taken_to_create_graph_.InMillisecondsF(); |
double ms_optimize = time_taken_to_optimize_.InMillisecondsF(); |
double ms_codegen = time_taken_to_codegen_.InMillisecondsF(); |