Reference type propagation

- propagate reference types between instructions
- remove checked casts when possible
- add StackHandleScopeCollection to manage an arbitrary number of stack
handles (see comments)

Change-Id: I31200067c5e7375a5ea8e2f873c4374ebdb5ee60
diff --git a/compiler/optimizing/optimization.h b/compiler/optimizing/optimization.h
index d9e082a..af39e09 100644
--- a/compiler/optimizing/optimization.h
+++ b/compiler/optimizing/optimization.h
@@ -18,6 +18,7 @@
 #define ART_COMPILER_OPTIMIZING_OPTIMIZATION_H_
 
 #include "nodes.h"
+#include "optimizing_compiler_stats.h"
 
 namespace art {
 
@@ -34,8 +35,10 @@
  public:
   HOptimization(HGraph* graph,
                 bool is_in_ssa_form,
-                const char* pass_name)
+                const char* pass_name,
+                OptimizingCompilerStats* stats = nullptr)
       : graph_(graph),
+        stats_(stats),
         is_in_ssa_form_(is_in_ssa_form),
         pass_name_(pass_name) {}
 
@@ -51,7 +54,11 @@
   void Check();
 
  protected:
+  void MaybeRecordStat(MethodCompilationStat compilation_stat) const;
+
   HGraph* const graph_;
+  // Used to record stats about the optimization.
+  OptimizingCompilerStats* const stats_;
 
  private:
   // Does the analyzed graph use the SSA form?