Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/arm/regexp-macro-assembler-arm.cc

Issue 186005: ARM RegExp fix bug 432. (Closed)
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void RegExpMacroAssemblerARM::CheckCharacterLT(uc16 limit, Label* on_less) { 209 void RegExpMacroAssemblerARM::CheckCharacterLT(uc16 limit, Label* on_less) {
210 __ cmp(current_character(), Operand(limit)); 210 __ cmp(current_character(), Operand(limit));
211 BranchOrBacktrack(lt, on_less); 211 BranchOrBacktrack(lt, on_less);
212 } 212 }
213 213
214 214
215 void RegExpMacroAssemblerARM::CheckCharacters(Vector<const uc16> str, 215 void RegExpMacroAssemblerARM::CheckCharacters(Vector<const uc16> str,
216 int cp_offset, 216 int cp_offset,
217 Label* on_failure, 217 Label* on_failure,
218 bool check_end_of_string) { 218 bool check_end_of_string) {
219 int byte_length = str.length() * char_size();
220 int byte_offset = cp_offset * char_size();
221 if (check_end_of_string) {
222 // Check that there are at least str.length() characters left in the input.
223 __ cmp(end_of_input_address(), Operand(-(byte_offset + byte_length)));
224 BranchOrBacktrack(gt, on_failure);
225 }
226
227 if (on_failure == NULL) { 219 if (on_failure == NULL) {
228 // Instead of inlining a backtrack, (re)use the global backtrack target. 220 // Instead of inlining a backtrack for each test, (re)use the global
221 // backtrack target.
229 on_failure = &backtrack_label_; 222 on_failure = &backtrack_label_;
230 } 223 }
231 224
225 if (check_end_of_string) {
226 // Is last character of required match inside string.
227 CheckPosition(cp_offset + str.length() - 1, on_failure);
228 }
229
232 __ add(r0, end_of_input_address(), Operand(current_input_offset())); 230 __ add(r0, end_of_input_address(), Operand(current_input_offset()));
231 if (cp_offset != 0) {
232 int byte_offset = cp_offset * char_size();
233 __ add(r0, r0, Operand(byte_offset));
234 }
235
236 // r0 : Address of characters to match against str.
233 int stored_high_byte = 0; 237 int stored_high_byte = 0;
234 for (int i = 0; i < str.length(); i++) { 238 for (int i = 0; i < str.length(); i++) {
235 if (mode_ == ASCII) { 239 if (mode_ == ASCII) {
236 __ ldrb(r1, MemOperand(r0, char_size(), PostIndex)); 240 __ ldrb(r1, MemOperand(r0, char_size(), PostIndex));
237 // str[i] is known to be an ASCII character. 241 ASSERT(str[i] <= String::kMaxAsciiCharCode);
238 __ cmp(r1, Operand(str[i])); 242 __ cmp(r1, Operand(str[i]));
239 } else { 243 } else {
240 __ ldrh(r1, MemOperand(r0, char_size(), PostIndex)); 244 __ ldrh(r1, MemOperand(r0, char_size(), PostIndex));
241 uc16 match_char = str[i]; 245 uc16 match_char = str[i];
242 int match_high_byte = (match_char >> 8); 246 int match_high_byte = (match_char >> 8);
243 if (match_high_byte == 0) { 247 if (match_high_byte == 0) {
244 __ cmp(r1, Operand(str[i])); 248 __ cmp(r1, Operand(str[i]));
245 } else { 249 } else {
246 if (match_high_byte != stored_high_byte) { 250 if (match_high_byte != stored_high_byte) {
247 __ mov(r2, Operand(match_high_byte)); 251 __ mov(r2, Operand(match_high_byte));
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 __ mov(r0, sp); 1221 __ mov(r0, sp);
1218 __ Call(r5); 1222 __ Call(r5);
1219 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); 1223 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1220 } 1224 }
1221 1225
1222 #undef __ 1226 #undef __
1223 1227
1224 #endif // V8_NATIVE_REGEXP 1228 #endif // V8_NATIVE_REGEXP
1225 1229
1226 }} // namespace v8::internal 1230 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698