Move dex exception helpers to their own file and use dex accessor

Also change the input argument to be a code item accessor
instead of a code item pointer. This removes the dependency on
the code item layout.

Bug: 63756964
Test: test-art-host

Change-Id: If75a168d0b5a77d08fa3c6ba38d00705158911db
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 7ddaa7e..d6e4ce5 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -26,6 +26,7 @@
 #include "class_linker-inl.h"
 #include "debugger.h"
 #include "dex_file-inl.h"
+#include "dex_file_exception_helpers.h"
 #include "dex_instruction.h"
 #include "entrypoints/runtime_asm_entrypoints.h"
 #include "gc/accounting/card_table-inl.h"
@@ -263,7 +264,6 @@
 
 uint32_t ArtMethod::FindCatchBlock(Handle<mirror::Class> exception_type,
                                    uint32_t dex_pc, bool* has_no_move_exception) {
-  const DexFile::CodeItem* code_item = GetCodeItem();
   // Set aside the exception while we resolve its type.
   Thread* self = Thread::Current();
   StackHandleScope<1> hs(self);
@@ -272,7 +272,8 @@
   // Default to handler not found.
   uint32_t found_dex_pc = dex::kDexNoIndex;
   // Iterate over the catch handlers associated with dex_pc.
-  for (CatchHandlerIterator it(*code_item, dex_pc); it.HasNext(); it.Next()) {
+  CodeItemDataAccessor accessor(this);
+  for (CatchHandlerIterator it(accessor, dex_pc); it.HasNext(); it.Next()) {
     dex::TypeIndex iter_type_idx = it.GetHandlerTypeIndex();
     // Catch all case
     if (!iter_type_idx.IsValid()) {
@@ -297,7 +298,7 @@
     }
   }
   if (found_dex_pc != dex::kDexNoIndex) {
-    const Instruction& first_catch_instr = DexInstructions().InstructionAt(found_dex_pc);
+    const Instruction& first_catch_instr = accessor.InstructionAt(found_dex_pc);
     *has_no_move_exception = (first_catch_instr.Opcode() != Instruction::MOVE_EXCEPTION);
   }
   // Put the exception back.