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

Unified Diff: src/interpreter-re2k.cc

Issue 11350: Add back references. Since "back references" is two words... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/bytecodes-re2k.h ('k') | src/jsregexp.h » ('j') | src/jsregexp.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter-re2k.cc
===================================================================
--- src/interpreter-re2k.cc (revision 804)
+++ src/interpreter-re2k.cc (working copy)
@@ -280,12 +280,26 @@
pc = code_base + Load32(new_pc);
break;
}
- BYTECODE(CHECK_BACKREF)
- UNREACHABLE();
+ BYTECODE(CHECK_NOT_BACK_REF) {
+ int from = registers[pc[1]];
+ int len = registers[pc[1] + 1] - from;
+ if (current + len > subject.length()) {
+ pc = code_base + Load32(pc + 2);
+ break;
+ } else {
+ int i;
+ for (i = 0; i < len; i++) {
+ if (subject[from + i] != subject[current + i]) {
+ pc = code_base + Load32(pc + 2);
+ break;
+ }
+ }
+ if (i < len) break;
+ current += len;
+ }
+ pc += BC_CHECK_NOT_BACK_REF_LENGTH;
break;
- BYTECODE(CHECK_NOT_BACKREF)
- UNREACHABLE();
- break;
+ }
default:
UNREACHABLE();
break;
« no previous file with comments | « src/bytecodes-re2k.h ('k') | src/jsregexp.h » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698