mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1287349 - wasm: MIPS: Fix WasmBoundsCheck/Load/Store in Lowering. r=luke
--- js/src/jit/mips-shared/Lowering-mips-shared.cpp | 49 ++++++++----------------- 1 file changed, 16 insertions(+), 33 deletions(-)
This commit is contained in:
parent
59aa6dcf38
commit
fe68761b42
@ -290,13 +290,21 @@ LIRGeneratorMIPSShared::visitWasmLoad(MWasmLoad* ins)
|
||||
MDefinition* base = ins->base();
|
||||
MOZ_ASSERT(base->type() == MIRType::Int32);
|
||||
|
||||
#ifdef JS_CODEGEN_MIPS64
|
||||
if (ins->type() == MIRType::Int64) {
|
||||
auto* lir = new(alloc()) LWasmLoadI64(useRegisterOrZeroAtStart(base));
|
||||
auto* lir = new(alloc()) LWasmLoadI64(useRegisterAtStart(base));
|
||||
if (ins->offset())
|
||||
lir->setTemp(0, tempCopy(base, 0));
|
||||
|
||||
defineInt64(lir, ins);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
auto* lir = new(alloc()) LWasmLoad(useRegisterAtStart(base));
|
||||
if (ins->offset())
|
||||
lir->setTemp(0, tempCopy(base, 0));
|
||||
|
||||
auto* lir = new(alloc()) LWasmLoad(useRegisterOrZeroAtStart(base));
|
||||
define(lir, ins);
|
||||
}
|
||||
|
||||
@ -307,38 +315,13 @@ LIRGeneratorMIPSShared::visitWasmStore(MWasmStore* ins)
|
||||
MOZ_ASSERT(base->type() == MIRType::Int32);
|
||||
|
||||
MDefinition* value = ins->value();
|
||||
LAllocation valueAlloc;
|
||||
switch (ins->accessType()) {
|
||||
case Scalar::Int8:
|
||||
case Scalar::Uint8:
|
||||
case Scalar::Int16:
|
||||
case Scalar::Uint16:
|
||||
case Scalar::Int32:
|
||||
case Scalar::Uint32:
|
||||
valueAlloc = useRegisterOrConstantAtStart(value);
|
||||
break;
|
||||
case Scalar::Int64:
|
||||
// No way to encode an int64-to-memory move on x64.
|
||||
if (value->isConstant() && value->type() != MIRType::Int64)
|
||||
valueAlloc = useOrConstantAtStart(value);
|
||||
else
|
||||
valueAlloc = useRegisterAtStart(value);
|
||||
break;
|
||||
case Scalar::Float32:
|
||||
case Scalar::Float64:
|
||||
case Scalar::Float32x4:
|
||||
case Scalar::Int8x16:
|
||||
case Scalar::Int16x8:
|
||||
case Scalar::Int32x4:
|
||||
valueAlloc = useRegisterAtStart(value);
|
||||
break;
|
||||
case Scalar::Uint8Clamped:
|
||||
case Scalar::MaxTypedArrayViewType:
|
||||
MOZ_CRASH("unexpected array type");
|
||||
}
|
||||
|
||||
LAllocation baseAlloc = useRegisterOrZeroAtStart(base);
|
||||
LAllocation valueAlloc = useRegisterAtStart(value);
|
||||
LAllocation baseAlloc = useRegisterAtStart(base);
|
||||
auto* lir = new(alloc()) LWasmStore(baseAlloc, valueAlloc);
|
||||
|
||||
if (ins->offset())
|
||||
lir->setTemp(0, tempCopy(base, 0));
|
||||
|
||||
add(lir, ins);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user