#ifndef V8_EXECUTION_SIMULATOR_H_
#define V8_EXECUTION_SIMULATOR_H_
#include "src/common/globals.h"
#include "src/objects/code.h"
#if !defined(USE_SIMULATOR)
#include "src/base/platform/platform.h"
#include "src/execution/isolate.h"
#include "src/utils/utils.h"
#endif
#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
#elif V8_TARGET_ARCH_ARM64
#include "src/execution/arm64/simulator-arm64.h"
#elif V8_TARGET_ARCH_ARM
#include "src/execution/arm/simulator-arm.h"
#elif V8_TARGET_ARCH_PPC64
#include "src/execution/ppc/simulator-ppc.h"
#elif V8_TARGET_ARCH_MIPS64
#include "src/execution/mips64/simulator-mips64.h"
#elif V8_TARGET_ARCH_LOONG64
#include "src/execution/loong64/simulator-loong64.h"
#elif V8_TARGET_ARCH_S390
#include "src/execution/s390/simulator-s390.h"
#elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
#include "src/execution/riscv/simulator-riscv.h"
#else
#error Unsupported target architecture.
#endif
namespace v8 {
namespace internal {
#if defined(USE_SIMULATOR)
class SimulatorStack : public v8::internal::AllStatic {
public:
static inline uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate,
uintptr_t c_limit) {
return Simulator::current(isolate)->StackLimit(c_limit);
}
static inline base::Vector<uint8_t> GetCurrentStackView(
v8::internal::Isolate* isolate) {
return Simulator::current(isolate)->GetCurrentStackView();
}
static inline bool ShouldSwitchCStackForWasmStackSwitching() { return false; }
static inline uintptr_t RegisterJSStackComparableAddress(
v8::internal::Isolate* isolate) {
const uintptr_t kPlaceHolder = 0x4A535350u;
return Simulator::current(isolate)->PushAddress(kPlaceHolder);
}
static inline void UnregisterJSStackComparableAddress(
v8::internal::Isolate* isolate) {
Simulator::current(isolate)->PopAddress();
}
};
#else
class SimulatorStack : public v8::internal::AllStatic { … };
#endif
template <typename Return, typename... Args>
class GeneratedCode { … };
GeneratedCode<Return (Args...)>;
}
}
#endif