5 #ifndef V8_SIMULATOR_H_ 6 #define V8_SIMULATOR_H_ 8 #include "src/globals.h" 9 #include "src/objects/code.h" 11 #if V8_TARGET_ARCH_IA32 12 #include "src/ia32/simulator-ia32.h" 13 #elif V8_TARGET_ARCH_X64 14 #include "src/x64/simulator-x64.h" 15 #elif V8_TARGET_ARCH_ARM64 16 #include "src/arm64/simulator-arm64.h" 17 #elif V8_TARGET_ARCH_ARM 18 #include "src/arm/simulator-arm.h" 19 #elif V8_TARGET_ARCH_PPC 20 #include "src/ppc/simulator-ppc.h" 21 #elif V8_TARGET_ARCH_MIPS 22 #include "src/mips/simulator-mips.h" 23 #elif V8_TARGET_ARCH_MIPS64 24 #include "src/mips64/simulator-mips64.h" 25 #elif V8_TARGET_ARCH_S390 26 #include "src/s390/simulator-s390.h" 28 #error Unsupported target architecture. 34 #if defined(USE_SIMULATOR) 45 return Simulator::current(isolate)->StackLimit(c_limit);
50 return Simulator::current(isolate)->PushAddress(try_catch_address);
54 Simulator::current(isolate)->PopAddress();
58 #else // defined(USE_SIMULATOR) 75 return try_catch_address;
83 #endif // defined(USE_SIMULATOR) 87 template <
typename Return,
typename... Args>
90 using Signature = Return(Args...);
93 return GeneratedCode(isolate, reinterpret_cast<Signature*>(addr));
97 return GeneratedCode(isolate, reinterpret_cast<Signature*>(buffer));
101 return FromAddress(code->GetIsolate(), code->entry());
106 Return
Call(Args... args) {
107 return Simulator::current(isolate_)->template
Call<Return>(
108 reinterpret_cast<Address>(fn_ptr_), args...);
111 DISABLE_CFI_ICALL Return
Call(Args... args) {
113 return fn_ptr_(args...);
122 : isolate_(isolate), fn_ptr_(fn_ptr) {}
127 template <
typename Return,
typename... Args>
133 :
GeneratedCode<Return, Args...>(other.isolate_, other.fn_ptr_) {}
139 #endif // V8_SIMULATOR_H_