Revert "Revert "Revert "Use trampolines for calls to helpers"""

This reverts commit f9487c039efb4112616d438593a2ab02792e0304.

Change-Id: Id48a4aae4ecce73db468587967968a3f7618b700
diff --git a/compiler/dex/quick/arm/arm_lir.h b/compiler/dex/quick/arm/arm_lir.h
index 8c5c6c5..c9acd66 100644
--- a/compiler/dex/quick/arm/arm_lir.h
+++ b/compiler/dex/quick/arm/arm_lir.h
@@ -496,7 +496,6 @@
   kThumb2LdrdPcRel8,  // ldrd rt, rt2, pc +-/1024.
   kThumb2LdrdI8,     // ldrd rt, rt2, [rn +-/1024].
   kThumb2StrdI8,     // strd rt, rt2, [rn +-/1024].
-  kThumb2BlTramp,    // Thumb2 BL to trampoline
   kArmLast,
 };
 
diff --git a/compiler/dex/quick/arm/assemble_arm.cc b/compiler/dex/quick/arm/assemble_arm.cc
index 0e1275d..f77b0a6 100644
--- a/compiler/dex/quick/arm/assemble_arm.cc
+++ b/compiler/dex/quick/arm/assemble_arm.cc
@@ -1035,11 +1035,6 @@
                  kFmtBitBlt, 7, 0,
                  IS_QUAD_OP | REG_USE0 | REG_USE1 | REG_USE2 | IS_STORE,
                  "strd", "!0C, !1C, [!2C, #!3E]", 4, kFixupNone),
-    ENCODING_MAP(kThumb2BlTramp, 0xf000d000,
-                 kFmtBitBlt, 10, 0, kFmtUnused, -1, -1, kFmtUnused, -1, -1,
-                 kFmtUnused, -1, -1,
-                 IS_UNARY_OP | IS_BRANCH | REG_DEF_LR | NEEDS_FIXUP,
-                 "bl", "!0t", 4, kFixupTrampCall),
 };
 
 // new_lir replaces orig_lir in the pcrel_fixup list.
@@ -1229,7 +1224,6 @@
   while (true) {
     offset_adjustment = 0;
     AssemblerStatus res = kSuccess;  // Assume success
-
     generation ^= 1;
     // Note: nodes requring possible fixup linked in ascending order.
     lir = first_fixup_;
@@ -1583,17 +1577,6 @@
           }
           break;
         }
-        case kFixupTrampCall: {
-          // This is a call to a trampoline.  The value for the trampoline call needs
-          // both the offset into the code and the trampoline to call.  It will be
-          // added to the list of calls when we actually insert this instruction into
-          // the code_buffer (when we have a stable instruction stream).
-          uint32_t instoffset = lir->offset;
-           // LOG(INFO) << "adding trampoline call: offset: " << instoffset <<
-             //  " entrypoint: " << lir->operands[0];
-          trampoline_calls_.push_back(TrampolineCall(instoffset, lir->operands[0]));
-          break;
-        }
         default:
           LOG(FATAL) << "Unexpected case " << lir->flags.fixup;
       }
@@ -1612,7 +1595,6 @@
       starting_offset += offset_adjustment;
       data_offset_ = (starting_offset + 0x3) & ~0x3;
       AssignDataOffsets();
-      trampoline_calls_.clear();            // These are invalid now.
     }
   }
 
@@ -1693,4 +1675,5 @@
 
   total_size_ = AssignFillArrayDataOffset(offset);
 }
+
 }  // namespace art
diff --git a/compiler/dex/quick/arm/call_arm.cc b/compiler/dex/quick/arm/call_arm.cc
index 1b485a3..d0d0e6b 100644
--- a/compiler/dex/quick/arm/call_arm.cc
+++ b/compiler/dex/quick/arm/call_arm.cc
@@ -19,7 +19,6 @@
 #include "arm_lir.h"
 #include "codegen_arm.h"
 #include "dex/quick/mir_to_lir-inl.h"
-#include "driver/compiler_options.h"
 #include "entrypoints/quick/quick_entrypoints.h"
 
 namespace art {
@@ -469,34 +468,4 @@
   NewLIR1(kThumbBx, rARM_LR);
 }
 
-// Entrypoint calls.
-RegStorage ArmMir2Lir::CallHelperSetup(ThreadOffset<4> helper_offset) {
-  const CompilerOptions& compiler_options = cu_->compiler_driver->GetCompilerOptions();
-  if (compiler_options.GenerateHelperTrampolines()) {
-    return RegStorage::InvalidReg();
-  } else {
-    return LoadHelper(helper_offset);
-  }
-}
-
-LIR* ArmMir2Lir::CallHelper(RegStorage r_tgt, ThreadOffset<4> helper_offset, bool safepoint_pc,
-    bool use_link) {
-  LIR* call_inst = nullptr;
-  if (use_link) {
-    const CompilerOptions& compiler_options = cu_->compiler_driver->GetCompilerOptions();
-    if (compiler_options.GenerateHelperTrampolines()) {
-      call_inst = OpThreadMem(kOpBlx, helper_offset);
-    } else {
-      call_inst = OpReg(kOpBlx, r_tgt);
-      FreeTemp(r_tgt);
-    }
-  } else {
-    call_inst = OpReg(kOpBx, r_tgt);
-    FreeTemp(r_tgt);
-  }
-  if (safepoint_pc) {
-    MarkSafepointPC(call_inst);
-  }
-  return call_inst;
-}
 }  // namespace art
diff --git a/compiler/dex/quick/arm/codegen_arm.h b/compiler/dex/quick/arm/codegen_arm.h
index 3c0aa03..13fa635 100644
--- a/compiler/dex/quick/arm/codegen_arm.h
+++ b/compiler/dex/quick/arm/codegen_arm.h
@@ -195,11 +195,6 @@
     bool InexpensiveConstantLong(int64_t value);
     bool InexpensiveConstantDouble(int64_t value);
 
-    // Entrypoint calls.
-    RegStorage CallHelperSetup(ThreadOffset<4> helper_offset);
-    LIR* CallHelper(RegStorage r_tgt, ThreadOffset<4> helper_offset,
-      bool safepoint_pc, bool use_link);
-
   private:
     void GenFusedLongCmpImmBranch(BasicBlock* bb, RegLocation rl_src1, int64_t val,
                                   ConditionCode ccode);
diff --git a/compiler/dex/quick/arm/utility_arm.cc b/compiler/dex/quick/arm/utility_arm.cc
index 8e6d9a8..70cbdd2 100644
--- a/compiler/dex/quick/arm/utility_arm.cc
+++ b/compiler/dex/quick/arm/utility_arm.cc
@@ -1111,14 +1111,8 @@
 }
 
 LIR* ArmMir2Lir::OpThreadMem(OpKind op, ThreadOffset<4> thread_offset) {
-  if (op == kOpBlx) {
-    const uint32_t trampoline = cu_->compiler_driver->AddEntrypointTrampoline(
-        thread_offset.Int32Value());
-    return NewLIR1(kThumb2BlTramp, trampoline);
-  } else {
-    LOG(FATAL) << "Invalid opcode for ARM OpThreadMem on Arm";
-    return NULL;
-  }
+  LOG(FATAL) << "Unexpected use of OpThreadMem for Arm";
+  return NULL;
 }
 
 LIR* ArmMir2Lir::OpMem(OpKind op, RegStorage r_base, int disp) {