Commit 802f3e23 authored by Mythri A's avatar Mythri A Committed by Commit Bot

[runtime] Move the check in %OptimizeFunctionOnNextCall to a later point

Bug: v8:8394, v8:9183, v8:8803
Change-Id: Icd52eaaae28f605b14c0e63d3aca18541e3c8f6e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660616
Commit-Queue: Mythri Alle <mythria@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62190}
parent 8cbbc2e8
......@@ -280,6 +280,16 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
return ReadOnlyRoots(isolate).undefined_value();
}
if (function->HasOptimizedCode()) {
DCHECK(function->IsOptimized() || function->ChecksOptimizationMarker());
// If function is already optimized, remove the bytecode array from the
// pending optimize for test table and return. It is OK if there is no
// entry in the table since if the function got optimized before executing
// %OptimizeFunctionOnNextCall the entry would have been removed.
RemoveBytecodeFromPendingOptimizeTable(isolate, function);
return ReadOnlyRoots(isolate).undefined_value();
}
// Check we called PrepareFunctionForOptimization and hold the bytecode
// array to prevent it from getting flushed.
// TODO(mythria): Enable this check once we add PrepareForOptimization in all
......@@ -289,14 +299,6 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
// ->Lookup(handle(function->shared(), isolate))
// ->IsTheHole());
if (function->HasOptimizedCode()) {
DCHECK(function->IsOptimized() || function->ChecksOptimizationMarker());
// If function is already optimized, remove the bytecode array from the
// pending optimize for test table and return.
RemoveBytecodeFromPendingOptimizeTable(isolate, function);
return ReadOnlyRoots(isolate).undefined_value();
}
ConcurrencyMode concurrency_mode = ConcurrencyMode::kNotConcurrent;
if (args.length() == 2) {
// Ignore invalid inputs produced by fuzzers.
......
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