summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-03-30 13:47:59 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-03-30 13:48:00 +0000
commit085055f933d76579c32586488951a4497ffcf10e (patch)
treedf7d6180b13430de8f255884b12f29f191d1468e /runtime/class_linker.cc
parenta1eff4f279253bbc90d2697d7c15390bcab65d1e (diff)
parentcac5a7e871f1f346b317894359ad06fa7bd67fba (diff)
Merge "Optimizing: Improve const-string code generation."
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index f2c2f03003..32ad422158 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -7024,6 +7024,23 @@ mirror::String* ClassLinker::ResolveString(const DexFile& dex_file,
return string;
}
+mirror::String* ClassLinker::LookupString(const DexFile& dex_file,
+ uint32_t string_idx,
+ Handle<mirror::DexCache> dex_cache) {
+ DCHECK(dex_cache.Get() != nullptr);
+ mirror::String* resolved = dex_cache->GetResolvedString(string_idx);
+ if (resolved != nullptr) {
+ return resolved;
+ }
+ uint32_t utf16_length;
+ const char* utf8_data = dex_file.StringDataAndUtf16LengthByIdx(string_idx, &utf16_length);
+ mirror::String* string = intern_table_->LookupStrong(Thread::Current(), utf16_length, utf8_data);
+ if (string != nullptr) {
+ dex_cache->SetResolvedString(string_idx, string);
+ }
+ return string;
+}
+
mirror::Class* ClassLinker::ResolveType(const DexFile& dex_file,
uint16_t type_idx,
mirror::Class* referrer) {