mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1290812 - Part 19: Implement the 64bit variant of WasmLoad and WasmStore on mips64. r=bbouvier
--- js/src/jit/mips-shared/Lowering-mips-shared.cpp | 16 +++++- js/src/jit/mips64/CodeGenerator-mips64.cpp | 69 ++++++++++++++++++++++--- js/src/jit/mips64/CodeGenerator-mips64.h | 1 + 3 files changed, 78 insertions(+), 8 deletions(-)
This commit is contained in:
parent
783215fff0
commit
d426441a34
@ -329,10 +329,22 @@ LIRGeneratorMIPSShared::visitWasmStore(MWasmStore* ins)
|
||||
MOZ_ASSERT(base->type() == MIRType::Int32);
|
||||
|
||||
MDefinition* value = ins->value();
|
||||
LAllocation valueAlloc = useRegisterAtStart(value);
|
||||
LAllocation baseAlloc = useRegisterAtStart(base);
|
||||
auto* lir = new(alloc()) LWasmStore(baseAlloc, valueAlloc);
|
||||
|
||||
#ifdef JS_CODEGEN_MIPS64
|
||||
if (ins->type() == MIRType::Int64) {
|
||||
LInt64Allocation valueAlloc = useInt64RegisterAtStart(value);
|
||||
auto* lir = new(alloc()) LWasmStoreI64(baseAlloc, valueAlloc);
|
||||
if (ins->offset())
|
||||
lir->setTemp(0, tempCopy(base, 0));
|
||||
|
||||
add(lir, ins);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
LAllocation valueAlloc = useRegisterAtStart(value);
|
||||
auto* lir = new(alloc()) LWasmStore(baseAlloc, valueAlloc);
|
||||
if (ins->offset())
|
||||
lir->setTemp(0, tempCopy(base, 0));
|
||||
|
||||
|
@ -416,14 +416,9 @@ CodeGeneratorMIPS64::visitWasmLoadI64(LWasmLoadI64* lir)
|
||||
const MWasmLoad* mir = lir->mir();
|
||||
|
||||
MOZ_ASSERT(lir->mir()->type() == MIRType::Int64);
|
||||
MOZ_ASSERT(!mir->barrierBefore() && !mir->barrierAfter(), "atomics NYI");
|
||||
|
||||
uint32_t offset = mir->offset();
|
||||
if (offset > INT32_MAX) {
|
||||
// This is unreachable because of bounds checks.
|
||||
masm.breakpoint();
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(offset < wasm::OffsetGuardLimit);
|
||||
|
||||
Register ptr = ToRegister(lir->ptr());
|
||||
|
||||
@ -436,7 +431,69 @@ CodeGeneratorMIPS64::visitWasmLoadI64(LWasmLoadI64* lir)
|
||||
MOZ_ASSERT(lir->ptrCopy()->isBogusTemp());
|
||||
}
|
||||
|
||||
masm.ma_load(ToRegister(lir->output()), BaseIndex(HeapReg, ptr, TimesOne), SizeDouble);
|
||||
unsigned byteSize = mir->byteSize();
|
||||
bool isSigned;
|
||||
|
||||
switch (mir->accessType()) {
|
||||
case Scalar::Int8: isSigned = true; break;
|
||||
case Scalar::Uint8: isSigned = false; break;
|
||||
case Scalar::Int16: isSigned = true; break;
|
||||
case Scalar::Uint16: isSigned = false; break;
|
||||
case Scalar::Int32: isSigned = true; break;
|
||||
case Scalar::Uint32: isSigned = false; break;
|
||||
case Scalar::Int64: isSigned = true; break;
|
||||
default: MOZ_CRASH("unexpected array type");
|
||||
}
|
||||
|
||||
memoryBarrier(mir->barrierBefore());
|
||||
|
||||
masm.ma_load(ToOutRegister64(lir).reg, BaseIndex(HeapReg, ptr, TimesOne),
|
||||
static_cast<LoadStoreSize>(8 * byteSize), isSigned ? SignExtend : ZeroExtend);
|
||||
|
||||
memoryBarrier(mir->barrierAfter());
|
||||
}
|
||||
|
||||
void
|
||||
CodeGeneratorMIPS64::visitWasmStoreI64(LWasmStoreI64* lir)
|
||||
{
|
||||
const MWasmStore* mir = lir->mir();
|
||||
|
||||
MOZ_ASSERT(lir->mir()->type() == MIRType::Int64);
|
||||
|
||||
uint32_t offset = mir->offset();
|
||||
MOZ_ASSERT(offset < wasm::OffsetGuardLimit);
|
||||
|
||||
Register ptr = ToRegister(lir->ptr());
|
||||
|
||||
// Maybe add the offset.
|
||||
if (offset) {
|
||||
Register ptrPlusOffset = ToRegister(lir->ptrCopy());
|
||||
masm.addPtr(Imm32(offset), ptrPlusOffset);
|
||||
ptr = ptrPlusOffset;
|
||||
} else {
|
||||
MOZ_ASSERT(lir->ptrCopy()->isBogusTemp());
|
||||
}
|
||||
|
||||
unsigned byteSize = mir->byteSize();
|
||||
bool isSigned;
|
||||
|
||||
switch (mir->accessType()) {
|
||||
case Scalar::Int8: isSigned = true; break;
|
||||
case Scalar::Uint8: isSigned = false; break;
|
||||
case Scalar::Int16: isSigned = true; break;
|
||||
case Scalar::Uint16: isSigned = false; break;
|
||||
case Scalar::Int32: isSigned = true; break;
|
||||
case Scalar::Uint32: isSigned = false; break;
|
||||
case Scalar::Int64: isSigned = true; break;
|
||||
default: MOZ_CRASH("unexpected array type");
|
||||
}
|
||||
|
||||
memoryBarrier(mir->barrierBefore());
|
||||
|
||||
masm.ma_store(ToRegister64(lir->value()).reg, BaseIndex(HeapReg, ptr, TimesOne),
|
||||
static_cast<LoadStoreSize>(8 * byteSize), isSigned ? SignExtend : ZeroExtend);
|
||||
|
||||
memoryBarrier(mir->barrierAfter());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -49,6 +49,7 @@ class CodeGeneratorMIPS64 : public CodeGeneratorMIPSShared
|
||||
void visitDivOrModI64(LDivOrModI64* lir);
|
||||
void visitUDivOrModI64(LUDivOrModI64* lir);
|
||||
void visitWasmLoadI64(LWasmLoadI64* lir);
|
||||
void visitWasmStoreI64(LWasmStoreI64* ins);
|
||||
void visitAsmSelectI64(LAsmSelectI64* ins);
|
||||
void visitAsmReinterpretFromI64(LAsmReinterpretFromI64* lir);
|
||||
void visitAsmReinterpretToI64(LAsmReinterpretToI64* lir);
|
||||
|
Loading…
Reference in New Issue
Block a user