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

Unified Diff: src/interpreter-irregexp.cc

Issue 12406: Case independent back references. (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-irregexp.h ('k') | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter-irregexp.cc
===================================================================
--- src/interpreter-irregexp.cc (revision 829)
+++ src/interpreter-irregexp.cc (working copy)
@@ -29,6 +29,7 @@
#include "v8.h"
+#include "unicode.h"
#include "utils.h"
#include "ast.h"
#include "bytecodes-irregexp.h"
@@ -38,6 +39,26 @@
namespace v8 { namespace internal {
+static unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize;
+
+
+static bool BackRefMatchesNoCase(int from,
Christian Plesner Hansen 2008/11/25 08:18:45 If we were concerned about performance we could co
+ int current,
+ int len,
+ Vector<const uc16> subject) {
+ for (int i = 0; i < len; i++) {
+ unibrow::uchar old_char = subject[from++];
+ unibrow::uchar new_char = subject[current++];
+ canonicalize.get(old_char, '\0', &old_char);
+ canonicalize.get(new_char, '\0', &new_char);
+ if (old_char != new_char) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
#ifdef DEBUG
static void TraceInterpreter(const byte* code_base,
const byte* pc,
@@ -319,6 +340,21 @@
pc += BC_CHECK_NOT_BACK_REF_LENGTH;
break;
}
+ BYTECODE(CHECK_NOT_BACK_REF_NO_CASE) {
+ 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 {
+ if (BackRefMatchesNoCase(from, current, len, subject)) {
+ pc += BC_CHECK_NOT_BACK_REF_NO_CASE_LENGTH;
+ } else {
+ pc = code_base + Load32(pc + 2);
+ }
+ }
+ break;
+ }
default:
UNREACHABLE();
break;
« no previous file with comments | « src/bytecodes-irregexp.h ('k') | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698