Index: src/regexp/ppc/regexp-macro-assembler-ppc.cc |
diff --git a/src/regexp/ppc/regexp-macro-assembler-ppc.cc b/src/regexp/ppc/regexp-macro-assembler-ppc.cc |
index a7418dde53fe0bbd61cf5a09f3ce52624b7fb088..531eac10d74b7c8b897654cdac9a3d376ab8e14a 100644 |
--- a/src/regexp/ppc/regexp-macro-assembler-ppc.cc |
+++ b/src/regexp/ppc/regexp-macro-assembler-ppc.cc |
@@ -1269,11 +1269,6 @@ void RegExpMacroAssemblerPPC::CheckStackLimit() { |
} |
-bool RegExpMacroAssemblerPPC::CanReadUnaligned() { |
- return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); |
-} |
- |
- |
void RegExpMacroAssemblerPPC::LoadCurrentCharacterUnchecked(int cp_offset, |
int characters) { |
Register offset = current_input_offset(); |
@@ -1287,14 +1282,47 @@ void RegExpMacroAssemblerPPC::LoadCurrentCharacterUnchecked(int cp_offset, |
// We assume we don't want to do unaligned loads on PPC, so this function |
// must only be used to load a single character at a time. |
- DCHECK(characters == 1); |
__ add(current_character(), end_of_input_address(), offset); |
+#if V8_TARGET_LITTLE_ENDIAN |
if (mode_ == LATIN1) { |
- __ lbz(current_character(), MemOperand(current_character())); |
+ if (characters == 4) { |
+ __ lwz(current_character(), MemOperand(current_character())); |
+ } else if (characters == 2) { |
+ __ lhz(current_character(), MemOperand(current_character())); |
+ } else { |
+ DCHECK(characters == 1); |
+ __ lbz(current_character(), MemOperand(current_character())); |
+ } |
} else { |
DCHECK(mode_ == UC16); |
- __ lhz(current_character(), MemOperand(current_character())); |
+ if (characters == 2) { |
+ __ lwz(current_character(), MemOperand(current_character())); |
+ } else { |
+ DCHECK(characters == 1); |
+ __ lhz(current_character(), MemOperand(current_character())); |
+ } |
+ } |
+#else |
+ if (mode_ == LATIN1) { |
+ if (characters == 4) { |
+ __ lwbrx(current_character(), MemOperand(r0, current_character())); |
+ } else if (characters == 2) { |
+ __ lhbrx(current_character(), MemOperand(r0, current_character())); |
+ } else { |
+ DCHECK(characters == 1); |
+ __ lbz(current_character(), MemOperand(current_character())); |
+ } |
+ } else { |
+ DCHECK(mode_ == UC16); |
+ if (characters == 2) { |
+ __ lwz(current_character(), MemOperand(current_character())); |
+ __ rlwinm(current_character(), current_character(), 16, 0, 31); |
+ } else { |
+ DCHECK(characters == 1); |
+ __ lhz(current_character(), MemOperand(current_character())); |
+ } |
} |
+#endif |
} |