Use string length from DEX instead of recomputing

This gives around a 2% improvement in startup time overall. Here are results from a selection of
apps:

com.android.gallery3d/.app.GalleryActivity: 203.2ms → 197.7ms (change: -5.4ms, -2.7%)
com.android.messaging/.ui.conversationlist.ConversationListActivity:
  202.1ms → 199.1ms (change: -3.0ms, -1.5%)
com.android.contacts/.activities.PeopleActivity: 277.3ms → 270.7ms (change: -6.6ms, -2.4%)
com.android.camera2/com.android.camera.CameraLauncher:
  351.7ms → 344.1ms (change: -7.7ms, -2.2%)
com.android.dialer/.main.impl.MainActivity: 259.5ms → 254.2ms (change: -5.3ms, -2.0%)
com.android.settings/.Settings: 189.0ms → 186.5ms (change: -2.4ms, -1.3%)
com.android.email/.activity.Welcome: 222.8ms → 219.3ms (change: -3.6ms, -1.6%)
org.mozilla.firefox/.App: 370.2ms → 358.3ms (change: -11.9ms, -3.2%)

This is the average of 100 runs on a Pixel 2 XL.

Bug: 132691958
Test: device boots, start app many times
Change-Id: I93b6eb5105e32788cfc8159c6c21b400a161f86c
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 5025c02..ec07a50 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -446,7 +446,7 @@
     // Search declared methods, both direct and virtual.
     // (This lookup is used also for invoke-static on interface classes.)
     for (ArtMethod& method : klass->GetDeclaredMethodsSlice(pointer_size)) {
-      if (method.GetName() == name && method.GetSignature() == signature) {
+      if (method.GetNameView() == name && method.GetSignature() == signature) {
         return &method;
       }
     }
@@ -458,7 +458,7 @@
   for (int32_t i = 0, iftable_count = iftable->Count(); i < iftable_count; ++i) {
     ObjPtr<Class> iface = iftable->GetInterface(i);
     for (ArtMethod& method : iface->GetVirtualMethodsSlice(pointer_size)) {
-      if (method.GetName() == name && method.GetSignature() == signature) {
+      if (method.GetNameView() == name && method.GetSignature() == signature) {
         return &method;
       }
     }
@@ -470,7 +470,7 @@
     DCHECK(object_class->IsObjectClass());
     for (ArtMethod& method : object_class->GetDeclaredMethodsSlice(pointer_size)) {
       if (method.IsPublic() && !method.IsStatic() &&
-          method.GetName() == name && method.GetSignature() == signature) {
+          method.GetNameView() == name && method.GetSignature() == signature) {
         return &method;
       }
     }
@@ -496,7 +496,7 @@
   // We always search by name and signature, ignoring the type index in the MethodId.
   const DexFile& dex_file = *dex_cache->GetDexFile();
   const dex::MethodId& method_id = dex_file.GetMethodId(dex_method_idx);
-  std::string_view name = dex_file.StringDataByIdx(method_id.name_idx_);
+  std::string_view name = dex_file.StringViewByIdx(method_id.name_idx_);
   const Signature signature = dex_file.GetMethodSignature(method_id);
   return FindInterfaceMethod(name, signature, pointer_size);
 }