Add timing logger to Quick compiler

Current Quick compiler breakdown for compiling the boot class path:

MIR2LIR:                    29.674%
MIROpt:SSATransform:        17.656%
MIROpt:BBOpt:               11.508%
BuildMIRGraph:               7.815%
Assemble:                    6.898%
MIROpt:ConstantProp:         5.151%
Cleanup:                     4.916%
MIROpt:NullCheckElimination: 4.085%
RegisterAllocation:          3.972%
GcMap:                       2.359%
Launchpads:                  2.147%
PcMappingTable:              2.145%
MIROpt:CodeLayout:           0.697%
LiteralData:                 0.654%
SpecialMIR2LIR:              0.323%

Change-Id: I9f77e825faf79e6f6b214bb42edcc4b36f55d291
diff --git a/compiler/dex/quick/arm/assemble_arm.cc b/compiler/dex/quick/arm/assemble_arm.cc
index cc40e99..2a6e656 100644
--- a/compiler/dex/quick/arm/assemble_arm.cc
+++ b/compiler/dex/quick/arm/assemble_arm.cc
@@ -1153,6 +1153,7 @@
 void ArmMir2Lir::AssembleLIR() {
   LIR* lir;
   LIR* prev_lir;
+  cu_->NewTimingSplit("Assemble");
   int assembler_retries = 0;
   CodeOffset starting_offset = EncodeRange(first_lir_insn_, last_lir_insn_, 0);
   data_offset_ = (starting_offset + 0x3) & ~0x3;
@@ -1574,6 +1575,7 @@
 
   data_offset_ = (code_buffer_.size() + 0x3) & ~0x3;
 
+  cu_->NewTimingSplit("LiteralData");
   // Install literals
   InstallLiteralPools();
 
@@ -1584,8 +1586,10 @@
   InstallFillArrayData();
 
   // Create the mapping table and native offset to reference map.
+  cu_->NewTimingSplit("PcMappingTable");
   CreateMappingTables();
 
+  cu_->NewTimingSplit("GcMap");
   CreateNativeGcMap();
 }
 
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index 2ce8f58..a6653fa 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -929,6 +929,7 @@
 }
 
 void Mir2Lir::Materialize() {
+  cu_->NewTimingSplit("RegisterAllocation");
   CompilerInitializeRegAlloc();  // Needs to happen after SSA naming
 
   /* Allocate Registers using simple local allocation scheme */
@@ -940,6 +941,7 @@
        * special codegen doesn't succeed, first_lir_insn_ will
        * set to NULL;
        */
+      cu_->NewTimingSplit("SpecialMIR2LIR");
       SpecialMIR2LIR(mir_graph_->GetSpecialCase());
     }
 
diff --git a/compiler/dex/quick/mips/assemble_mips.cc b/compiler/dex/quick/mips/assemble_mips.cc
index ea8b7a6..5f5e5e4 100644
--- a/compiler/dex/quick/mips/assemble_mips.cc
+++ b/compiler/dex/quick/mips/assemble_mips.cc
@@ -768,6 +768,7 @@
  * TODO: consolidate w/ Arm assembly mechanism.
  */
 void MipsMir2Lir::AssembleLIR() {
+  cu_->NewTimingSplit("Assemble");
   AssignOffsets();
   int assembler_retries = 0;
   /*
@@ -792,6 +793,7 @@
   }
 
   // Install literals
+  cu_->NewTimingSplit("LiteralData");
   InstallLiteralPools();
 
   // Install switch tables
@@ -801,8 +803,10 @@
   InstallFillArrayData();
 
   // Create the mapping table and native offset to reference map.
+  cu_->NewTimingSplit("PcMappingTable");
   CreateMappingTables();
 
+  cu_->NewTimingSplit("GcMap");
   CreateNativeGcMap();
 }
 
diff --git a/compiler/dex/quick/mir_to_lir.cc b/compiler/dex/quick/mir_to_lir.cc
index 197e200..fa9a3ad 100644
--- a/compiler/dex/quick/mir_to_lir.cc
+++ b/compiler/dex/quick/mir_to_lir.cc
@@ -819,6 +819,8 @@
 }
 
 void Mir2Lir::MethodMIR2LIR() {
+  cu_->NewTimingSplit("MIR2LIR");
+
   // Hold the labels of each block.
   block_label_list_ =
       static_cast<LIR*>(arena_->Alloc(sizeof(LIR) * mir_graph_->GetNumBlocks(),
@@ -839,7 +841,7 @@
       next_bb = iter.Next();
     } while ((next_bb != NULL) && (next_bb->block_type == kDead));
   }
-
+  cu_->NewTimingSplit("Launchpads");
   HandleSuspendLaunchPads();
 
   HandleThrowLaunchPads();
diff --git a/compiler/dex/quick/x86/assemble_x86.cc b/compiler/dex/quick/x86/assemble_x86.cc
index fb8e75f..0e30260 100644
--- a/compiler/dex/quick/x86/assemble_x86.cc
+++ b/compiler/dex/quick/x86/assemble_x86.cc
@@ -1443,6 +1443,7 @@
  * TODO: consolidate w/ Arm assembly mechanism.
  */
 void X86Mir2Lir::AssembleLIR() {
+  cu_->NewTimingSplit("Assemble");
   AssignOffsets();
   int assembler_retries = 0;
   /*
@@ -1466,6 +1467,7 @@
     }
   }
 
+  cu_->NewTimingSplit("LiteralData");
   // Install literals
   InstallLiteralPools();
 
@@ -1476,8 +1478,10 @@
   InstallFillArrayData();
 
   // Create the mapping table and native offset to reference map.
+  cu_->NewTimingSplit("PcMappingTable");
   CreateMappingTables();
 
+  cu_->NewTimingSplit("GcMap");
   CreateNativeGcMap();
 }