Commit 8daff84d authored by mythria's avatar mythria Committed by Commit bot

Check if the frame is optimized before marking a function for optimization.

When checking for marking a function for optimization, we had a check if
the function is already optimized to return early. This works in non-OSR
cases. For Turbofan OSR even when the current execution of the function
has already been optimized, the function itself will not be replaced
with optimized code. Hence, we may end up checking a function that is
already marked for optimization again. A check for the frame being optimized
avoids these checks.

BUG=

Review-Url: https://codereview.chromium.org/2450233002
Cr-Commit-Position: refs/heads/master@{#40760}
parent 7cfdd66a
...@@ -267,7 +267,7 @@ void RuntimeProfiler::MaybeOptimizeFullCodegen(JSFunction* function, ...@@ -267,7 +267,7 @@ void RuntimeProfiler::MaybeOptimizeFullCodegen(JSFunction* function,
} }
return; return;
} }
if (function->IsOptimized()) return; if (frame->is_optimized()) return;
int ticks = shared_code->profiler_ticks(); int ticks = shared_code->profiler_ticks();
...@@ -361,7 +361,7 @@ void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function, ...@@ -361,7 +361,7 @@ void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function,
return; return;
} }
if (function->IsOptimized()) return; if (frame->is_optimized()) return;
OptimizationReason reason = ShouldOptimizeIgnition(function, frame); OptimizationReason reason = ShouldOptimizeIgnition(function, frame);
...@@ -372,8 +372,6 @@ void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function, ...@@ -372,8 +372,6 @@ void RuntimeProfiler::MaybeOptimizeIgnition(JSFunction* function,
bool RuntimeProfiler::MaybeOSRIgnition(JSFunction* function, bool RuntimeProfiler::MaybeOSRIgnition(JSFunction* function,
JavaScriptFrame* frame) { JavaScriptFrame* frame) {
if (!FLAG_ignition_osr) return false;
SharedFunctionInfo* shared = function->shared(); SharedFunctionInfo* shared = function->shared();
int ticks = shared->profiler_ticks(); int ticks = shared->profiler_ticks();
......
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