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

Side by Side Diff: src/interpreter-irregexp.cc

Issue 3844006: Limit end-anchored regexps to testing end of string where possible. (Closed)
Patch Set: Created 10 years, 2 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
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 pc += BC_CHECK_AT_START_LENGTH; 600 pc += BC_CHECK_AT_START_LENGTH;
601 } 601 }
602 break; 602 break;
603 BYTECODE(CHECK_NOT_AT_START) 603 BYTECODE(CHECK_NOT_AT_START)
604 if (current == 0) { 604 if (current == 0) {
605 pc += BC_CHECK_NOT_AT_START_LENGTH; 605 pc += BC_CHECK_NOT_AT_START_LENGTH;
606 } else { 606 } else {
607 pc = code_base + Load32Aligned(pc + 4); 607 pc = code_base + Load32Aligned(pc + 4);
608 } 608 }
609 break; 609 break;
610 BYTECODE(SET_CURRENT_POSITION_FROM_END) {
611 int by = static_cast<uint32_t>(insn) >> BYTECODE_SHIFT;
612 if (subject.length() - current > by) {
613 current = subject.length() - by;
614 current_char = subject[current - 1];
615 }
616 pc += BC_SET_CURRENT_POSITION_FROM_END_LENGTH;
617 break;
618 }
610 default: 619 default:
611 UNREACHABLE(); 620 UNREACHABLE();
612 break; 621 break;
613 } 622 }
614 } 623 }
615 } 624 }
616 625
617 626
618 bool IrregexpInterpreter::Match(Handle<ByteArray> code_array, 627 bool IrregexpInterpreter::Match(Handle<ByteArray> code_array,
619 Handle<String> subject, 628 Handle<String> subject,
(...skipping 17 matching lines...) Expand all
637 if (start_position != 0) previous_char = subject_vector[start_position - 1]; 646 if (start_position != 0) previous_char = subject_vector[start_position - 1];
638 return RawMatch(code_base, 647 return RawMatch(code_base,
639 subject_vector, 648 subject_vector,
640 registers, 649 registers,
641 start_position, 650 start_position,
642 previous_char); 651 previous_char);
643 } 652 }
644 } 653 }
645 654
646 } } // namespace v8::internal 655 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698