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

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

Issue 9854020: RegExp: Add support for table-based character class (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 8 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
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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 uc16 mask, 473 uc16 mask,
474 Label* on_not_equal) { 474 Label* on_not_equal) {
475 ASSERT(minus < String::kMaxUtf16CodeUnit); 475 ASSERT(minus < String::kMaxUtf16CodeUnit);
476 __ sub(r0, current_character(), Operand(minus)); 476 __ sub(r0, current_character(), Operand(minus));
477 __ and_(r0, r0, Operand(mask)); 477 __ and_(r0, r0, Operand(mask));
478 __ cmp(r0, Operand(c)); 478 __ cmp(r0, Operand(c));
479 BranchOrBacktrack(ne, on_not_equal); 479 BranchOrBacktrack(ne, on_not_equal);
480 } 480 }
481 481
482 482
483 void RegExpMacroAssemblerARM::CheckCharacterInRange(
484 uc16 from,
485 uc16 to,
486 Label* on_in_range) {
487 __ sub(r0, current_character(), Operand(from));
488 __ cmp(r0, Operand(to - from));
489 BranchOrBacktrack(ls, on_in_range); // Unsigned lower-or-same condition.
490 }
491
492
493 void RegExpMacroAssemblerARM::CheckCharacterNotInRange(
494 uc16 from,
495 uc16 to,
496 Label* on_not_in_range) {
497 __ sub(r0, current_character(), Operand(from));
498 __ cmp(r0, Operand(to - from));
499 BranchOrBacktrack(hi, on_not_in_range); // Unsigned higher condition.
500 }
501
502
503 void RegExpMacroAssemblerARM::CheckBitInTable(
504 Handle<ByteArray> table,
505 Label* on_bit_set) {
506 __ mov(r0, Operand(table));
507 if (mode_ != ASCII || kTableMask != String::kMaxAsciiCharCode) {
508 __ and_(r1, current_character(), Operand(kTableSize - 1));
509 __ add(r1, r1, Operand(ByteArray::kHeaderSize - kHeapObjectTag));
510 } else {
511 __ add(r1,
512 current_character(),
513 Operand(ByteArray::kHeaderSize - kHeapObjectTag));
514 }
515 __ ldrb(r0, MemOperand(r0, r1));
516 __ cmp(r0, Operand(0));
517 BranchOrBacktrack(ne, on_bit_set);
518 }
519
520
483 bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type, 521 bool RegExpMacroAssemblerARM::CheckSpecialCharacterClass(uc16 type,
484 Label* on_no_match) { 522 Label* on_no_match) {
485 // Range checks (c in min..max) are generally implemented by an unsigned 523 // Range checks (c in min..max) are generally implemented by an unsigned
486 // (c - min) <= (max - min) check 524 // (c - min) <= (max - min) check
487 switch (type) { 525 switch (type) {
488 case 's': 526 case 's':
489 // Match space-characters 527 // Match space-characters
490 if (mode_ == ASCII) { 528 if (mode_ == ASCII) {
491 // ASCII space characters are '\t'..'\r' and ' '. 529 // ASCII space characters are '\t'..'\r' and ' '.
492 Label success; 530 Label success;
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); 1342 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
1305 } 1343 }
1306 1344
1307 #undef __ 1345 #undef __
1308 1346
1309 #endif // V8_INTERPRETED_REGEXP 1347 #endif // V8_INTERPRETED_REGEXP
1310 1348
1311 }} // namespace v8::internal 1349 }} // namespace v8::internal
1312 1350
1313 #endif // V8_TARGET_ARCH_ARM 1351 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.h ('k') | src/bytecodes-irregexp.h » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698