Early inlining of simple methods.

Inlining "special" methods: empty methods, methods returning
constants or their arguments, simple getters and setters.

Bug: 8164439
Change-Id: I8c7fa9c14351fbb2470000b378a22974daaef236
diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc
index 92c13ce..4f02fd7 100644
--- a/compiler/dex/quick/gen_invoke.cc
+++ b/compiler/dex/quick/gen_invoke.cc
@@ -1423,6 +1423,16 @@
 }
 
 void Mir2Lir::GenInvoke(CallInfo* info) {
+  if ((info->opt_flags & MIR_INLINED) != 0) {
+    // Already inlined but we may still need the null check.
+    if (info->type != kStatic &&
+        ((cu_->disable_opt & (1 << kNullCheckElimination)) != 0 ||
+         (info->opt_flags & MIR_IGNORE_NULL_CHECK) == 0))  {
+      RegLocation rl_obj = LoadValue(info->args[0], kCoreReg);
+      GenImmedCheck(kCondEq, rl_obj.reg.GetReg(), 0, kThrowNullPointer);
+    }
+    return;
+  }
   DCHECK(cu_->compiler_driver->GetMethodInlinerMap() != nullptr);
   if (cu_->compiler_driver->GetMethodInlinerMap()->GetMethodInliner(cu_->dex_file)
       ->GenIntrinsic(this, info)) {