Chromium Code Reviews

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: Fixed compilation errors, added key_not_negative bool arg for IndexToArrayOffset Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« 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..b5bab77b44948a1855420997b62dee877243d12c 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 key_not_negative) {
JoranSiu 2016/06/06 20:02:45 maybe rename key_not_negative to keyIsNonNegative?
if (isSmi) {
SmiToArrayOffset(dst, src, elementSizeLog2);
- } else {
+ } else if (key_not_negative ||
+ !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