Index: src/arm/regexp-macro-assembler-arm.cc |
=================================================================== |
--- src/arm/regexp-macro-assembler-arm.cc (revision 4519) |
+++ src/arm/regexp-macro-assembler-arm.cc (working copy) |
@@ -1210,14 +1210,31 @@ |
__ add(r0, current_input_offset(), Operand(cp_offset * char_size())); |
offset = r0; |
} |
- // We assume that we cannot do unaligned loads on ARM, so this function |
- // must only be used to load a single character at a time. |
+ // LDR, STR, LDRH, STRH instructions in ARMv7 can do unaligned accesses, |
+ // if the Operating system running on the target allows so. |
+ // Unaligned load/stores are not supported for pre-ARMv7 ISAs. Then |
+ // this function must only be used to load a single character at a time. |
+#if !V8_TARGET_CAN_READ_UNALIGNED |
ASSERT(characters == 1); |
+#endif |
+ |
if (mode_ == ASCII) { |
- __ ldrb(current_character(), MemOperand(end_of_input_address(), offset)); |
+ if (characters == 4) { |
+ __ ldr(current_character(), MemOperand(end_of_input_address(), offset)); |
+ } else if (characters == 2) { |
+ __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); |
+ } else { |
+ ASSERT(characters == 1); |
+ __ ldrb(current_character(), MemOperand(end_of_input_address(), offset)); |
+ } |
} else { |
ASSERT(mode_ == UC16); |
- __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); |
+ if (characters == 2) { |
+ __ ldr(current_character(), MemOperand(end_of_input_address(), offset)); |
+ } else { |
+ ASSERT(characters == 1); |
+ __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); |
+ } |
} |
} |