Revision: 17071
Author:   [email protected]
Date:     Wed Oct  2 11:27:37 2013 UTC
Log: Add a flag to print the time it takes to compile HydrogenCodeStubs.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/25693003
http://code.google.com/p/v8/source/detail?r=17071

Modified:
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/flag-definitions.h

=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Tue Oct 1 18:00:02 2013 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Wed Oct 2 11:27:37 2013 UTC
@@ -301,9 +301,18 @@
     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;
 }


=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Tue Oct  1 18:00:02 2013 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Wed Oct  2 11:27:37 2013 UTC
@@ -200,6 +200,9 @@

   virtual void PrintName(StringStream* stream);

+  // Returns a name for logging/debugging purposes.
+  SmartArrayPointer<const char> GetName();
+
  protected:
   static bool CanUseFPRegisters();

@@ -211,8 +214,6 @@
   // a fixed (non-moveable) code object.
   virtual bool NeedsImmovableCode() { return false; }

-  // Returns a name for logging/debugging purposes.
-  SmartArrayPointer<const char> GetName();
   virtual void PrintBaseName(StringStream* stream);
   virtual void PrintState(StringStream* stream) { }

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Mon Sep 30 14:06:43 2013 UTC +++ /branches/bleeding_edge/src/flag-definitions.h Wed Oct 2 11:27:37 2013 UTC
@@ -621,6 +621,11 @@
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 @@
             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