Avoid some read barriers in ClassTable.

And clean up ClassTable.

Test: m test-art-host-gtest
Test: testrunner.py --host --interpreter
Bug: 119486698
Change-Id: Ie413bc5a56eb548352ae1fed0976b75c44e0c0d4
diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h
index 5f8a0b0..d07ad33 100644
--- a/runtime/class_table-inl.h
+++ b/runtime/class_table-inl.h
@@ -88,6 +88,10 @@
   return true;
 }
 
+inline bool ClassTable::TableSlot::IsNull() const {
+  return Read<kWithoutReadBarrier>() == nullptr;
+}
+
 template<ReadBarrierOption kReadBarrierOption>
 inline mirror::Class* ClassTable::TableSlot::Read() const {
   const uint32_t before = data_.load(std::memory_order_relaxed);
@@ -127,11 +131,7 @@
 
 inline ClassTable::TableSlot::TableSlot(ObjPtr<mirror::Class> klass, uint32_t descriptor_hash)
     : data_(Encode(klass, MaskHash(descriptor_hash))) {
-  if (kIsDebugBuild) {
-    std::string temp;
-    const uint32_t hash = ComputeModifiedUtf8Hash(klass->GetDescriptor(&temp));
-    CHECK_EQ(descriptor_hash, hash);
-  }
+  DCHECK_EQ(descriptor_hash, HashDescriptor(klass));
 }
 
 template <typename Filter>