5#ifndef V8_EXECUTION_SIMULATOR_H_
6#define V8_EXECUTION_SIMULATOR_H_
11#if !defined(USE_SIMULATOR)
17#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
19#elif V8_TARGET_ARCH_ARM64
21#elif V8_TARGET_ARCH_ARM
23#elif V8_TARGET_ARCH_PPC64
25#elif V8_TARGET_ARCH_MIPS64
27#elif V8_TARGET_ARCH_LOONG64
29#elif V8_TARGET_ARCH_S390X
31#elif V8_TARGET_ARCH_RISCV32 || V8_TARGET_ARCH_RISCV64
34#error Unsupported target architecture.
44#if defined(USE_SIMULATOR)
55 return Simulator::current(isolate)->StackLimit(c_limit);
58#if V8_ENABLE_WEBASSEMBLY
60 static inline base::Vector<uint8_t> GetCentralStackView(
62 return Simulator::current(isolate)->GetCentralStackView();
66 static int JSStackLimitMargin() {
return Simulator::JSStackLimitMargin(); }
73 Simulator::current(isolate)->IterateRegistersAndStack(visitor);
86 const uintptr_t kPlaceHolder = 0x4A535350u;
87 return Simulator::current(isolate)->PushAddress(kPlaceHolder);
92 Simulator::current(isolate)->PopAddress();
110#if V8_ENABLE_WEBASSEMBLY
114 size_t size = isolate->stack_size() + JSStackLimitMargin();
115 uintptr_t lower_bound = upper_bound -
size;
116 return base::VectorOf(
reinterpret_cast<uint8_t*
>(lower_bound), size);
119 static constexpr int JSStackLimitMargin() {
149template <
typename Return,
typename... Args>
163 return FromAddress(isolate, code->instruction_start());
171#if defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN) && \
172 !defined(V8_OS_STARBOARD) && !defined(V8_TARGET_ARCH_ARM)
174 "Generated code execution not possible during cross-compilation."
175 "Also, generic C function calls are not implemented on 32-bit arm "
188#if defined(V8_TARGET_OS_WIN) && !defined(V8_OS_WIN) && \
189 !defined(V8_OS_STARBOARD)
190 FATAL(
"Generated code execution not possible during cross-compilation.");
192#if ABI_USES_FUNCTION_DESCRIPTORS
196 void* function_desc[2] = {0,
reinterpret_cast<void*
>(
fn_ptr_)};
197 asm volatile(
" stg 5,%0 " :
"=m"(function_desc[0])::
"r5");
227template <
typename Return,
typename... Args>
static StackSlot GetStackStart()
GeneratedCode(GeneratedCode< Return, Args... > other)
static GeneratedCode FromAddress(Isolate *isolate, Address addr)
static GeneratedCode FromBuffer(Isolate *isolate, uint8_t *buffer)
DISABLE_CFI_ICALL Return Call(Args... args)
static GeneratedCode FromCode(Isolate *isolate, Tagged< Code > code)
GeneratedCode(Isolate *isolate, Signature *fn_ptr)
Return(Args...) Signature
static void UnregisterJSStackComparableAddress(v8::internal::Isolate *isolate)
static bool ShouldSwitchCStackForWasmStackSwitching()
static void IterateRegistersAndStack(Isolate *isolate, ::heap::base::StackVisitor *visitor)
static uintptr_t JsLimitFromCLimit(v8::internal::Isolate *isolate, uintptr_t c_limit)
static uintptr_t RegisterJSStackComparableAddress(v8::internal::Isolate *isolate)
static constexpr int kJSLimitOffsetKB
base::Vector< const DirectHandle< Object > > args
constexpr Vector< T > VectorOf(T *start, size_t size)
uintptr_t GetCurrentStackPosition()
refactor address components for immediate indexing make OptimizeMaglevOnNextCall optimize to turbofan instead of maglev filter for tracing turbofan compilation trace turbo cfg trace TurboFan s graph trimmer trace TurboFan s control equivalence trace TurboFan s register allocator trace stack load store counters for optimized code in run fuzzing &&concurrent_recompilation trace_turbo trace_turbo_scheduled trace_turbo_stack_accesses verify TurboFan machine graph of code stubs enable FixedArray bounds checks print TurboFan statistics of wasm compilations maximum cumulative size of bytecode considered for inlining scale factor of bytecode size used to calculate the inlining budget * KB
#define DCHECK_NOT_NULL(val)
#define DISABLE_CFI_ICALL