1 // Copyright 2019 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "src/codegen/flush-instruction-cache.h" 6 7 #include "src/base/platform/mutex.h" 8 #include "src/codegen/cpu-features.h" 9 #include "src/execution/simulator.h" 10 11 namespace v8 { 12 namespace internal { 13 FlushInstructionCache(void * start,size_t size)14void FlushInstructionCache(void* start, size_t size) { 15 if (size == 0) return; 16 if (FLAG_jitless) return; 17 18 #if defined(USE_SIMULATOR) 19 base::MutexGuard lock_guard(Simulator::i_cache_mutex()); 20 Simulator::FlushICache(Simulator::i_cache(), start, size); 21 #else 22 CpuFeatures::FlushICache(start, size); 23 #endif // USE_SIMULATOR 24 } 25 26 } // namespace internal 27 } // namespace v8 28