Index: src/regexp/s390/regexp-macro-assembler-s390.cc |
diff --git a/src/regexp/s390/regexp-macro-assembler-s390.cc b/src/regexp/s390/regexp-macro-assembler-s390.cc |
index d9ca1df3124c8c660f2ac8a41524c02d6d23f228..93bb7029ab02b5020df457f8e00ff7c11ed2fb41 100644 |
--- a/src/regexp/s390/regexp-macro-assembler-s390.cc |
+++ b/src/regexp/s390/regexp-macro-assembler-s390.cc |
@@ -1232,17 +1232,52 @@ bool RegExpMacroAssemblerS390::CanReadUnaligned() { |
void RegExpMacroAssemblerS390::LoadCurrentCharacterUnchecked(int cp_offset, |
int characters) { |
- DCHECK(characters == 1); |
+ DCHECK(characters == 1 || CanReadUnaligned()); |
if (mode_ == LATIN1) { |
- __ LoadlB(current_character(), |
- MemOperand(current_input_offset(), end_of_input_address(), |
- cp_offset * char_size())); |
+ // using load reverse for big-endian platforms |
+ if (characters == 4) { |
+#if V8_TARGET_LITTLE_ENDIAN |
+ __ LoadlW(current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+#else |
+ __ LoadLogicalReversedWordP(current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+#endif |
+ } else if (characters == 2) { |
+#if V8_TARGET_LITTLE_ENDIAN |
+ __ LoadLogicalHalfWordP(current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+#else |
+ __ LoadLogicalReversedHalfWordP(current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+#endif |
+ } else { |
+ DCHECK(characters == 1); |
+ __ LoadlB(current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+ } |
} else { |
DCHECK(mode_ == UC16); |
- __ LoadLogicalHalfWordP( |
- current_character(), |
- MemOperand(current_input_offset(), end_of_input_address(), |
- cp_offset * char_size())); |
+ if (characters == 2) { |
+ __ LoadlW(current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+#if !V8_TARGET_LITTLE_ENDIAN |
+ // need to swap the order of the characters for big-endian platforms |
+ __ rll(current_character(), current_character(), Operand(16)); |
+#endif |
+ } else { |
+ DCHECK(characters == 1); |
+ __ LoadLogicalHalfWordP( |
+ current_character(), |
+ MemOperand(current_input_offset(), end_of_input_address(), |
+ cp_offset * char_size())); |
+ } |
} |
} |