Revision: 22521
Author: [email protected]
Date: Tue Jul 22 10:35:38 2014 UTC
Log: Add profiling to code serializer.
[email protected]
Review URL: https://codereview.chromium.org/408143004
http://code.google.com/p/v8/source/detail?r=22521
Modified:
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/serialize.cc
=======================================
--- /branches/bleeding_edge/src/compiler.cc Mon Jul 21 09:58:01 2014 UTC
+++ /branches/bleeding_edge/src/compiler.cc Tue Jul 22 10:35:38 2014 UTC
@@ -960,14 +960,21 @@
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 {
+ 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 @@
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());
+ }
}
}
=======================================
--- /branches/bleeding_edge/src/serialize.cc Wed Jul 16 09:55:34 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc Tue Jul 22 10:35:38 2014 UTC
@@ -1991,11 +1991,12 @@
Handle<SharedFunctionInfo> CodeSerializer::Deserialize(Isolate* isolate,
ScriptData* data,
Handle<String>
source) {
+ base::ElapsedTimer timer;
+ if (FLAG_profile_deserialization) timer.Start();
SerializedCodeData scd(data, *source);
SnapshotByteSource payload(scd.Payload(), scd.PayloadLength());
Deserializer deserializer(&payload);
STATIC_ASSERT(NEW_SPACE == 0);
- // TODO(yangguo) what happens if remaining new space is too small?
for (int i = NEW_SPACE; i <= PROPERTY_CELL_SPACE; i++) {
deserializer.set_reservation(i, scd.GetReservation(i));
}
@@ -2009,6 +2010,11 @@
Object* root;
deserializer.DeserializePartial(isolate, &root);
deserializer.FlushICacheForNewCodeObjects();
+ if (FLAG_profile_deserialization) {
+ double ms = timer.Elapsed().InMillisecondsF();
+ int length = data->length();
+ PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms);
+ }
return Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root),
isolate);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.