Reviewers: Yang,

Description:
Add a flag to print the time it takes to compile HydrogenCodeStubs.

BUG=

Please review this at https://codereview.chromium.org/25693003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+16, -1 lines):
  M src/code-stubs-hydrogen.cc
  M src/flag-definitions.h


Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 2700dbbe9c505c4e42a667695fe5ea409646c9d9..64a6dedd3257df56fda75c2d10a4a2239e706176 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -301,9 +301,18 @@ static Handle<Code> DoGenerateCode(Isolate* isolate, Stub* stub) {
     ASSERT(descriptor->stack_parameter_count_ == NULL);
     return stub->GenerateLightweightMissCode(isolate);
   }
+  ElapsedTimer timer;
+  if (FLAG_profile_hydrogen_code_stub_compilation) {
+    timer.Start();
+  }
   CodeStubGraphBuilder<Stub> builder(isolate, stub);
   LChunk* chunk = OptimizeGraph(builder.CreateGraph());
-  return chunk->Codegen();
+  Handle<Code> code = chunk->Codegen();
+  if (FLAG_profile_hydrogen_code_stub_compilation) {
+    double ms = timer.Elapsed().InMillisecondsF();
+ PrintF("[Lazy compilation of %s took %0.3f ms]\n", *stub->GetName(), ms);
+  }
+  return code;
 }


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index f4df2b950d508292d0d18fd30594768e030bda9c..b16396ebc78a7acd4ccdb241037644c25476aedc 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -621,6 +621,11 @@ DEFINE_string(testing_serialization_file, "/tmp/serdes", DEFINE_string(extra_code, NULL, "A filename with extra code to be included in"
                   " the snapshot (mksnapshot only)")

+// code-stubs-hydrogen.cc
+DEFINE_bool(profile_hydrogen_code_stub_compilation,
+            false,
+ "Print the time it takes to lazily compile hydrogen code stubs.")
+
 //
 // Dev shell flags
 //
@@ -801,6 +806,7 @@ DEFINE_bool(test_primary_stub_cache,
             false,
             "test primary stub cache by disabling the secondary one")

+
 // codegen-ia32.cc / codegen-arm.cc
 DEFINE_bool(print_code, false, "print generated code")
 DEFINE_bool(print_opt_code, false, "print optimized code")


--
--
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/groups/opt_out.

Reply via email to