diff options
author | Vladimir Marko <vmarko@google.com> | 2014-06-05 18:36:42 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2014-06-05 18:36:42 +0100 |
commit | 539690a351d8c325707368729aafa2b4fa134d4c (patch) | |
tree | a5297097077628b6092e71f01817a1d268a4620a /runtime/oat_file.cc | |
parent | d5e2b00cbc1e6b6608a5dbcfb05b7c4976614636 (diff) | |
download | art-539690a351d8c325707368729aafa2b4fa134d4c.zip art-539690a351d8c325707368729aafa2b4fa134d4c.tar.gz art-539690a351d8c325707368729aafa2b4fa134d4c.tar.bz2 |
Avoid a memory allocation in OatFile::GetOatDexFile().
Use StringPiece instead of std::string as the map key.
Change-Id: I05516d273de617a7d714e39ce6c4236cec6a09f7
Diffstat (limited to 'runtime/oat_file.cc')
-rw-r--r-- | runtime/oat_file.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index 74dfe91..6c44aa9 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -292,11 +292,14 @@ bool OatFile::Setup(std::string* error_msg) { return false; } - oat_dex_files_.Put(dex_file_location, new OatDexFile(this, - dex_file_location, - dex_file_checksum, - dex_file_pointer, - methods_offsets_pointer)); + OatDexFile* oat_dex_file = new OatDexFile(this, + dex_file_location, + dex_file_checksum, + dex_file_pointer, + methods_offsets_pointer); + // Use a StringPiece backed by the oat_dex_file's internal std::string as the key. + StringPiece key(oat_dex_file->GetDexFileLocation()); + oat_dex_files_.Put(key, oat_dex_file); } return true; } |