Make slow paths easier to write

This adds a class LIRSlowPath that allows for deferred compilation
of slow paths.  Using this object you can add code that will be
invoked out of line using a forward branch.  The intention is to
move the slow paths out of the main flow and avoid branch-over
constructs that will almost always trigger.  The forward branch
to the slow path code will be predicted false and this will
be correct most of the time.  The slow path code returns to the
instruction after the original branch using an unconditional branch.

This is used in the following opcodes: sput, sget, const-string,
check-cast, const-class.

Others will follow.

Bug: 10864890
Change-Id: I17130c5dc20d369bc6bbf50b8cf04343263e888e
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index 072c6fa..5e0fed7 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -1003,7 +1003,8 @@
       core_spill_mask_(0),
       fp_spill_mask_(0),
       first_lir_insn_(NULL),
-      last_lir_insn_(NULL) {
+      last_lir_insn_(NULL),
+      slow_paths_(arena, 32, kGrowableArraySlowPaths) {
   // Reserve pointer id 0 for NULL.
   size_t null_idx = WrapPointer(NULL);
   DCHECK_EQ(null_idx, 0U);
@@ -1182,4 +1183,7 @@
   return branch;
 }
 
+void Mir2Lir::AddSlowPath(LIRSlowPath* slowpath) {
+  slow_paths_.Insert(slowpath);
+}
 }  // namespace art