Index: src/crankshaft/s390/lithium-codegen-s390.cc |
diff --git a/src/crankshaft/s390/lithium-codegen-s390.cc b/src/crankshaft/s390/lithium-codegen-s390.cc |
index 32784a167f180dc1f6b74ad4f370cb70b0dbaf0a..e0b8ec72c16da595f5936c3edd782d85233ba91a 100644 |
--- a/src/crankshaft/s390/lithium-codegen-s390.cc |
+++ b/src/crankshaft/s390/lithium-codegen-s390.cc |
@@ -1278,7 +1278,7 @@ void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { |
__ beq(&done, Label::kNear); |
// We performed a truncating division. Correct the result. |
- __ SubP(result, result, Operand(1)); |
+ __ Sub32(result, result, Operand(1)); |
__ bind(&done); |
} |
@@ -4226,7 +4226,22 @@ void LCodeGen::DoStoreKeyedFixedArray(LStoreKeyed* instr) { |
if (hinstr->key()->representation().IsSmi()) { |
__ SmiToPtrArrayOffset(scratch, key); |
} else { |
- __ ShiftLeftP(scratch, key, Operand(kPointerSizeLog2)); |
+ if (instr->hydrogen()->IsDehoisted()) { |
+#if V8_TARGET_ARCH_S390X |
+ // If array access is dehoisted, the key, being an int32, can contain |
+ // a negative value, as needs to be sign-extended to 64-bit for |
+ // memory access. |
+ __ lgfr(key, key); |
+#endif |
+ __ ShiftLeftP(scratch, key, Operand(kPointerSizeLog2)); |
+ } else { |
+ // Small optimization to reduce pathlength. After Bounds Check, |
+ // the key is guaranteed to be non-negative. Leverage RISBG, |
+ // which also performs zero-extension. |
+ __ risbg(scratch, key, Operand(32 - kPointerSizeLog2), |
+ Operand(63 - kPointerSizeLog2), Operand(kPointerSizeLog2), |
+ true); |
+ } |
} |
} |