Commit 31f34b61 authored by Mythri A's avatar Mythri A Committed by Commit Bot

[turboprop] Use existing optimized code if tiering up fails

If an attempt to tiering up fails (for ex: there is not enough space
to enqueue a job) then use the existing optimized code from a lower
tier. Currently we just install interpreter entry trampoline as the
function's code object. Though InterpreterEntryTrampoline checks for
any existing optimized code and installs it on the closure, just
returning it from here saves us these additional checks.

Bug: v8:9684
Change-Id: I62b4bc3b114bbbc9b0702cc9e831a3dfb4b37761
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2682645Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72621}
parent 3b9dd243
...@@ -1905,12 +1905,13 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function, ...@@ -1905,12 +1905,13 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function,
Handle<Code> code; Handle<Code> code;
if (!GetOptimizedCode(function, mode, code_kind).ToHandle(&code)) { if (!GetOptimizedCode(function, mode, code_kind).ToHandle(&code)) {
// Optimization failed, get unoptimized code. Unoptimized code must exist // Optimization failed, get the existing code. We could have optimized code
// already if we are optimizing. // from a lower tier here. Unoptimized code must exist already if we are
// optimizing.
DCHECK(!isolate->has_pending_exception()); DCHECK(!isolate->has_pending_exception());
DCHECK(function->shared().is_compiled()); DCHECK(function->shared().is_compiled());
DCHECK(function->shared().IsInterpreted()); DCHECK(function->shared().IsInterpreted());
code = BUILTIN_CODE(isolate, InterpreterEntryTrampoline); code = ContinuationForConcurrentOptimization(isolate, function);
} }
if (!CodeKindIsNativeContextIndependentJSFunction(code_kind)) { if (!CodeKindIsNativeContextIndependentJSFunction(code_kind)) {
......
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