1 /* 2 * Copyright 2018 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_RUNTIME_JIT_JIT_INL_H_ 18 #define ART_RUNTIME_JIT_JIT_INL_H_ 19 20 #include "jit/jit.h" 21 22 #include "art_method.h" 23 #include "base/bit_utils.h" 24 #include "thread.h" 25 #include "runtime-inl.h" 26 27 namespace art { 28 namespace jit { 29 AddSamples(Thread * self,ArtMethod * method)30inline void Jit::AddSamples(Thread* self, ArtMethod* method) { 31 if (method->CounterIsHot()) { 32 if (method->IsMemorySharedMethod()) { 33 if (self->DecrementSharedMethodHotness() == 0) { 34 self->ResetSharedMethodHotness(); 35 } else { 36 return; 37 } 38 } else { 39 method->ResetCounter(Runtime::Current()->GetJITOptions()->GetWarmupThreshold()); 40 } 41 MaybeEnqueueCompilation(method, self); 42 } else { 43 method->UpdateCounter(1); 44 } 45 } 46 47 } // namespace jit 48 } // namespace art 49 50 #endif // ART_RUNTIME_JIT_JIT_INL_H_ 51