Bug 1058587 - OdinMonkey MIPS: bias the global-register to improve instruction encoding efficiency. r=dougc

This commit is contained in:
Douglas Crosher 2014-08-27 10:08:16 +10:00
Родитель 1352a84f62
Коммит 0ca46008dc
4 изменённых файлов: 18 добавлений и 9 удалений

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

@ -6651,10 +6651,11 @@ GenerateAsyncInterruptExit(ModuleCompiler &m, Label *throwLabel)
// Pop resumePC into PC. Clobber HeapReg to make the jump and restore it
// during jump delay slot.
JS_ASSERT(Imm16::IsInSignedRange(AsmJSModule::heapGlobalDataOffset()));
JS_ASSERT(Imm16::IsInSignedRange(AsmJSModule::heapGlobalDataOffset() - AsmJSGlobalRegBias));
masm.pop(HeapReg);
masm.as_jr(HeapReg);
masm.loadPtr(Address(GlobalReg, AsmJSModule::heapGlobalDataOffset()), HeapReg);
masm.loadPtr(Address(GlobalReg, AsmJSModule::heapGlobalDataOffset() - AsmJSGlobalRegBias),
HeapReg);
#elif defined(JS_CODEGEN_ARM)
masm.setFramePushed(0); // set to zero so we can use masm.framePushed() below
masm.PushRegsInMask(RegisterSet(GeneralRegisterSet(Registers::AllMask & ~(1<<Registers::sp)), FloatRegisterSet(uint32_t(0)))); // save all GP registers,excep sp

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

@ -119,6 +119,11 @@ static MOZ_CONSTEXPR_VAR FloatRegister ScratchDoubleReg = { FloatRegisters::f18,
static MOZ_CONSTEXPR_VAR FloatRegister SecondScratchFloat32Reg = { FloatRegisters::f16, FloatRegister::Single };
static MOZ_CONSTEXPR_VAR FloatRegister SecondScratchDoubleReg = { FloatRegisters::f16, FloatRegister::Double };
// A bias applied to the GlobalReg to allow the use of instructions with small
// negative immediate offsets which doubles the range of global data that can be
// accessed with a single instruction.
static const int32_t AsmJSGlobalRegBias = 32768;
// Registers used in the GenerateFFIIonExit Enable Activation block.
static MOZ_CONSTEXPR_VAR Register AsmJSIonExitRegCallee = t0;
static MOZ_CONSTEXPR_VAR Register AsmJSIonExitRegE0 = a0;

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

@ -1954,9 +1954,11 @@ CodeGeneratorMIPS::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
// Offset is out of range. Load default values.
if (isFloat) {
if (size == 32)
masm.loadFloat32(Address(GlobalReg, AsmJSNaN32GlobalDataOffset), ToFloatRegister(out));
masm.loadFloat32(Address(GlobalReg, AsmJSNaN32GlobalDataOffset - AsmJSGlobalRegBias),
ToFloatRegister(out));
else
masm.loadDouble(Address(GlobalReg, AsmJSNaN64GlobalDataOffset), ToFloatRegister(out));
masm.loadDouble(Address(GlobalReg, AsmJSNaN64GlobalDataOffset - AsmJSGlobalRegBias),
ToFloatRegister(out));
} else {
masm.move32(Imm32(0), ToRegister(out));
}
@ -2147,7 +2149,7 @@ bool
CodeGeneratorMIPS::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins)
{
const MAsmJSLoadGlobalVar *mir = ins->mir();
unsigned addr = mir->globalDataOffset();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (mir->type() == MIRType_Int32)
masm.load32(Address(GlobalReg, addr), ToRegister(ins->output()));
else if (mir->type() == MIRType_Float32)
@ -2164,7 +2166,7 @@ CodeGeneratorMIPS::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins)
MIRType type = mir->value()->type();
MOZ_ASSERT(IsNumberType(type));
unsigned addr = mir->globalDataOffset();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
if (mir->value()->type() == MIRType_Int32)
masm.store32(ToRegister(ins->value()), Address(GlobalReg, addr));
else if (mir->value()->type() == MIRType_Float32)
@ -2182,7 +2184,7 @@ CodeGeneratorMIPS::visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins)
Register index = ToRegister(ins->index());
Register tmp = ToRegister(ins->temp());
Register out = ToRegister(ins->output());
unsigned addr = mir->globalDataOffset();
unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias;
BaseIndex source(GlobalReg, index, TimesFour, addr);
masm.load32(source, out);
@ -2193,7 +2195,8 @@ bool
CodeGeneratorMIPS::visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins)
{
const MAsmJSLoadFFIFunc *mir = ins->mir();
masm.loadPtr(Address(GlobalReg, mir->globalDataOffset()), ToRegister(ins->output()));
masm.loadPtr(Address(GlobalReg, mir->globalDataOffset() - AsmJSGlobalRegBias),
ToRegister(ins->output()));
return true;
}

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

@ -1283,7 +1283,7 @@ public:
#endif
void loadAsmJSActivation(Register dest) {
loadPtr(Address(GlobalReg, AsmJSActivationGlobalDataOffset), dest);
loadPtr(Address(GlobalReg, AsmJSActivationGlobalDataOffset - AsmJSGlobalRegBias), dest);
}
};