Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 212c4efbf2d39a86f278b7c0d76de25f0acc7778..156c44164b319c0fbb8a8cece785ca3b7527d913 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -1246,6 +1246,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
MaybeHandle<SharedFunctionInfo> maybe_result; |
Handle<SharedFunctionInfo> result; |
if (extension == NULL) { |
+ // First check per-isolate compilation cache. |
maybe_result = compilation_cache->LookupScript( |
source, script_name, line_offset, column_offset, |
is_embedder_debug_script, is_shared_cross_origin, context, |
@@ -1253,10 +1254,14 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
if (maybe_result.is_null() && FLAG_serialize_toplevel && |
compile_options == ScriptCompiler::kConsumeCodeCache && |
!isolate->debug()->is_loaded()) { |
+ // Then check cached code provided by embedder. |
HistogramTimerScope timer(isolate->counters()->compile_deserialize()); |
Handle<SharedFunctionInfo> result; |
if (CodeSerializer::Deserialize(isolate, *cached_data, source) |
.ToHandle(&result)) { |
+ // Promote to per-isolate compilation cache. |
+ DCHECK(!result->dont_cache()); |
+ compilation_cache->PutScript(source, context, language_mode, result); |
return result; |
} |
// Deserializer failed. Fall through to compile. |