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

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

Issue 16280005: RegExp macro assembler clean up. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/regexp-macro-assembler-mips.h ('k') | src/regexp-macro-assembler.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 __ Addu(a0, end_of_input_address(), Operand(current_input_offset())); 228 __ Addu(a0, end_of_input_address(), Operand(current_input_offset()));
229 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(a1)); 229 BranchOrBacktrack(on_not_at_start, ne, a0, Operand(a1));
230 } 230 }
231 231
232 232
233 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) { 233 void RegExpMacroAssemblerMIPS::CheckCharacterLT(uc16 limit, Label* on_less) {
234 BranchOrBacktrack(on_less, lt, current_character(), Operand(limit)); 234 BranchOrBacktrack(on_less, lt, current_character(), Operand(limit));
235 } 235 }
236 236
237 237
238 void RegExpMacroAssemblerMIPS::CheckCharacters(Vector<const uc16> str,
239 int cp_offset,
240 Label* on_failure,
241 bool check_end_of_string) {
242 if (on_failure == NULL) {
243 // Instead of inlining a backtrack for each test, (re)use the global
244 // backtrack target.
245 on_failure = &backtrack_label_;
246 }
247
248 if (check_end_of_string) {
249 // Is last character of required match inside string.
250 CheckPosition(cp_offset + str.length() - 1, on_failure);
251 }
252
253 __ Addu(a0, end_of_input_address(), Operand(current_input_offset()));
254 if (cp_offset != 0) {
255 int byte_offset = cp_offset * char_size();
256 __ Addu(a0, a0, Operand(byte_offset));
257 }
258
259 // a0 : Address of characters to match against str.
260 int stored_high_byte = 0;
261 for (int i = 0; i < str.length(); i++) {
262 if (mode_ == ASCII) {
263 __ lbu(a1, MemOperand(a0, 0));
264 __ addiu(a0, a0, char_size());
265 ASSERT(str[i] <= String::kMaxOneByteCharCode);
266 BranchOrBacktrack(on_failure, ne, a1, Operand(str[i]));
267 } else {
268 __ lhu(a1, MemOperand(a0, 0));
269 __ addiu(a0, a0, char_size());
270 uc16 match_char = str[i];
271 int match_high_byte = (match_char >> 8);
272 if (match_high_byte == 0) {
273 BranchOrBacktrack(on_failure, ne, a1, Operand(str[i]));
274 } else {
275 if (match_high_byte != stored_high_byte) {
276 __ li(a2, Operand(match_high_byte));
277 stored_high_byte = match_high_byte;
278 }
279 __ Addu(a3, a2, Operand(match_char & 0xff));
280 BranchOrBacktrack(on_failure, ne, a1, Operand(a3));
281 }
282 }
283 }
284 }
285
286
287 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) { 238 void RegExpMacroAssemblerMIPS::CheckGreedyLoop(Label* on_equal) {
288 Label backtrack_non_equal; 239 Label backtrack_non_equal;
289 __ lw(a0, MemOperand(backtrack_stackpointer(), 0)); 240 __ lw(a0, MemOperand(backtrack_stackpointer(), 0));
290 __ Branch(&backtrack_non_equal, ne, current_input_offset(), Operand(a0)); 241 __ Branch(&backtrack_non_equal, ne, current_input_offset(), Operand(a0));
291 __ Addu(backtrack_stackpointer(), 242 __ Addu(backtrack_stackpointer(),
292 backtrack_stackpointer(), 243 backtrack_stackpointer(),
293 Operand(kPointerSize)); 244 Operand(kPointerSize));
294 __ bind(&backtrack_non_equal); 245 __ bind(&backtrack_non_equal);
295 BranchOrBacktrack(on_equal, eq, current_input_offset(), Operand(a0)); 246 BranchOrBacktrack(on_equal, eq, current_input_offset(), Operand(a0));
296 } 247 }
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 } 1330 }
1380 1331
1381 1332
1382 #undef __ 1333 #undef __
1383 1334
1384 #endif // V8_INTERPRETED_REGEXP 1335 #endif // V8_INTERPRETED_REGEXP
1385 1336
1386 }} // namespace v8::internal 1337 }} // namespace v8::internal
1387 1338
1388 #endif // V8_TARGET_ARCH_MIPS 1339 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/regexp-macro-assembler-mips.h ('k') | src/regexp-macro-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698