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

This reverts commit 081f73e888b3c246cf7635db37b7f1105cf1a2ff.

Change-Id: Ibd777f8ce73cf8ed6c4cb81d50bf6437ac28cb61

Conflicts:
	compiler/dex/quick/mir_to_lir.h
diff --git a/compiler/dex/quick/codegen_util.cc b/compiler/dex/quick/codegen_util.cc
index 6e6b8f0..b163ef7 100644
--- a/compiler/dex/quick/codegen_util.cc
+++ b/compiler/dex/quick/codegen_util.cc
@@ -1012,11 +1012,26 @@
     vmap_encoder.PushBackUnsigned(0u);  // Size is 0.
   }
 
+  // All relocations
+  UniquePtr<FinalRelocations> all_relocs(new FinalRelocations());
+
+  // Build the final relocations for this method.
+  if (trampoline_calls_.size() != 0) {
+    FinalEntrypointRelocationSet* ep_relocs =
+      cu_->compiler_driver->AllocateFinalEntrypointRelocationSet(cu_);
+    for (size_t i = 0 ; i < trampoline_calls_.size(); ++i) {
+      const TrampolineCall& call = trampoline_calls_[i];
+      ep_relocs->Add(call.code_offset_, call.trampoline_offset_);
+    }
+    all_relocs->push_back(ep_relocs);
+  }
+
   UniquePtr<std::vector<uint8_t> > cfi_info(ReturnCallFrameInformation());
   CompiledMethod* result =
       new CompiledMethod(*cu_->compiler_driver, cu_->instruction_set, code_buffer_, frame_size_,
                          core_spill_mask_, fp_spill_mask_, encoded_mapping_table_,
-                         vmap_encoder.GetData(), native_gc_map_, cfi_info.get());
+                         vmap_encoder.GetData(), native_gc_map_, cfi_info.get(),
+                         all_relocs.release());
   return result;
 }