summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/class.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-09-19 02:56:49 -0700
committerIan Rogers <irogers@google.com>2013-09-19 15:17:12 -0700
commit8b2c0b9abc3f520495f4387ea040132ba85cae69 (patch)
tree13ea7e5c4e3d1804ec8d420d36f7ea5ab18f6ac0 /runtime/mirror/class.cc
parent5712d5d04640925970db9c98938ffaf806b3962c (diff)
downloadart-8b2c0b9abc3f520495f4387ea040132ba85cae69.zip
art-8b2c0b9abc3f520495f4387ea040132ba85cae69.tar.gz
art-8b2c0b9abc3f520495f4387ea040132ba85cae69.tar.bz2
Use class def index from java.lang.Class.
Bug: 10244719 Depends on: https://googleplex-android-review.git.corp.google.com/362363 This removes the computation of the dex file index, when necessary this is computed by searching the dex file. Its only necessary in dalvik.system.DexFile.defineClassNative and DexFile::FindInClassPath, the latter not showing up significantly in profiling with this change. Change-Id: I20c73a3b17d86286428ab0fd21bc13f51f36c85c
Diffstat (limited to 'runtime/mirror/class.cc')
-rw-r--r--runtime/mirror/class.cc23
1 files changed, 6 insertions, 17 deletions
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 328c67d..c128ede 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -119,7 +119,10 @@ void Class::SetDexCache(DexCache* new_dex_cache) {
}
void Class::SetClassSize(size_t new_class_size) {
- DCHECK_GE(new_class_size, GetClassSize()) << " class=" << PrettyTypeOf(this);
+ if (kIsDebugBuild && (new_class_size < GetClassSize())) {
+ DumpClass(LOG(ERROR), kDumpClassFullDetail);
+ CHECK_GE(new_class_size, GetClassSize()) << " class=" << PrettyTypeOf(this);
+ }
SetField32(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), new_class_size, false);
}
@@ -291,22 +294,8 @@ bool Class::IsInSamePackage(const Class* that) const {
return true;
}
// Compare the package part of the descriptor string.
- if (LIKELY(!klass1->IsProxyClass() && !klass2->IsProxyClass())) {
- ClassHelper kh(klass1);
- const DexFile* dex_file1 = &kh.GetDexFile();
- const DexFile::TypeId* type_id1 = &dex_file1->GetTypeId(klass1->GetDexTypeIndex());
- const char* descriptor1 = dex_file1->GetTypeDescriptor(*type_id1);
- kh.ChangeClass(klass2);
- const DexFile* dex_file2 = &kh.GetDexFile();
- const DexFile::TypeId* type_id2 = &dex_file2->GetTypeId(klass2->GetDexTypeIndex());
- const char* descriptor2 = dex_file2->GetTypeDescriptor(*type_id2);
- return IsInSamePackage(descriptor1, descriptor2);
- }
- ClassHelper kh(klass1);
- std::string descriptor1(kh.GetDescriptor());
- kh.ChangeClass(klass2);
- std::string descriptor2(kh.GetDescriptor());
- return IsInSamePackage(descriptor1, descriptor2);
+ return IsInSamePackage(ClassHelper(klass1).GetDescriptor(),
+ ClassHelper(klass2).GetDescriptor());
}
bool Class::IsClassClass() const {