| Index: src/runtime/runtime-compiler.cc
|
| diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc
|
| index de974a2df505aee31ec1604508e95b362ed3d13e..81f29887926f88264fc15fa4bffcf7d4665cf6c6 100644
|
| --- a/src/runtime/runtime-compiler.cc
|
| +++ b/src/runtime/runtime-compiler.cc
|
| @@ -34,12 +34,28 @@ RUNTIME_FUNCTION(Runtime_CompileLazy) {
|
| // Compile the target function.
|
| DCHECK(function->shared()->allows_lazy_compilation());
|
|
|
| + // There is one special case where we have optimized code but we
|
| + // couldn't find a literals array for the native context. That's with
|
| + // FLAG_turbo_cache_shared_code.
|
| + if (FLAG_turbo_cache_shared_code) {
|
| + SharedFunctionInfo* shared = function->shared();
|
| + CodeAndLiterals result;
|
| + result = shared->SearchOptimizedCodeMap(*isolate->native_context(),
|
| + BailoutId::None());
|
| + if (result.code != nullptr) {
|
| + function->ReplaceCode(result.code);
|
| + JSFunction::EnsureLiterals(function);
|
| + return result.code;
|
| + }
|
| + }
|
| +
|
| Handle<Code> code;
|
| ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, code,
|
| Compiler::GetLazyCode(function));
|
| DCHECK(code->IsJavaScriptCode());
|
|
|
| function->ReplaceCode(*code);
|
| + JSFunction::EnsureLiterals(function);
|
| return *code;
|
| }
|
|
|
| @@ -71,6 +87,7 @@ Object* CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
|
|
|
| DCHECK(function->code()->kind() == Code::FUNCTION ||
|
| function->code()->kind() == Code::OPTIMIZED_FUNCTION ||
|
| + function->code()->is_interpreter_entry_trampoline() ||
|
| function->IsInOptimizationQueue());
|
| return function->code();
|
| }
|
|
|