Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Unified Diff: src/crankshaft/s390/lithium-codegen-s390.cc

Issue 1822103002: S390:[crankshaft] Sign-ext key before array access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/s390/macro-assembler-s390.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
« no previous file with comments | « no previous file | src/s390/macro-assembler-s390.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698