// Copyright 2018 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. #include "src/codegen/assembler-inl.h" #include "src/codegen/macro-assembler-inl.h" #include "src/execution/simulator.h" #include "src/handles/handles-inl.h" #include "test/cctest/cctest.h" #include "test/common/assembler-tester.h" #if V8_ENABLE_WEBASSEMBLY #include "src/wasm/code-space-access.h" #endif // V8_ENABLE_WEBASSEMBLY namespace v8 { namespace internal { namespace test_icache { F0; #define __ … static constexpr int kNumInstr = …; static constexpr int kNumIterations = …; static constexpr int kBufferSize = …; static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) { … } static void FloodWithNop(Isolate* isolate, TestingAssemblerBuffer* buffer) { … } // Order of operation for this test case: // exec -> perm(RW) -> patch -> flush -> perm(RX) -> exec TEST(TestFlushICacheOfWritable) { … } #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 // Note that this order of operations is not supported on ARM32/64 because on // some older ARM32/64 kernels there is a bug which causes an access error on // cache flush instructions to trigger access error on non-writable memory. // See https://bugs.chromium.org/p/v8/issues/detail?id=8157 // // Also note that this requires {kBufferSize == 8 * KB} to reproduce. // // The order of operations in V8 is akin to {TestFlushICacheOfWritable} above. // It is hence OK to disable the below test on some architectures. Only the // above test case should remain enabled on all architectures. #define CONDITIONAL_TEST … #else #define CONDITIONAL_TEST … #endif // Order of operation for this test case: // exec -> perm(RW) -> patch -> perm(RX) -> flush -> exec CONDITIONAL_TEST(TestFlushICacheOfExecutable) { … } #undef CONDITIONAL_TEST #if V8_ENABLE_WEBASSEMBLY // Order of operation for this test case: // perm(RWX) -> exec -> patch -> flush -> exec TEST(TestFlushICacheOfWritableAndExecutable) { … } #endif // V8_ENABLE_WEBASSEMBLY #undef __ } // namespace test_icache } // namespace internal } // namespace v8