Preserve positions for throwing instruction types

This avoids truncating positions over throwing instructions we cant then
be expanded out again. The truncation leads to instructions not covered
by the same potential inline frames which causes lack of precision in
mapping files. The cost of maintaining the position should be low to
none as the shared debug output encoding should eliminate the overhead.

Change-Id: Idc92e1d59ecc8113401bd97ee83f7b515f5da80b
diff --git a/src/main/java/com/android/tools/r8/graph/DexDebugEventBuilder.java b/src/main/java/com/android/tools/r8/graph/DexDebugEventBuilder.java
index c154471..b77b311 100644
--- a/src/main/java/com/android/tools/r8/graph/DexDebugEventBuilder.java
+++ b/src/main/java/com/android/tools/r8/graph/DexDebugEventBuilder.java
@@ -35,7 +35,6 @@
   public static final int NO_PC_INFO = -1;
   private static final int NO_LINE_INFO = -1;
 
-  private final AppView<?> appView;
   private final DexEncodedMethod method;
   private final DexItemFactory factory;
   private final InternalOptions options;
@@ -66,7 +65,6 @@
   private int startLine = NO_LINE_INFO;
 
   public DexDebugEventBuilder(AppView<?> appView, IRCode code) {
-    this.appView = appView;
     method = code.context().getDefinition();
     factory = appView.dexItemFactory();
     options = appView.options();
@@ -76,7 +74,7 @@
   }
 
   /** Add events at pc for instruction. */
-  public void add(int pc, int postPc, Instruction instruction, ProgramMethod context) {
+  public void add(int pc, int postPc, Instruction instruction) {
     boolean isBlockEntry = instruction.getBlock().entry() == instruction;
     boolean isBlockExit = instruction.getBlock().exit() == instruction;
 
@@ -98,9 +96,7 @@
       updateLocals(instruction.asDebugLocalsChange());
     } else if (pcAdvancing) {
       if (!position.isNone() && !position.equals(emittedPosition)) {
-        if (options.debug
-            || instruction.instructionInstanceCanThrow(appView, context)
-            || isComposing) {
+        if (options.debug || instruction.instructionTypeCanThrow() || isComposing) {
           emitDebugPosition(pc, position);
         }
       }
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java b/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java
index 18fc132..3c9c7f3 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/DexBuilder.java
@@ -261,8 +261,7 @@
         dexInstruction.setOffset(instructionOffset);
         instructionOffset += dexInstruction.getSize();
       }
-      debugEventBuilder.add(
-          instructionStartOffset, instructionOffset, irInstruction, getProgramMethod());
+      debugEventBuilder.add(instructionStartOffset, instructionOffset, irInstruction);
     }
 
     // Workaround dalvik tracing bug, where the dalvik tracing JIT can end up tracing