diff options
Diffstat (limited to 'runtime/art_method.cc')
-rw-r--r-- | runtime/art_method.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index f9bc249a42..1392399bde 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -335,20 +335,30 @@ bool ArtMethod::IsOverridableByDefaultMethod() { } bool ArtMethod::IsAnnotatedWithFastNative() { + return IsAnnotatedWith(WellKnownClasses::dalvik_annotation_optimization_FastNative, + DexFile::kDexVisibilityBuild); +} + +bool ArtMethod::IsAnnotatedWithCriticalNative() { + return IsAnnotatedWith(WellKnownClasses::dalvik_annotation_optimization_CriticalNative, + DexFile::kDexVisibilityBuild); +} + +bool ArtMethod::IsAnnotatedWith(jclass klass, uint32_t visibility) { Thread* self = Thread::Current(); ScopedObjectAccess soa(self); StackHandleScope<1> shs(self); const DexFile& dex_file = GetDeclaringClass()->GetDexFile(); - mirror::Class* fast_native_annotation = - soa.Decode<mirror::Class*>(WellKnownClasses::dalvik_annotation_optimization_FastNative); - Handle<mirror::Class> fast_native_handle(shs.NewHandle(fast_native_annotation)); + mirror::Class* annotation = soa.Decode<mirror::Class*>(klass); + DCHECK(annotation->IsAnnotation()); + Handle<mirror::Class> annotation_handle(shs.NewHandle(annotation)); // Note: Resolves any method annotations' classes as a side-effect. // -- This seems allowed by the spec since it says we can preload any classes // referenced by another classes's constant pool table. - return dex_file.IsMethodAnnotationPresent(this, fast_native_handle, DexFile::kDexVisibilityBuild); + return dex_file.IsMethodAnnotationPresent(this, annotation_handle, visibility); } bool ArtMethod::EqualParameters(Handle<mirror::ObjectArray<mirror::Class>> params) { |