diff options
Diffstat (limited to 'runtime/art_method.cc')
-rw-r--r-- | runtime/art_method.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index f7ed81254f..47f2569b82 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -106,17 +106,16 @@ size_t ArtMethod::NumArgRegisters(const StringPiece& shorty) { return num_registers; } -static bool HasSameNameAndSignature(ArtMethod* method1, ArtMethod* method2) - SHARED_REQUIRES(Locks::mutator_lock_) { +bool ArtMethod::HasSameNameAndSignature(ArtMethod* other) { ScopedAssertNoThreadSuspension ants(Thread::Current(), "HasSameNameAndSignature"); - const DexFile* dex_file = method1->GetDexFile(); - const DexFile::MethodId& mid = dex_file->GetMethodId(method1->GetDexMethodIndex()); - if (method1->GetDexCache() == method2->GetDexCache()) { - const DexFile::MethodId& mid2 = dex_file->GetMethodId(method2->GetDexMethodIndex()); + const DexFile* dex_file = GetDexFile(); + const DexFile::MethodId& mid = dex_file->GetMethodId(GetDexMethodIndex()); + if (GetDexCache() == other->GetDexCache()) { + const DexFile::MethodId& mid2 = dex_file->GetMethodId(other->GetDexMethodIndex()); return mid.name_idx_ == mid2.name_idx_ && mid.proto_idx_ == mid2.proto_idx_; } - const DexFile* dex_file2 = method2->GetDexFile(); - const DexFile::MethodId& mid2 = dex_file2->GetMethodId(method2->GetDexMethodIndex()); + const DexFile* dex_file2 = other->GetDexFile(); + const DexFile::MethodId& mid2 = dex_file2->GetMethodId(other->GetDexMethodIndex()); if (!DexFileStringEquals(dex_file, mid.name_idx_, dex_file2, mid2.name_idx_)) { return false; // Name mismatch. } @@ -149,8 +148,7 @@ ArtMethod* ArtMethod::FindOverriddenMethod(size_t pointer_size) { mirror::Class* interface = iftable->GetInterface(i); for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) { ArtMethod* interface_method = interface->GetVirtualMethod(j, pointer_size); - if (HasSameNameAndSignature( - this, interface_method->GetInterfaceMethodIfProxy(sizeof(void*)))) { + if (HasSameNameAndSignature(interface_method->GetInterfaceMethodIfProxy(sizeof(void*)))) { result = interface_method; break; } @@ -158,8 +156,9 @@ ArtMethod* ArtMethod::FindOverriddenMethod(size_t pointer_size) { } } } - DCHECK(result == nullptr || HasSameNameAndSignature( - GetInterfaceMethodIfProxy(sizeof(void*)), result->GetInterfaceMethodIfProxy(sizeof(void*)))); + DCHECK(result == nullptr || + GetInterfaceMethodIfProxy(sizeof(void*))->HasSameNameAndSignature( + result->GetInterfaceMethodIfProxy(sizeof(void*)))); return result; } |