changes to make JS both x86 and PPC by using JS_CODEGEN_PPC_OSX and JS_CODEGEN_X86

This commit is contained in:
Riccardo Mottola 2018-01-16 22:35:39 +01:00
parent b4ae677f4d
commit a1039484e4
7 changed files with 45 additions and 5 deletions

View File

@ -3161,13 +3161,17 @@ elif test "$CPU_ARCH" = "mips32"; then
elif test "$CPU_ARCH" = "mips64"; then elif test "$CPU_ARCH" = "mips64"; then
AC_DEFINE(JS_CODEGEN_MIPS64) AC_DEFINE(JS_CODEGEN_MIPS64)
JS_CODEGEN_MIPS64=1 JS_CODEGEN_MIPS64=1
elif test "$CPU_ARCH" = "ppc"; then
AC_DEFINE(JS_CODEGEN_PPC_OSX)
JS_CODEGEN_PPC_OSX=1
elif test "$CPU_ARCH" = "ppc64"; then
AC_DEFINE(JS_CODEGEN_PPC_OSX)
JS_CODEGEN_PPC_OSX=1
fi fi
dnl Hey, Mozilla, bite me. dnl Hey, Mozilla, bite me.
dnl Eventually we will expunge the old JS_CPU_PPC_OSX. dnl Eventually we will expunge the old JS_CPU_PPC_OSX.
dnl dnl
AC_DEFINE(JS_CODEGEN_PPC_OSX)
JS_CODEGEN_PPC_OSX=1
AC_SUBST(JS_CODEGEN_PPC_OSX) AC_SUBST(JS_CODEGEN_PPC_OSX)
AC_SUBST(JS_CPU_PPC_OSX) AC_SUBST(JS_CPU_PPC_OSX)

View File

@ -315,7 +315,9 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
masm.jump(&start_label_); masm.jump(&start_label_);
// Exit code: // Exit code:
#if defined(JS_CODEGEN_PPC_OSX)
BufferOffset bo_exit1, bo_exit2; BufferOffset bo_exit1, bo_exit2;
#endif
if (success_label_.used()) { if (success_label_.used()) {
MOZ_ASSERT(num_saved_registers_ > 0); MOZ_ASSERT(num_saved_registers_ > 0);

View File

@ -2542,7 +2542,7 @@ ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler& masm)
AllocatableGeneralRegisterSet regs(availableGeneralRegs(2)); AllocatableGeneralRegisterSet regs(availableGeneralRegs(2));
Register scratchReg = regs.takeAny(); Register scratchReg = regs.takeAny();
#if(0) #ifndef JS_CODEGEN_PPC_OSX
// Guard on input being an arguments object. // Guard on input being an arguments object.
masm.branchTestObject(Assembler::NotEqual, R0, &failure); masm.branchTestObject(Assembler::NotEqual, R0, &failure);
Register objReg = masm.extractObject(R0, ExtractTemp0); Register objReg = masm.extractObject(R0, ExtractTemp0);

View File

@ -1029,7 +1029,9 @@ CodeGenerator::visitValueToString(LValueToString* lir)
StoreRegisterTo(output)); StoreRegisterTo(output));
Label done; Label done;
#ifdef JS_CODEGEN_PPC_OSX
BufferOffset bo_done1, bo_done2, bo_done3, bo_done4, bo_done5, bo_done6; BufferOffset bo_done1, bo_done2, bo_done3, bo_done4, bo_done5, bo_done6;
#endif
Register tag = masm.splitTagForTest(input); Register tag = masm.splitTagForTest(input);
const JSAtomState& names = GetJitContext()->runtime->names(); const JSAtomState& names = GetJitContext()->runtime->names();

View File

@ -310,20 +310,40 @@ MacroAssembler::loadFromTypedArray(Scalar::Type arrayType, const T& src, AnyRegi
load8ZeroExtend(src, dest.gpr()); load8ZeroExtend(src, dest.gpr());
break; break;
case Scalar::Int16: case Scalar::Int16:
#if defined(JS_CODEGEN_PPC_OSX)
load16SignExtendSwapped(src, dest.gpr()); load16SignExtendSwapped(src, dest.gpr());
#elif defined(JS_CODEGEN_X86)
load16SignExtend(src, dest.gpr());
#endif
break; break;
case Scalar::Uint16: case Scalar::Uint16:
#if defined(JS_CODEGEN_PPC_OSX)
load16ZeroExtendSwapped(src, dest.gpr()); load16ZeroExtendSwapped(src, dest.gpr());
#elif defined(JS_CODEGEN_X86)
load16ZeroExtend(src, dest.gpr());
#endif
break; break;
case Scalar::Int32: case Scalar::Int32:
#if defined(JS_CODEGEN_PPC_OSX)
load32ByteSwapped(src, dest.gpr()); load32ByteSwapped(src, dest.gpr());
#elif defined(JS_CODEGEN_X86)
load32Byte(src, dest.gpr());
#endif
break; break;
case Scalar::Uint32: case Scalar::Uint32:
if (dest.isFloat()) { if (dest.isFloat()) {
#if defined(JS_CODEGEN_PPC_OSX)
load32ByteSwapped(src, temp); load32ByteSwapped(src, temp);
#elif defined(JS_CODEGEN_X86)
load32Byte(src, temp);
#endif
convertUInt32ToDouble(temp, dest.fpu()); convertUInt32ToDouble(temp, dest.fpu());
} else { } else {
#if defined(JS_CODEGEN_PPC_OSX)
load32ByteSwapped(src, dest.gpr()); load32ByteSwapped(src, dest.gpr());
#elif defined(JS_CODEGEN_X86)
load32Byte(src, temp);
#endif
// Bail out if the value doesn't fit into a signed int32 value. This // Bail out if the value doesn't fit into a signed int32 value. This
// is what allows MLoadUnboxedScalar to have a type() of // is what allows MLoadUnboxedScalar to have a type() of
@ -491,7 +511,11 @@ MacroAssembler::loadFromTypedArray(Scalar::Type arrayType, const T& src, const V
break; break;
case Scalar::Uint32: case Scalar::Uint32:
// Don't clobber dest when we could fail, instead use temp. // Don't clobber dest when we could fail, instead use temp.
#if defined(JS_CODEGEN_PPC_OSX)
load32ByteSwapped(src, temp); load32ByteSwapped(src, temp);
#elif defined(JS_CODEGEN_X86)
load32(src, temp);
#endif
if (allowDouble) { if (allowDouble) {
// If the value fits in an int32, store an int32 type tag. // If the value fits in an int32, store an int32 type tag.
// Else, convert the value to double and box it. // Else, convert the value to double and box it.

View File

@ -1109,11 +1109,19 @@ private:
break; break;
case Scalar::Int16: case Scalar::Int16:
case Scalar::Uint16: case Scalar::Uint16:
#if defined(JS_CODEGEN_PPC_OSX)
store16Swapped(value, dest); store16Swapped(value, dest);
#elif defined(JS_CODEGEN_X86)
store16(value, dest);
#endif
break; break;
case Scalar::Int32: case Scalar::Int32:
case Scalar::Uint32: case Scalar::Uint32:
#if defined(JS_CODEGEN_PPC_OSX)
store32ByteSwapped(value, dest); store32ByteSwapped(value, dest);
#elif defined(JS_CODEGEN_X86)
store32(value, dest);
#endif
break; break;
default: default:
MOZ_CRASH("Invalid typed array type"); MOZ_CRASH("Invalid typed array type");

View File

@ -126,7 +126,7 @@ IsAnyTypedArrayClass(const Class* clasp)
class SharedOps class SharedOps
{ {
public: public:
#if(0) #ifndef JS_CODEGEN_PPC_OSX
template<typename T> template<typename T>
static T load(SharedMem<T*> addr) { static T load(SharedMem<T*> addr) {
return js::jit::AtomicOperations::loadSafeWhenRacy(addr); return js::jit::AtomicOperations::loadSafeWhenRacy(addr);
@ -214,7 +214,7 @@ class SharedOps
class UnsharedOps class UnsharedOps
{ {
public: public:
#if(0) #ifndef JS_CODEGEN_PPC_OSX
template<typename T> template<typename T>
static T load(SharedMem<T*> addr) { static T load(SharedMem<T*> addr) {
return *addr.unwrapUnshared(); return *addr.unwrapUnshared();