Cache method lowering info in mir graph.

This should enable easy inlining checks. It should also
improve compilation time of methods that call the same
methods over and over - it is exactly such methods that
tend to exceed our 100ms time limit.

Change-Id: If01cd18e039071a74a1444570283c153429c9cd4
diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h
index 94b3816..8a33414 100644
--- a/compiler/dex/mir_graph.h
+++ b/compiler/dex/mir_graph.h
@@ -20,8 +20,9 @@
 #include "dex_file.h"
 #include "dex_instruction.h"
 #include "compiler_ir.h"
-#include "mir_field_info.h"
 #include "invoke_type.h"
+#include "mir_field_info.h"
+#include "mir_method_info.h"
 #include "utils/arena_bit_vector.h"
 #include "utils/growable_array.h"
 #include "reg_storage.h"
@@ -267,6 +268,8 @@
     // SGET/SPUT lowering info index, points to MIRGraph::sfield_lowering_infos_. Due to limit on
     // the number of code points (64K) and size of SGET/SPUT insn (2), this will never exceed 32K.
     uint32_t sfield_lowering_info;
+    // INVOKE data index, points to MIRGraph::method_lowering_infos_.
+    uint32_t method_lowering_info;
   } meta;
 };
 
@@ -365,6 +368,7 @@
   bool skip_this;
   bool is_range;
   DexOffset offset;      // Offset in code units.
+  MIR* mir;
 };
 
 
@@ -491,6 +495,13 @@
     return sfield_lowering_infos_.GetRawStorage()[mir->meta.sfield_lowering_info];
   }
 
+  void DoCacheMethodLoweringInfo();
+
+  const MirMethodLoweringInfo& GetMethodLoweringInfo(MIR* mir) {
+    DCHECK_LT(mir->meta.method_lowering_info, method_lowering_infos_.Size());
+    return method_lowering_infos_.GetRawStorage()[mir->meta.method_lowering_info];
+  }
+
   void InitRegLocations();
 
   void RemapRegLocations();
@@ -950,6 +961,7 @@
   bool punt_to_interpreter_;                    // Difficult or not worthwhile - just interpret.
   GrowableArray<MirIFieldLoweringInfo> ifield_lowering_infos_;
   GrowableArray<MirSFieldLoweringInfo> sfield_lowering_infos_;
+  GrowableArray<MirMethodLoweringInfo> method_lowering_infos_;
 
   friend class LocalValueNumberingTest;
 };