Move String::GetUtfLength() to string-inl.h.
Attribute the time spent in this trivial function
to its users in perf data.
Test: m
Change-Id: I6340c48e0cf29451e2d8cf854723f94da5650ec6
diff --git a/runtime/mirror/string-inl.h b/runtime/mirror/string-inl.h
index f04a8aa..dd28036 100644
--- a/runtime/mirror/string-inl.h
+++ b/runtime/mirror/string-inl.h
@@ -84,6 +84,14 @@
return result;
}
+inline int32_t String::GetUtfLength() {
+ if (IsCompressed()) {
+ return GetLength();
+ } else {
+ return CountUtf8Bytes(GetValue(), GetLength());
+ }
+}
+
template<typename MemoryType>
inline bool String::AllASCII(const MemoryType* chars, const int length) {
static_assert(std::is_unsigned<MemoryType>::value, "Expecting unsigned MemoryType");
diff --git a/runtime/mirror/string.cc b/runtime/mirror/string.cc
index 0356080..2dfb57f 100644
--- a/runtime/mirror/string.cc
+++ b/runtime/mirror/string.cc
@@ -59,14 +59,6 @@
return hash_code;
}
-int32_t String::GetUtfLength() {
- if (IsCompressed()) {
- return GetLength();
- } else {
- return CountUtf8Bytes(GetValue(), GetLength());
- }
-}
-
inline bool String::AllASCIIExcept(const uint16_t* chars, int32_t length, uint16_t non_ascii) {
DCHECK(!IsASCII(non_ascii));
for (int32_t i = 0; i < length; ++i) {