11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#include "src/codegen/flush-instruction-cache.h" 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci#include "src/base/platform/mutex.h" 81cb0ef41Sopenharmony_ci#include "src/codegen/cpu-features.h" 91cb0ef41Sopenharmony_ci#include "src/execution/simulator.h" 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cinamespace v8 { 121cb0ef41Sopenharmony_cinamespace internal { 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_civoid FlushInstructionCache(void* start, size_t size) { 151cb0ef41Sopenharmony_ci if (size == 0) return; 161cb0ef41Sopenharmony_ci if (FLAG_jitless) return; 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci#if defined(USE_SIMULATOR) 191cb0ef41Sopenharmony_ci base::MutexGuard lock_guard(Simulator::i_cache_mutex()); 201cb0ef41Sopenharmony_ci Simulator::FlushICache(Simulator::i_cache(), start, size); 211cb0ef41Sopenharmony_ci#else 221cb0ef41Sopenharmony_ci CpuFeatures::FlushICache(start, size); 231cb0ef41Sopenharmony_ci#endif // USE_SIMULATOR 241cb0ef41Sopenharmony_ci} 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci} // namespace internal 271cb0ef41Sopenharmony_ci} // namespace v8 28