Add compiling class to the DexCompilationUnit.

Use it to simplify HInstructionBuilder and reduce the
number of class resolution calls.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: Pixel 2 XL boots.
Change-Id: Ib4f9b4ea61235841e653a03a40755a39c7de7504
diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h
index 2ab2139..0ee026a 100644
--- a/compiler/optimizing/instruction_builder.h
+++ b/compiler/optimizing/instruction_builder.h
@@ -222,8 +222,7 @@
   // Builds a `HLoadClass` loading the given `type_index`.
   HLoadClass* BuildLoadClass(dex::TypeIndex type_index, uint32_t dex_pc);
 
-  HLoadClass* BuildLoadClass(ScopedObjectAccess& soa,
-                             dex::TypeIndex type_index,
+  HLoadClass* BuildLoadClass(dex::TypeIndex type_index,
                              const DexFile& dex_file,
                              Handle<mirror::Class> klass,
                              uint32_t dex_pc,
@@ -233,7 +232,7 @@
   Handle<mirror::Class> ResolveClass(ScopedObjectAccess& soa, dex::TypeIndex type_index)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  bool LoadClassNeedsAccessCheck(ScopedObjectAccess& soa, Handle<mirror::Class> klass)
+  bool LoadClassNeedsAccessCheck(Handle<mirror::Class> klass)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Builds a `HLoadMethodHandle` loading the given `method_handle_index`.
@@ -242,17 +241,6 @@
   // Builds a `HLoadMethodType` loading the given `proto_index`.
   void BuildLoadMethodType(dex::ProtoIndex proto_index, uint32_t dex_pc);
 
-  // Returns the outer-most compiling method's class.
-  ObjPtr<mirror::Class> ResolveOutermostCompilingClass(ScopedObjectAccess& soa) const
-      REQUIRES_SHARED(Locks::mutator_lock_);
-
-  // Returns the class whose method is being compiled.
-  ObjPtr<mirror::Class> ResolveCompilingClass(ScopedObjectAccess& soa) const
-      REQUIRES_SHARED(Locks::mutator_lock_);
-
-  // Returns whether `type_index` points to the outer-most compiling method's class.
-  bool IsOutermostCompilingClass(dex::TypeIndex type_index) const;
-
   void PotentiallySimplifyFakeString(uint16_t original_dex_register,
                                      uint32_t dex_pc,
                                      HInvoke* invoke);
@@ -275,7 +263,6 @@
   void HandleStringInitResult(HInvokeStaticOrDirect* invoke);
 
   HClinitCheck* ProcessClinitCheckForInvoke(
-      ScopedObjectAccess& soa,
       uint32_t dex_pc,
       ArtMethod* method,
       HInvokeStaticOrDirect::ClinitCheckRequirement* clinit_check_requirement)
@@ -289,7 +276,7 @@
   void BuildConstructorFenceForAllocation(HInstruction* allocation);
 
   // Return whether the compiler can assume `cls` is initialized.
-  bool IsInitialized(ScopedObjectAccess& soa, Handle<mirror::Class> cls) const
+  bool IsInitialized(Handle<mirror::Class> cls) const
       REQUIRES_SHARED(Locks::mutator_lock_);
 
   // Try to resolve a method using the class linker. Return null if a method could