From fe68761b4233b36252e38492bdbd5c4e8a8bc3f6 Mon Sep 17 00:00:00 2001 From: Heiher Date: Thu, 21 Jul 2016 09:23:55 +0800 Subject: [PATCH] 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(-) --- .../jit/mips-shared/Lowering-mips-shared.cpp | 49 ++++++------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/js/src/jit/mips-shared/Lowering-mips-shared.cpp b/js/src/jit/mips-shared/Lowering-mips-shared.cpp index 6ccaa6dac1b3..c78afd09e61b 100644 --- a/js/src/jit/mips-shared/Lowering-mips-shared.cpp +++ b/js/src/jit/mips-shared/Lowering-mips-shared.cpp @@ -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); }