Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index dbefcfebfb72adcac99e4e7efe3d67f44aaa47a4..5dc97671435c9e35667ec1adfc159849066ce78b 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -587,6 +587,10 @@ void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { |
// Frame specialization implies function context specialization. |
DCHECK(!info->is_frame_specializing()); |
+ // TODO(4764): When compiling for OSR from bytecode, BailoutId might derive |
+ // from bytecode offset and overlap with actual BailoutId. No caching! |
+ if (info->is_osr() && info->is_optimizing_from_bytecode()) return; |
+ |
// Cache optimized context-specific code. |
Handle<JSFunction> function = info->closure(); |
Handle<SharedFunctionInfo> shared(function->shared()); |
@@ -747,13 +751,18 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, |
Isolate* isolate = function->GetIsolate(); |
Handle<SharedFunctionInfo> shared(function->shared(), isolate); |
- // TODO(4764): Remove this guard once OSR graph construction works. |
- if (!osr_ast_id.IsNone() && osr_frame->is_interpreted()) { |
- return MaybeHandle<Code>(); |
- } |
+ bool ignition_osr = osr_frame && osr_frame->is_interpreted(); |
+ DCHECK_IMPLIES(ignition_osr, !osr_ast_id.IsNone()); |
+ DCHECK_IMPLIES(ignition_osr, FLAG_ignition_osr); |
+ |
+ // Flag combination --ignition-osr --no-turbo-from-bytecode is unsupported. |
+ if (ignition_osr && !FLAG_turbo_from_bytecode) return MaybeHandle<Code>(); |
Handle<Code> cached_code; |
- if (GetCodeFromOptimizedCodeMap(function, osr_ast_id) |
+ // TODO(4764): When compiling for OSR from bytecode, BailoutId might derive |
+ // from bytecode offset and overlap with actual BailoutId. No lookup! |
+ if (!ignition_osr && |
+ GetCodeFromOptimizedCodeMap(function, osr_ast_id) |
.ToHandle(&cached_code)) { |
if (FLAG_trace_opt) { |
PrintF("[found optimized code for "); |
@@ -774,7 +783,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, |
VMState<COMPILER> state(isolate); |
DCHECK(!isolate->has_pending_exception()); |
PostponeInterruptsScope postpone(isolate); |
- bool use_turbofan = UseTurboFan(shared); |
+ bool use_turbofan = UseTurboFan(shared) || ignition_osr; |
std::unique_ptr<CompilationJob> job( |
use_turbofan ? compiler::Pipeline::NewCompilationJob(function) |
: new HCompilationJob(function)); |