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

Unified Diff: src/s390/macro-assembler-s390.h

Issue 2043843002: S390: Used RISBG in MacroAssembler::IndexToArrayOffset to improve performance. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Changed keyIsNotNegative to keyMaybeNegative (previous bool direction was incorrect). Added default… Created 4 years, 6 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 | « src/crankshaft/s390/lithium-codegen-s390.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/macro-assembler-s390.h
diff --git a/src/s390/macro-assembler-s390.h b/src/s390/macro-assembler-s390.h
index 19f0f7cd9e3d7446e490893591979468d60a3716..23b353ed0141700ca86d014f66d6b800b87d6a4b 100644
--- a/src/s390/macro-assembler-s390.h
+++ b/src/s390/macro-assembler-s390.h
@@ -1582,17 +1582,29 @@ class MacroAssembler : public Assembler {
}
void IndexToArrayOffset(Register dst, Register src, int elementSizeLog2,
- bool isSmi) {
+ bool isSmi, bool keyMaybeNegative) {
if (isSmi) {
SmiToArrayOffset(dst, src, elementSizeLog2);
- } else {
+ } else if (keyMaybeNegative ||
+ !CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) {
#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.
+ //
// src (key) is a 32-bit integer. Sign extension ensures
// upper 32-bit does not contain garbage before being used to
// reference memory.
lgfr(src, src);
#endif
ShiftLeftP(dst, src, Operand(elementSizeLog2));
+ } 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(dst, src, Operand(32 - elementSizeLog2),
+ Operand(63 - elementSizeLog2), Operand(elementSizeLog2),
+ true);
}
}
« no previous file with comments | « src/crankshaft/s390/lithium-codegen-s390.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698