Chromium Code Reviews| 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; |