Small cleanup in InstructionBuilder.

Refactor BuildInvoke() to reduce runtime state transitions
(fewer ScopedObjectAccess objects) and separate the class
init check for static methods from the instruction creation
in preparation for allocating replacement instructions for
intrinsics such as Math.abs().

Delay Handle<> creation in ProcessClinitCheckForInvoke until
it's actually needed. Change function parameters to ObjPtr<>
instead of Handle<> if they cannot cause thread suspension.

Test: aosp_taimen-userdebug boots.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I8d5ebf5db76f0c8b1fec790a2f8621818d64b4dc
diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h
index d701445..c021134 100644
--- a/compiler/optimizing/instruction_builder.h
+++ b/compiler/optimizing/instruction_builder.h
@@ -230,7 +230,7 @@
   Handle<mirror::Class> ResolveClass(ScopedObjectAccess& soa, dex::TypeIndex type_index)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  bool LoadClassNeedsAccessCheck(Handle<mirror::Class> klass)
+  bool LoadClassNeedsAccessCheck(ObjPtr<mirror::Class> klass)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Builds a `HLoadMethodHandle` loading the given `method_handle_index`.
@@ -263,8 +263,7 @@
   HClinitCheck* ProcessClinitCheckForInvoke(
       uint32_t dex_pc,
       ArtMethod* method,
-      HInvokeStaticOrDirect::ClinitCheckRequirement* clinit_check_requirement)
-      REQUIRES_SHARED(Locks::mutator_lock_);
+      HInvokeStaticOrDirect::ClinitCheckRequirement* clinit_check_requirement);
 
   // Build a HNewInstance instruction.
   HNewInstance* BuildNewInstance(dex::TypeIndex type_index, uint32_t dex_pc);
@@ -274,13 +273,9 @@
   void BuildConstructorFenceForAllocation(HInstruction* allocation);
 
   // Return whether the compiler can assume `cls` is initialized.
-  bool IsInitialized(Handle<mirror::Class> cls) const
+  bool IsInitialized(ObjPtr<mirror::Class> cls) const
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  // Try to resolve a method using the class linker. Return null if a method could
-  // not be resolved.
-  ArtMethod* ResolveMethod(uint16_t method_idx, InvokeType invoke_type);
-
   // Try to resolve a field using the class linker. Return null if it could not
   // be found.
   ArtField* ResolveField(uint16_t field_idx, bool is_static, bool is_put);