Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: src/compiler.cc

Issue 408143004: Add profiling to code serializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
+ }
}
}
« no previous file with comments | « no previous file | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698