OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 } | 1203 } |
1204 | 1204 |
1205 | 1205 |
1206 void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset, | 1206 void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset, |
1207 int characters) { | 1207 int characters) { |
1208 Register offset = current_input_offset(); | 1208 Register offset = current_input_offset(); |
1209 if (cp_offset != 0) { | 1209 if (cp_offset != 0) { |
1210 __ add(r0, current_input_offset(), Operand(cp_offset * char_size())); | 1210 __ add(r0, current_input_offset(), Operand(cp_offset * char_size())); |
1211 offset = r0; | 1211 offset = r0; |
1212 } | 1212 } |
1213 // We assume that we cannot do unaligned loads on ARM, so this function | 1213 // LDR, STR, LDRH, STRH instructions in ARMv7 can do unaligned accesses, |
1214 // must only be used to load a single character at a time. | 1214 // if the Operating system running on the target allows so. |
| 1215 // Unaligned load/stores are not supported for pre-ARMv7 ISAs. Then |
| 1216 // this function must only be used to load a single character at a time. |
| 1217 #if !V8_TARGET_CAN_READ_UNALIGNED |
1215 ASSERT(characters == 1); | 1218 ASSERT(characters == 1); |
| 1219 #endif |
| 1220 |
1216 if (mode_ == ASCII) { | 1221 if (mode_ == ASCII) { |
1217 __ ldrb(current_character(), MemOperand(end_of_input_address(), offset)); | 1222 if (characters == 4) { |
| 1223 __ ldr(current_character(), MemOperand(end_of_input_address(), offset)); |
| 1224 } else if (characters == 2) { |
| 1225 __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); |
| 1226 } else { |
| 1227 ASSERT(characters == 1); |
| 1228 __ ldrb(current_character(), MemOperand(end_of_input_address(), offset)); |
| 1229 } |
1218 } else { | 1230 } else { |
1219 ASSERT(mode_ == UC16); | 1231 ASSERT(mode_ == UC16); |
1220 __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); | 1232 if (characters == 2) { |
| 1233 __ ldr(current_character(), MemOperand(end_of_input_address(), offset)); |
| 1234 } else { |
| 1235 ASSERT(characters == 1); |
| 1236 __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); |
| 1237 } |
1221 } | 1238 } |
1222 } | 1239 } |
1223 | 1240 |
1224 | 1241 |
1225 void RegExpCEntryStub::Generate(MacroAssembler* masm_) { | 1242 void RegExpCEntryStub::Generate(MacroAssembler* masm_) { |
1226 int stack_alignment = OS::ActivationFrameAlignment(); | 1243 int stack_alignment = OS::ActivationFrameAlignment(); |
1227 if (stack_alignment < kPointerSize) stack_alignment = kPointerSize; | 1244 if (stack_alignment < kPointerSize) stack_alignment = kPointerSize; |
1228 // Stack is already aligned for call, so decrement by alignment | 1245 // Stack is already aligned for call, so decrement by alignment |
1229 // to make room for storing the link register. | 1246 // to make room for storing the link register. |
1230 __ str(lr, MemOperand(sp, stack_alignment, NegPreIndex)); | 1247 __ str(lr, MemOperand(sp, stack_alignment, NegPreIndex)); |
1231 __ mov(r0, sp); | 1248 __ mov(r0, sp); |
1232 __ Call(r5); | 1249 __ Call(r5); |
1233 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); | 1250 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); |
1234 } | 1251 } |
1235 | 1252 |
1236 #undef __ | 1253 #undef __ |
1237 | 1254 |
1238 #endif // V8_INTERPRETED_REGEXP | 1255 #endif // V8_INTERPRETED_REGEXP |
1239 | 1256 |
1240 }} // namespace v8::internal | 1257 }} // namespace v8::internal |
OLD | NEW |