Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index fda139750eb2fadc7f21e15ccc00489f5ce6290d..5d0b22fd0c7d12433fe7d1e6d2e5ab84e9ff7752 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -495,6 +495,18 @@ |
Handle<Context> native_context(function->context()->native_context()); |
SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
literals, info->osr_ast_id()); |
+ |
+ // Do not cache (native) context-independent code compiled for OSR. |
+ if (code->is_turbofanned() && info->is_osr()) return; |
+ |
+ // Cache optimized (native) context-independent code. |
+ if (FLAG_turbo_cache_shared_code && code->is_turbofanned() && |
+ !info->is_native_context_specializing()) { |
+ DCHECK(!info->is_function_context_specializing()); |
+ DCHECK(info->osr_ast_id().IsNone()); |
+ Handle<SharedFunctionInfo> shared(function->shared()); |
+ SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(shared, code); |
+ } |
} |
bool Renumber(ParseInfo* parse_info) { |