1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ART_COMPILER_OPTIMIZING_SHARPENING_H_ 18 #define ART_COMPILER_OPTIMIZING_SHARPENING_H_ 19 20 #include "base/macros.h" 21 #include "nodes.h" 22 #include "optimization.h" 23 24 namespace art HIDDEN { 25 26 class CodeGenerator; 27 class DexCompilationUnit; 28 29 // Utility methods that try to improve the way we dispatch methods, and access 30 // types and strings. 31 class HSharpening { 32 public: 33 // Used by the builder and InstructionSimplifier. 34 static HInvokeStaticOrDirect::DispatchInfo SharpenLoadMethod( 35 ArtMethod* callee, 36 bool has_method_id, 37 bool for_interface_call, 38 CodeGenerator* codegen); 39 40 // Used by the builder and the inliner. 41 static HLoadClass::LoadKind ComputeLoadClassKind(HLoadClass* load_class, 42 CodeGenerator* codegen, 43 const DexCompilationUnit& dex_compilation_unit) 44 REQUIRES_SHARED(Locks::mutator_lock_); 45 46 // Used by the builder. 47 static TypeCheckKind ComputeTypeCheckKind(ObjPtr<mirror::Class> klass, 48 CodeGenerator* codegen, 49 bool needs_access_check) 50 REQUIRES_SHARED(Locks::mutator_lock_); 51 52 // Used by the builder. 53 static void ProcessLoadString(HLoadString* load_string, 54 CodeGenerator* codegen, 55 const DexCompilationUnit& dex_compilation_unit, 56 VariableSizedHandleScope* handles); 57 }; 58 59 } // namespace art 60 61 #endif // ART_COMPILER_OPTIMIZING_SHARPENING_H_ 62