flush-instruction-cache.cc 743 Bytes
Newer Older
1 2 3 4
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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 12 13 14 15

namespace v8 {
namespace internal {

void FlushInstructionCache(void* start, size_t size) {
  if (size == 0) return;
16
  if (FLAG_jitless) return;
17 18 19 20 21 22 23 24 25 26 27

#if defined(USE_SIMULATOR)
  base::MutexGuard lock_guard(Simulator::i_cache_mutex());
  Simulator::FlushICache(Simulator::i_cache(), start, size);
#else
  CpuFeatures::FlushICache(start, size);
#endif  // USE_SIMULATOR
}

}  // namespace internal
}  // namespace v8