Bug 1173992 - Add ARM64 build support. r=glandium

This commit is contained in:
Sean Stangl 2015-06-11 15:03:20 -07:00
Родитель 6ac096ebe6
Коммит 4549e447ab
37 изменённых файлов: 148 добавлений и 103 удалений

Просмотреть файл

@ -661,7 +661,7 @@ FuncCast(F* pf)
static void*
RedirectCall(void* fun, ABIFunctionType type)
{
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
fun = Simulator::RedirectNativeFunction(fun, type);
#endif
return fun;

Просмотреть файл

@ -1163,7 +1163,7 @@ RedirectJitCodeToInterruptCheck(JSRuntime* rt, CONTEXT* context)
if (AsmJSActivation* activation = rt->asmJSActivationStack()) {
const AsmJSModule& module = activation->module();
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
if (module.containsFunctionPC((void*)rt->simulator()->get_pc()))
rt->simulator()->set_resume_pc(int32_t(module.interruptExit()));
#endif

Просмотреть файл

@ -104,7 +104,7 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, jsval* vp)
if (!JS_SetProperty(cx, info, "x64", value))
return false;
#ifdef JS_ARM_SIMULATOR
#ifdef JS_SIMULATOR_ARM
value = BooleanValue(true);
#else
value = BooleanValue(false);

Просмотреть файл

@ -3107,39 +3107,53 @@ fi
AC_SUBST(MOZ_VALGRIND)
dnl ========================================================
dnl = Use ARM JIT code simulator. Requires an x86 build.
dnl = Use a JIT code simulator for a foreign architecture.
dnl ========================================================
dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used,
dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined.
MOZ_ARG_ENABLE_BOOL(arm-simulator,
[ --enable-arm-simulator Enable ARM simulator for JIT code],
JS_ARM_SIMULATOR=1,
JS_ARM_SIMULATOR= )
MOZ_ARG_ENABLE_BOOL(mips-simulator,
[ --enable-mips-simulator Enable MIPS simulator for JIT code],
JS_MIPS_SIMULATOR=1,
JS_MIPS_SIMULATOR= )
MOZ_ARG_ENABLE_STRING(simulator,
[ --enable-simulator=ARCH
Enable a JIT code simulator for the specified arch.
(arm, arm64, mips).],
JS_SIMULATOR="$enableval")
if test -n "$JS_ARM_SIMULATOR" && test -n "$JS_MIPS_SIMULATOR"; then
AC_MSG_ERROR([Flags --enable-arm-simulator and --enable-mips-simulator cannot be used together.])
if test -n "$JS_SIMULATOR"; then
case "$JS_SIMULATOR" in
arm|arm64|mips) ;;
no)
JS_SIMULATOR=
;;
*) AC_MSG_ERROR([Invalid simulator. Valid simulators are: arm, arm64, mips.]) ;;
esac
fi
if test -z "$ENABLE_ION"; then
AC_DEFINE(JS_CODEGEN_NONE)
JS_CODEGEN_NONE=1
elif test -n "$JS_ARM_SIMULATOR"; then
elif test "$JS_SIMULATOR" = arm; then
if test "$CPU_ARCH" != "x86"; then
AC_MSG_ERROR([The ARM simulator only works on x86.])
fi
AC_DEFINE(JS_ARM_SIMULATOR)
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_ARM)
AC_DEFINE(JS_CODEGEN_ARM)
JS_SIMULATOR_ARM=1
JS_CODEGEN_ARM=1
elif test -n "$JS_MIPS_SIMULATOR"; then
elif test "$JS_SIMULATOR" = arm64; then
if test "$CPU_ARCH" != "x86_64"; then
AC_MSG_ERROR([The ARM64 simulator only works on x86_64.])
fi
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_ARM64)
AC_DEFINE(JS_CODEGEN_ARM64)
JS_SIMULATOR_ARM64=1
JS_CODEGEN_ARM64=1
elif test "$JS_SIMULATOR" = mips; then
if test "$CPU_ARCH" != "x86"; then
AC_MSG_ERROR([The MIPS simulator only works on x86.])
fi
AC_DEFINE(JS_MIPS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR)
AC_DEFINE(JS_SIMULATOR_MIPS)
AC_DEFINE(JS_CODEGEN_MIPS)
JS_SIMULATOR_MIPS=1
JS_CODEGEN_MIPS=1
elif test "$CPU_ARCH" = "x86"; then
AC_DEFINE(JS_CODEGEN_X86)
@ -3160,9 +3174,12 @@ elif test "$CPU_ARCH" = "mips"; then
JS_CODEGEN_MIPS=1
fi
AC_SUBST(JS_ARM_SIMULATOR)
AC_SUBST(JS_MIPS_SIMULATOR)
AC_SUBST(JS_SIMULATOR)
AC_SUBST(JS_SIMULATOR_ARM)
AC_SUBST(JS_SIMULATOR_ARM64)
AC_SUBST(JS_SIMULATOR_MIPS)
AC_SUBST(JS_CODEGEN_ARM)
AC_SUBST(JS_CODEGEN_ARM64)
AC_SUBST(JS_CODEGEN_MIPS)
AC_SUBST(JS_CODEGEN_X86)
AC_SUBST(JS_CODEGEN_X64)

Просмотреть файл

@ -2,6 +2,6 @@
--enable-debug
--enable-stdcxx-compat
--disable-shared-js
--enable-arm-simulator
--enable-simulator=arm
--target=i686-pc-linux
--host=i686-pc-linux

Просмотреть файл

@ -2,6 +2,6 @@
--enable-debug
--enable-stdcxx-compat
--disable-shared-js
--enable-arm-simulator
--enable-simulator=arm
--target=i686-apple-darwin10.0.0
--host=i686-apple-darwin10.0.0

Просмотреть файл

@ -1572,7 +1572,7 @@ jit::BailoutIonToBaseline(JSContext* cx, JitActivation* activation, JitFrameIter
bool overRecursed = false;
BaselineBailoutInfo *info = builder.info();
uint8_t* newsp = info->incomingStack - (info->copyStackTop - info->copyStackBottom);
#if defined(JS_ARM_SIMULATOR) || defined(JS_ARM64_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
if (Simulator::Current()->overRecursed(uintptr_t(newsp)))
overRecursed = true;
#else

Просмотреть файл

@ -10797,7 +10797,7 @@ ICCall_Native::Compiler::generateStubCode(MacroAssembler& masm)
masm.passABIArg(argcReg);
masm.passABIArg(vpReg);
#if defined(JS_ARM_SIMULATOR) || defined(JS_ARM64_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
// The simulator requires VM calls to be redirected to a special swi
// instruction to handle them, so we store the redirected pointer in the
// stub and use that instead of the original one.
@ -12416,7 +12416,7 @@ ICCall_Native::ICCall_Native(JitCode* stubCode, ICStub* firstMonitorStub,
templateObject_(templateObject),
pcOffset_(pcOffset)
{
#if defined(JS_ARM_SIMULATOR) || defined(JS_ARM64_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
// The simulator requires VM calls to be redirected to a special swi
// instruction to handle them. To make this work, we store the redirected
// pointer in the stub.
@ -12442,7 +12442,7 @@ ICCall_ClassHook::ICCall_ClassHook(JitCode* stubCode, ICStub* firstMonitorStub,
templateObject_(templateObject),
pcOffset_(pcOffset)
{
#if defined(JS_ARM_SIMULATOR) || defined(JS_ARM64_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
// The simulator requires VM calls to be redirected to a special swi
// instruction to handle them. To make this work, we store the redirected
// pointer in the stub.

Просмотреть файл

@ -4617,7 +4617,7 @@ class ICCall_Native : public ICMonitoredStub
HeapPtrObject templateObject_;
uint32_t pcOffset_;
#if defined(JS_ARM_SIMULATOR) || defined(JS_ARM64_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
void *native_;
#endif
@ -4643,7 +4643,7 @@ class ICCall_Native : public ICMonitoredStub
return offsetof(ICCall_Native, pcOffset_);
}
#if defined(JS_ARM_SIMULATOR) || defined(JS_ARM64_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
static size_t offsetOfNative() {
return offsetof(ICCall_Native, native_);
}

Просмотреть файл

@ -55,7 +55,7 @@ extern "C" void sync_instruction_memory(caddr_t v, u_int len);
#endif
#endif
#if defined(JS_CODEGEN_MIPS) && defined(__linux__) && !defined(JS_MIPS_SIMULATOR)
#if defined(JS_CODEGEN_MIPS) && defined(__linux__) && !defined(JS_SIMULATOR_MIPS)
#include <sys/cachectl.h>
#endif
@ -379,7 +379,7 @@ class ExecutableAllocator
static void cacheFlush(void*, size_t)
{
}
#elif defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#elif defined(JS_SIMULATOR_ARM) || defined(JS_SIMULATOR_MIPS)
static void cacheFlush(void* code, size_t size)
{
js::jit::Simulator::FlushICache(code, size);

Просмотреть файл

@ -9,13 +9,13 @@
// Various macros used by all JITs.
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
#include "jit/arm/Simulator-arm.h"
#elif defined(JS_MIPS_SIMULATOR)
#elif defined(JS_SIMULATOR_MIPS)
#include "jit/mips/Simulator-mips.h"
#endif
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#if defined(JS_SIMULATOR_ARM) || defined(JS_SIMULATOR_MIPS)
// Call into cross-jitted code by following the ABI of the simulated architecture.
#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7) \
(js::jit::Simulator::Current()->call( \

Просмотреть файл

@ -91,7 +91,7 @@ CheckOverRecursed(JSContext* cx)
// - jitStackLimit was the real stack limit and we're over-recursed
// - jitStackLimit was set to UINTPTR_MAX by JSRuntime::requestInterrupt
// and we need to call JSRuntime::handleInterrupt.
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, 0, return false);
#else
JS_CHECK_RECURSION(cx, return false);
@ -121,7 +121,7 @@ CheckOverRecursedWithExtra(JSContext* cx, BaselineFrame* frame,
uint8_t spDummy;
uint8_t* checkSp = (&spDummy) - extra;
if (earlyCheck) {
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
(void)checkSp;
JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, extra, frame->setOverRecursed());
#else
@ -135,7 +135,7 @@ CheckOverRecursedWithExtra(JSContext* cx, BaselineFrame* frame,
if (frame->overRecursed())
return false;
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
JS_CHECK_SIMULATOR_RECURSION_WITH_EXTRA(cx, extra, return false);
#else
JS_CHECK_RECURSION_WITH_SP(cx, checkSp, return false);

Просмотреть файл

@ -6,7 +6,7 @@
#include "jit/arm/Architecture-arm.h"
#ifndef JS_ARM_SIMULATOR
#ifndef JS_SIMULATOR_ARM
#include <elf.h>
#endif
@ -16,7 +16,7 @@
#include "jit/arm/Assembler-arm.h"
#include "jit/RegisterSets.h"
#if !defined(__linux__) || defined(ANDROID) || defined(JS_ARM_SIMULATOR)
#if !defined(__linux__) || defined(ANDROID) || defined(JS_SIMULATOR_ARM)
// The Android NDK and B2G do not include the hwcap.h kernel header, and it is not
// defined when building the simulator, so inline the header defines we need.
# define HWCAP_VFP (1 << 6)
@ -88,7 +88,7 @@ ParseARMCpuFeatures(const char* features, bool override = false)
flags |= HWCAP_ARMv7;
else if (count == 5 && strncmp(features, "align", 5) == 0)
flags |= HWCAP_ALIGNMENT_FAULT;
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
else if (count == 6 && strncmp(features, "hardfp", 6) == 0)
flags |= HWCAP_USE_HARDFP_ABI;
#endif
@ -154,7 +154,7 @@ ParseARMHwCapFlags(const char* armHwCap)
" vfpd32 \n"
" armv7 \n"
" align \n"
#if defined(JS_ARM_SIMULATOR)
#ifdef JS_SIMULATOR_ARM
" hardfp \n"
#endif
"\n"
@ -186,7 +186,7 @@ InitARMFlags()
if (ParseARMHwCapFlags(env))
return;
#ifdef JS_ARM_SIMULATOR
#ifdef JS_SIMULATOR_ARM
flags = HWCAP_ARMv7 | HWCAP_VFP | HWCAP_VFPv3 | HWCAP_VFPv4 | HWCAP_NEON;
#else
@ -245,7 +245,7 @@ InitARMFlags()
flags |= HWCAP_ARMv7;
#endif
#endif // JS_ARM_SIMULATOR
#endif // JS_SIMULATOR_ARM
armHwCapFlags = CanonicalizeARMHwCapFlags(flags);
@ -304,7 +304,7 @@ bool HasIDIV()
}
// This is defined in the header and inlined when not using the simulator.
#if defined(JS_ARM_SIMULATOR)
#ifdef JS_SIMULATOR_ARM
bool UseHardFpABI()
{
MOZ_ASSERT(armHwCapFlags != HWCAP_UNINITIALIZED);

Просмотреть файл

@ -626,7 +626,7 @@ uint32_t GetARMFlags();
// If the simulator is used then the ABI choice is dynamic. Otherwise the ABI is
// static and useHardFpABI is inlined so that unused branches can be optimized
// away.
#if defined(JS_ARM_SIMULATOR)
#ifdef JS_SIMULATOR_ARM
bool UseHardFpABI();
#else
static inline bool UseHardFpABI()

Просмотреть файл

@ -2196,7 +2196,7 @@ GetTempRegForIntArg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register* out)
}
#if !defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if !defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
static inline uint32_t
GetArgStackDisp(uint32_t arg)
@ -2209,7 +2209,7 @@ GetArgStackDisp(uint32_t arg)
#endif
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
static inline bool
GetFloat32ArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, FloatRegister* out)

Просмотреть файл

@ -3715,7 +3715,7 @@ MacroAssemblerARMCompat::breakpoint()
void
MacroAssemblerARMCompat::simulatorStop(const char* msg)
{
#if defined(JS_ARM_SIMULATOR)
#ifdef JS_SIMULATOR_ARM
MOZ_ASSERT(sizeof(char*) == 4);
writeInst(0xefffffff);
writeInst((int)msg);
@ -3753,7 +3753,7 @@ MacroAssemblerARMCompat::setupABICall(uint32_t args)
passedArgs_ = 0;
passedArgTypes_ = 0;
usedIntSlots_ = 0;
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
usedFloatSlots_ = 0;
usedFloat32_ = false;
padding_ = 0;
@ -3789,7 +3789,7 @@ MacroAssemblerARMCompat::setupUnalignedABICall(uint32_t args, Register scratch)
ma_push(scratch);
}
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
void
MacroAssemblerARMCompat::passHardFpABIArg(const MoveOperand& from, MoveOp::Type type)
{
@ -3864,7 +3864,7 @@ MacroAssemblerARMCompat::passHardFpABIArg(const MoveOperand& from, MoveOp::Type
}
#endif
#if !defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if !defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
void
MacroAssemblerARMCompat::passSoftFpABIArg(const MoveOperand& from, MoveOp::Type type)
{
@ -3917,7 +3917,7 @@ MacroAssemblerARMCompat::passSoftFpABIArg(const MoveOperand& from, MoveOp::Type
void
MacroAssemblerARMCompat::passABIArg(const MoveOperand& from, MoveOp::Type type)
{
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
if (UseHardFpABI())
MacroAssemblerARMCompat::passHardFpABIArg(from, type);
else
@ -3955,7 +3955,7 @@ MacroAssemblerARMCompat::callWithABIPre(uint32_t* stackAdjust, bool callFromAsmJ
MOZ_ASSERT(inCall_);
*stackAdjust = ((usedIntSlots_ > NumIntArgRegs) ? usedIntSlots_ - NumIntArgRegs : 0) * sizeof(intptr_t);
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
if (UseHardFpABI())
*stackAdjust += 2*((usedFloatSlots_ > NumFloatArgRegs) ? usedFloatSlots_ - NumFloatArgRegs : 0) * sizeof(intptr_t);
#endif
@ -4060,7 +4060,7 @@ MacroAssemblerARMCompat::callWithABIPost(uint32_t stackAdjust, MoveOp::Type resu
inCall_ = false;
}
#if defined(DEBUG) && defined(JS_ARM_SIMULATOR)
#if defined(DEBUG) && defined(JS_SIMULATOR_ARM)
static void
AssertValidABIFunctionType(uint32_t passedArgTypes)
{
@ -4095,7 +4095,7 @@ AssertValidABIFunctionType(uint32_t passedArgTypes)
void
MacroAssemblerARMCompat::callWithABI(void* fun, MoveOp::Type result)
{
#ifdef JS_ARM_SIMULATOR
#ifdef JS_SIMULATOR_ARM
MOZ_ASSERT(passedArgs_ <= 15);
passedArgTypes_ <<= ArgType_Shift;
switch (result) {

Просмотреть файл

@ -510,7 +510,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
// use between one and three slots depending on its size and alignment
// requirements.
uint32_t usedIntSlots_;
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_SIMULATOR_ARM)
uint32_t usedFloatSlots_;
bool usedFloat32_;
uint32_t padding_;

Просмотреть файл

@ -29,7 +29,7 @@
#ifndef jit_arm_Simulator_arm_h
#define jit_arm_Simulator_arm_h
#ifdef JS_ARM_SIMULATOR
#ifdef JS_SIMULATOR_ARM
#include "jslock.h"
@ -441,6 +441,6 @@ class Simulator
} // namespace jit
} // namespace js
#endif /* JS_ARM_SIMULATOR */
#endif /* JS_SIMULATOR_ARM */
#endif /* jit_arm_Simulator_arm_h */

Просмотреть файл

@ -7,7 +7,7 @@
#include "jit/SharedIC.h"
#include "jit/SharedICHelpers.h"
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
#include "jit/arm64/Assembler-arm64.h"
#include "jit/arm64/BaselineCompiler-arm64.h"
#include "jit/arm64/vixl/Debugger-vixl.h"

Просмотреть файл

@ -388,7 +388,7 @@ MacroAssemblerCompat::callWithABIPost(uint32_t stackAdjust, MoveOp::Type result)
// no other work needs to be done.
}
#if defined(DEBUG) && defined(JS_ARM64_SIMULATOR)
#if defined(DEBUG) && defined(JS_SIMULATOR_ARM64)
static void
AssertValidABIFunctionType(uint32_t passedArgTypes)
{
@ -418,12 +418,12 @@ AssertValidABIFunctionType(uint32_t passedArgTypes)
MOZ_CRASH("Unexpected type");
}
}
#endif // DEBUG && JS_ARM64_SIMULATOR
#endif // DEBUG && JS_SIMULATOR_ARM64
void
MacroAssemblerCompat::callWithABI(void* fun, MoveOp::Type result)
{
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
MOZ_ASSERT(passedIntArgs_ + passedFloatArgs_ <= 15);
passedArgTypes_ <<= ArgType_Shift;
switch (result) {
@ -437,7 +437,7 @@ MacroAssemblerCompat::callWithABI(void* fun, MoveOp::Type result)
# endif
ABIFunctionType type = ABIFunctionType(passedArgTypes_);
fun = vixl::Simulator::RedirectNativeFunction(fun, type);
#endif // JS_ARM64_SIMULATOR
#endif // JS_SIMULATOR_ARM64
uint32_t stackAdjust;
callWithABIPre(&stackAdjust);

Просмотреть файл

@ -3264,7 +3264,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
// Emits a simulator directive to save the current sp on an internal stack.
void simulatorMarkSP() {
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
svc(vixl::kMarkStackPointer);
#endif
}
@ -3272,7 +3272,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
// Emits a simulator directive to pop from its internal stack
// and assert that the value is equal to the current sp.
void simulatorCheckSP() {
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
svc(vixl::kCheckStackPointer);
#endif
}

Просмотреть файл

@ -63,7 +63,7 @@ CPU::SetUp()
uint32_t
CPU::GetCacheType()
{
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
// This will lead to a cache with 1 byte long lines, which is fine since the
// simulator will not need this information.
return 0;
@ -80,7 +80,7 @@ CPU::GetCacheType()
void
CPU::EnsureIAndDCacheCoherency(void* address, size_t length)
{
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
USE(address);
USE(length);
#else
@ -162,7 +162,7 @@ CPU::EnsureIAndDCacheCoherency(void* address, size_t length)
// isb : Instruction Synchronisation Barrier
" isb\n"
: : : "memory");
#endif // JS_ARM64_SIMULATOR
#endif // JS_SIMULATOR_ARM64
}
} // namespace vixl

Просмотреть файл

@ -26,7 +26,7 @@
#include "js-config.h"
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
#include "jit/arm64/vixl/Debugger-vixl.h"
@ -1506,4 +1506,4 @@ bool InvalidCommand::Run(Debugger* debugger) {
} // namespace vixl
#endif // JS_ARM64_SIMULATOR
#endif // JS_SIMULATOR_ARM64

Просмотреть файл

@ -1222,7 +1222,7 @@ void MacroAssembler::PrintfNoPreserve(const char * format, const CPURegister& ar
// Actually call printf. This part needs special handling for the simulator,
// since the system printf function will use a different instruction set and
// the procedure-call standard will not be compatible.
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
{
InstructionAccurateScope scope(this, kPrintfLength / kInstructionSize);
hlt(kPrintfOpcode);
@ -1319,7 +1319,7 @@ void MacroAssembler::Printf(const char * format, CPURegister arg0, CPURegister a
void MacroAssembler::Trace(TraceParameters parameters, TraceCommand command) {
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
// The arguments to the trace pseudo instruction need to be contiguous in
// memory, so make sure we don't try to emit a literal pool.
InstructionAccurateScope scope(this, kTraceLength / kInstructionSize);
@ -1343,7 +1343,7 @@ void MacroAssembler::Trace(TraceParameters parameters, TraceCommand command) {
void MacroAssembler::Log(TraceParameters parameters) {
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
// The arguments to the log pseudo instruction need to be contiguous in
// memory, so make sure we don't try to emit a literal pool.
InstructionAccurateScope scope(this, kLogLength / kInstructionSize);

Просмотреть файл

@ -926,7 +926,7 @@ class MacroAssembler : public js::jit::Assembler {
umsubl(rd, rn, rm, ra);
}
void Unreachable() {
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
hlt(kUnreachableOpcode);
#else
// Branch to 0 to generate a segfault.

Просмотреть файл

@ -26,7 +26,7 @@
#include "js-config.h"
#ifdef JS_ARM64_SIMULATOR
#ifdef JS_SIMULATOR_ARM64
#include "jit/arm64/vixl/Simulator-vixl.h"
@ -2867,4 +2867,4 @@ void Simulator::DoPrintf(const Instruction* instr) {
} // namespace vixl
#endif // JS_ARM64_SIMULATOR
#endif // JS_SIMULATOR_ARM64

Просмотреть файл

@ -23,7 +23,7 @@ uint32_t GetMIPSFlags()
static uint32_t flags = 0;
if (isSet)
return flags;
#ifdef JS_MIPS_SIMULATOR
#ifdef JS_SIMULATOR_MIPS
isSet = true;
flags |= HWCAP_FPU;
return flags;
@ -46,7 +46,7 @@ uint32_t GetMIPSFlags()
#endif
return false;
#endif // JS_MIPS_SIMULATOR
#endif // JS_SIMULATOR_MIPS
}
bool hasFPU()

Просмотреть файл

@ -1024,7 +1024,7 @@ class Assembler : public AssemblerShared
static void TraceDataRelocations(JSTracer* trc, JitCode* code, CompactBufferReader& reader);
static bool SupportsFloatingPoint() {
#if (defined(__mips_hard_float) && !defined(__mips_single_float)) || defined(JS_MIPS_SIMULATOR)
#if (defined(__mips_hard_float) && !defined(__mips_single_float)) || defined(JS_SIMULATOR_MIPS)
return true;
#else
return false;

Просмотреть файл

@ -3383,7 +3383,7 @@ MacroAssemblerMIPSCompat::callWithABIPost(uint32_t stackAdjust, MoveOp::Type res
inCall_ = false;
}
#if defined(DEBUG) && defined(JS_MIPS_SIMULATOR)
#if defined(DEBUG) && defined(JS_SIMULATOR_MIPS)
static void
AssertValidABIFunctionType(uint32_t passedArgTypes)
{
@ -3418,7 +3418,7 @@ AssertValidABIFunctionType(uint32_t passedArgTypes)
void
MacroAssemblerMIPSCompat::callWithABI(void* fun, MoveOp::Type result)
{
#ifdef JS_MIPS_SIMULATOR
#ifdef JS_SIMULATOR_MIPS
MOZ_ASSERT(passedArgs_ <= 15);
passedArgTypes_ <<= ArgType_Shift;
switch (result) {

Просмотреть файл

@ -29,7 +29,7 @@
#ifndef jit_mips_Simulator_mips_h
#define jit_mips_Simulator_mips_h
#ifdef JS_MIPS_SIMULATOR
#ifdef JS_SIMULATOR_MIPS
#include "jslock.h"
@ -416,6 +416,6 @@ class Simulator {
} // namespace jit
} // namespace js
#endif /* JS_MIPS_SIMULATOR */
#endif /* JS_SIMULATOR_MIPS */
#endif /* jit_mips_Simulator_mips_h */

Просмотреть файл

@ -5,7 +5,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if defined(JS_MIPS_SIMULATOR)
#if defined(JS_SIMULATOR_MIPS)
#include "jit/Linker.h"
#include "jit/MacroAssembler.h"
#include "jit/mips/Assembler-mips.h"

Просмотреть файл

@ -5,7 +5,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
#include "jit/arm/Assembler-arm.h"
#include "jit/arm/MoveEmitter-arm.h"
#include "jit/arm/Simulator-arm.h"

Просмотреть файл

@ -1149,7 +1149,7 @@ JSContext::mark(JSTracer* trc)
void*
ExclusiveContext::stackLimitAddressForJitCode(StackKind kind)
{
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
return runtime_->addressOfSimulatorStackLimit();
#else
return stackLimitAddress(kind);

Просмотреть файл

@ -414,10 +414,38 @@ elif CONFIG['JS_CODEGEN_ARM']:
'jit/arm/MoveEmitter-arm.cpp',
'jit/arm/Trampoline-arm.cpp',
]
if CONFIG['JS_ARM_SIMULATOR']:
if CONFIG['JS_SIMULATOR_ARM']:
UNIFIED_SOURCES += [
'jit/arm/Simulator-arm.cpp'
]
elif CONFIG['JS_CODEGEN_ARM64']:
UNIFIED_SOURCES += [
'jit/arm64/Architecture-arm64.cpp',
'jit/arm64/Assembler-arm64.cpp',
'jit/arm64/Bailouts-arm64.cpp',
'jit/arm64/BaselineIC-arm64.cpp',
'jit/arm64/CodeGenerator-arm64.cpp',
'jit/arm64/Lowering-arm64.cpp',
'jit/arm64/MacroAssembler-arm64.cpp',
'jit/arm64/MoveEmitter-arm64.cpp',
'jit/arm64/Trampoline-arm64.cpp',
'jit/arm64/vixl/Assembler-vixl.cpp',
'jit/arm64/vixl/Cpu-vixl.cpp',
'jit/arm64/vixl/Decoder-vixl.cpp',
'jit/arm64/vixl/Disasm-vixl.cpp',
'jit/arm64/vixl/Instructions-vixl.cpp',
'jit/arm64/vixl/Instrument-vixl.cpp',
'jit/arm64/vixl/MacroAssembler-vixl.cpp',
'jit/arm64/vixl/MozAssembler-vixl.cpp',
'jit/arm64/vixl/MozInstructions-vixl.cpp',
'jit/arm64/vixl/Utils-vixl.cpp'
]
if CONFIG['JS_SIMULATOR_ARM64']:
UNIFIED_SOURCES += [
'jit/arm64/vixl/Debugger-vixl.cpp',
'jit/arm64/vixl/MozSimulator-vixl.cpp',
'jit/arm64/vixl/Simulator-vixl.cpp'
]
elif CONFIG['JS_CODEGEN_MIPS']:
UNIFIED_SOURCES += [
'jit/mips/Architecture-mips.cpp',
@ -431,7 +459,7 @@ elif CONFIG['JS_CODEGEN_MIPS']:
'jit/mips/MoveEmitter-mips.cpp',
'jit/mips/Trampoline-mips.cpp',
]
if CONFIG['JS_MIPS_SIMULATOR']:
if CONFIG['JS_SIMULATOR_MIPS']:
UNIFIED_SOURCES += [
'jit/mips/Simulator-mips.cpp'
]

Просмотреть файл

@ -3959,7 +3959,7 @@ PrintProfilerEvents(JSContext* cx, unsigned argc, Value* vp)
return true;
}
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
typedef Vector<char16_t, 0, SystemAllocPolicy> StackChars;
Vector<StackChars, 0, SystemAllocPolicy> stacks;
@ -4007,7 +4007,7 @@ SingleStepCallback(void* arg, jit::Simulator* sim, void* pc)
static bool
EnableSingleStepProfiling(JSContext* cx, unsigned argc, Value* vp)
{
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
CallArgs args = CallArgsFromVp(argc, vp);
jit::Simulator* sim = cx->runtime()->simulator();
@ -4024,7 +4024,7 @@ EnableSingleStepProfiling(JSContext* cx, unsigned argc, Value* vp)
static bool
DisableSingleStepProfiling(JSContext* cx, unsigned argc, Value* vp)
{
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
CallArgs args = CallArgsFromVp(argc, vp);
jit::Simulator* sim = cx->runtime()->simulator();
@ -6046,14 +6046,14 @@ SetRuntimeOptions(JSRuntime* rt, const OptionParser& op)
jit::Assembler::AsmPoolMaxOffset = poolMaxOffset;
#endif
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
if (op.getBoolOption("arm-sim-icache-checks"))
jit::Simulator::ICacheCheckingEnabled = true;
int32_t stopAt = op.getIntOption("arm-sim-stop-at");
if (stopAt >= 0)
jit::Simulator::StopSimAt = stopAt;
#elif defined(JS_MIPS_SIMULATOR)
#elif defined(JS_SIMULATOR_MIPS)
if (op.getBoolOption("mips-sim-icache-checks"))
jit::Simulator::ICacheCheckingEnabled = true;
@ -6335,12 +6335,12 @@ main(int argc, char** argv, char** envp)
|| !op.addIntOption('\0', "asm-pool-max-offset", "OFFSET",
"The maximum pc relative OFFSET permitted in pool reference instructions.", 1024)
#endif
#if defined(JS_ARM_SIMULATOR)
#if defined(JS_SIMULATOR_ARM)
|| !op.addBoolOption('\0', "arm-sim-icache-checks", "Enable icache flush checks in the ARM "
"simulator.")
|| !op.addIntOption('\0', "arm-sim-stop-at", "NUMBER", "Stop the ARM simulator after the given "
"NUMBER of instructions.", -1)
#elif defined(JS_MIPS_SIMULATOR)
#elif defined(JS_SIMULATOR_MIPS)
|| !op.addBoolOption('\0', "mips-sim-icache-checks", "Enable icache flush checks in the MIPS "
"simulator.")
|| !op.addIntOption('\0', "mips-sim-stop-at", "NUMBER", "Stop the MIPS simulator after the given "

Просмотреть файл

@ -161,7 +161,7 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
#endif
gc(thisFromCtor()),
gcInitialized(false),
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
simulator_(nullptr),
#endif
scriptAndCountsVector(nullptr),
@ -320,7 +320,7 @@ JSRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes)
dateTimeInfo.updateTimeZoneAdjustment();
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
simulator_ = js::jit::Simulator::Create();
if (!simulator_)
return false;
@ -441,7 +441,7 @@ JSRuntime::~JSRuntime()
gc.storeBuffer.disable();
gc.nursery.disable();
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
js::jit::Simulator::Destroy(simulator_);
#endif
@ -597,7 +597,7 @@ JSRuntime::resetJitStackLimit()
// Note that, for now, we use the untrusted limit for ion. This is fine,
// because it's the most conservative limit, and if we hit it, we'll bail
// out of ion into the interpeter, which will do a proper recursion check.
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
jitStackLimit_ = jit::Simulator::StackLimit();
#else
jitStackLimit_ = mainThread.nativeStackLimit[StackForUntrustedScript];

Просмотреть файл

@ -570,7 +570,7 @@ class PerThreadData : public PerThreadDataFriendFields
js::jit::AutoFlushICache* autoFlushICache() const;
void setAutoFlushICache(js::jit::AutoFlushICache* afc);
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
js::jit::Simulator* simulator() const;
#endif
};
@ -1023,12 +1023,12 @@ struct JSRuntime : public JS::shadow::Runtime,
gc.unlockGC();
}
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
js::jit::Simulator* simulator_;
#endif
public:
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)
#ifdef JS_SIMULATOR
js::jit::Simulator* simulator() const;
uintptr_t* addressOfSimulatorStackLimit();
#endif