Bug 1287349 - wasm: MIPS: Fix WasmBoundsCheck/Load/Store in Lowering. r=luke
authorHeiher <r@hev.cc>
Thu, 21 Jul 2016 09:23:55 +0800
changeset 346002 81e2a6e05087a0d9dea730c607c79d3a07c4512b
parent 346001 77fea9f0a2a7c57d7c63f78af8f6af3bfcf8525e
child 346003 596b6c9838ec1661d73e7820555b44a58faf2091
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1287349
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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(-)
js/src/jit/mips-shared/Lowering-mips-shared.cpp
--- a/js/src/jit/mips-shared/Lowering-mips-shared.cpp
+++ b/js/src/jit/mips-shared/Lowering-mips-shared.cpp
@@ -285,65 +285,48 @@ LIRGeneratorMIPSShared::visitWasmBoundsC
 }
 
 void
 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(useRegisterOrZeroAtStart(base));
+    auto* lir = new(alloc()) LWasmLoad(useRegisterAtStart(base));
+    if (ins->offset())
+        lir->setTemp(0, tempCopy(base, 0));
+
     define(lir, ins);
 }
 
 void
 LIRGeneratorMIPSShared::visitWasmStore(MWasmStore* ins)
 {
     MDefinition* base = ins->base();
     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 valueAlloc = useRegisterAtStart(value);
+    LAllocation baseAlloc = useRegisterAtStart(base);
+    auto* lir = new(alloc()) LWasmStore(baseAlloc, valueAlloc);
 
-    LAllocation baseAlloc = useRegisterOrZeroAtStart(base);
-    auto* lir = new(alloc()) LWasmStore(baseAlloc, valueAlloc);
+    if (ins->offset())
+        lir->setTemp(0, tempCopy(base, 0));
+
     add(lir, ins);
 }
 
 void
 LIRGeneratorMIPSShared::visitAsmSelect(MAsmSelect* ins)
 {
     if (ins->type() == MIRType::Int64) {
         auto* lir = new(alloc()) LAsmSelectI64(useInt64RegisterAtStart(ins->trueExpr()),