summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file-inl.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-09-23 23:51:32 -0700
committerIan Rogers <irogers@google.com>2013-09-24 17:07:24 -0700
commitfc0e94bed3f88ed7e50854fd8dfaf5dcb345250f (patch)
tree5cfbe05084351576e9659cb8f7b66dcb6163a37b /runtime/dex_file-inl.h
parent576fe9d4181c749aa510e32d2521ed4192bdfda0 (diff)
downloadart-fc0e94bed3f88ed7e50854fd8dfaf5dcb345250f.zip
art-fc0e94bed3f88ed7e50854fd8dfaf5dcb345250f.tar.gz
art-fc0e94bed3f88ed7e50854fd8dfaf5dcb345250f.tar.bz2
StringPiece clean up.
Profile guided clean up. Try to avoid creating StringPieces with the contents of a dex file where the length is known. Try to avoid RegTypeCache::FromDescriptor when there's a class available. Make ConstantType::ConstantValue inlinable. Saving of about 50ms from a 2 threaded ThinkFree compile on host. Change-Id: I47a12c3c76f46e2c9805be1c3a3e3870fe1f5d85
Diffstat (limited to 'runtime/dex_file-inl.h')
-rw-r--r--runtime/dex_file-inl.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/dex_file-inl.h b/runtime/dex_file-inl.h
index dee8026..2ee9244 100644
--- a/runtime/dex_file-inl.h
+++ b/runtime/dex_file-inl.h
@@ -18,6 +18,7 @@
#define ART_RUNTIME_DEX_FILE_INL_H_
#include "base/logging.h"
+#include "base/stringpiece.h"
#include "dex_file.h"
#include "leb128.h"
#include "utils.h"
@@ -36,6 +37,16 @@ inline const char* DexFile::GetStringDataAndLength(const StringId& string_id, ui
return reinterpret_cast<const char*>(ptr);
}
+inline StringPiece DexFile::StringDataAsStringPieceByIdx(uint32_t idx) const {
+ if (idx == kDexNoIndex) {
+ return StringPiece();
+ }
+ const StringId& string_id = GetStringId(idx);
+ uint32_t length;
+ const char* data = GetStringDataAndLength(string_id, &length);
+ return StringPiece(data, static_cast<int>(length));
+}
+
inline const DexFile::TryItem* DexFile::GetTryItems(const CodeItem& code_item, uint32_t offset) {
const uint16_t* insns_end_ = &code_item.insns_[code_item.insns_size_in_code_units_];
return reinterpret_cast<const TryItem*>