#include <bitset>
#include "src/base/utils/random-number-generator.h"
#include "src/codegen/assembler-inl.h"
#include "src/codegen/macro-assembler-inl.h"
#include "src/execution/simulator.h"
#include "src/utils/utils.h"
#include "src/wasm/code-space-access.h"
#include "src/wasm/jump-table-assembler.h"
#include "test/cctest/cctest.h"
#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
namespace wasm {
#if 0
#define TRACE …
#else
#define TRACE …
#endif
#define __ …
namespace {
static volatile int global_stop_bit = …;
constexpr int kJumpTableSlotCount = …;
constexpr uint32_t kJumpTableSize = …;
constexpr size_t kThunkBufferSize = …;
#if V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_LOONG64
constexpr size_t kAssemblerBufferSize = …;
constexpr uint32_t kAvailableBufferSlots = …;
constexpr uint32_t kBufferSlotStartOffset = …;
#else
constexpr size_t kAssemblerBufferSize = kJumpTableSize;
constexpr uint32_t kAvailableBufferSlots = 0;
constexpr uint32_t kBufferSlotStartOffset = 0;
#endif
Address AllocateJumpTableThunk(
Address jump_target, uint8_t* thunk_slot_buffer,
std::bitset<kAvailableBufferSlots>* used_slots,
std::vector<std::unique_ptr<TestingAssemblerBuffer>>* thunk_buffers) { … }
void CompileJumpTableThunk(Address thunk, Address jump_target) { … }
class JumpTableRunner : public v8::base::Thread { … };
class JumpTablePatcher : public v8::base::Thread { … };
}
TEST(JumpTablePatchingStress) { … }
#undef __
#undef TRACE
}
}
}