Avoid redundant strlen for shorty names

As the shorty names are ASCII, we can safely use the UTF16 length as
the byte length. Update several ART files to use the shorty getters
that return the length to avoid redundant strlen calls.

This strlen usage was showing up as a minor part of a recent Play Store
app startup profile.

Bug: 204230974
Test: Manual
Change-Id: I4f5fb100303f465ed50b524ee5e349c8341a05e9
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index 614a67f..7491fc7 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -291,7 +291,9 @@
 
 inline size_t ArtMethod::GetNumberOfParameters() {
   constexpr size_t return_type_count = 1u;
-  return strlen(GetShorty()) - return_type_count;
+  uint32_t shorty_length;
+  GetShorty(&shorty_length);
+  return shorty_length - return_type_count;
 }
 
 inline const char* ArtMethod::GetReturnTypeDescriptor() {
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 8065238..0b3c52c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3834,12 +3834,13 @@
   }
 
   // Set optimization flags related to the shorty.
-  const char* shorty = dst->GetShorty();
+  uint32_t shorty_length;
+  const char* shorty = dst->GetShorty(&shorty_length);
   bool all_parameters_are_reference = true;
   bool all_parameters_are_reference_or_int = true;
   bool return_type_is_fp = (shorty[0] == 'F' || shorty[0] == 'D');
 
-  for (size_t i = 1, e = strlen(shorty); i < e; ++i) {
+  for (size_t i = 1; i < shorty_length; ++i) {
     if (shorty[i] != 'L') {
       all_parameters_are_reference = false;
       if (shorty[i] == 'F' || shorty[i] == 'D' || shorty[i] == 'J') {
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 9ba3efc..d54330a 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -2555,8 +2555,9 @@
         }
         current_vreg += 1u;
       }
-      const char* shorty = m->GetShorty();
-      for (size_t i = 1, len = strlen(shorty); i != len; ++i) {
+      uint32_t shorty_length;
+      const char* shorty = m->GetShorty(&shorty_length);
+      for (size_t i = 1; i != shorty_length; ++i) {
         switch (shorty[i]) {
           case 'D':
           case 'J':