Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 718c0dc8fb00b5ef17ab95546612e5406305e897..8d59dbca2dc90c185eb9eede87562f6bdf69387e 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -960,15 +960,22 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
MaybeHandle<SharedFunctionInfo> maybe_result; |
Handle<SharedFunctionInfo> result; |
if (extension == NULL) { |
- maybe_result = compilation_cache->LookupScript( |
- source, script_name, line_offset, column_offset, |
- is_shared_cross_origin, context); |
- if (maybe_result.is_null() && FLAG_serialize_toplevel && |
+ if (FLAG_serialize_toplevel && |
compile_options == ScriptCompiler::kConsumeCodeCache) { |
return CodeSerializer::Deserialize(isolate, *cached_data, source); |
+ } else { |
Yang
2014/07/22 08:58:17
Without this change, --cache=code for d8 has no ef
|
+ maybe_result = compilation_cache->LookupScript( |
+ source, script_name, line_offset, column_offset, |
+ is_shared_cross_origin, context); |
} |
} |
+ base::ElapsedTimer timer; |
+ if (FLAG_profile_deserialization && FLAG_serialize_toplevel && |
+ compile_options == ScriptCompiler::kProduceCodeCache) { |
+ timer.Start(); |
+ } |
+ |
if (!maybe_result.ToHandle(&result)) { |
// No cache entry found. Compile the script. |
@@ -1002,6 +1009,10 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( |
if (FLAG_serialize_toplevel && |
compile_options == ScriptCompiler::kProduceCodeCache) { |
*cached_data = CodeSerializer::Serialize(isolate, result, source); |
+ if (FLAG_profile_deserialization) { |
+ PrintF("[Compiling and serializing %d bytes took %0.3f ms]\n", |
+ (*cached_data)->length(), timer.Elapsed().InMillisecondsF()); |
+ } |
} |
} |