summaryrefslogtreecommitdiffstats
path: root/js/src/irregexp/RegExpInterpreter.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-01-19 14:38:36 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-01-19 14:44:48 +0100
commitea51616e31da82241c707407edbb82c20f84d319 (patch)
treeac4de72c0c983cfd712911f295837aed87487006 /js/src/irregexp/RegExpInterpreter.cpp
parent35dc8e5abb3a9f8cbbab4da5e57754b37dd54d59 (diff)
downloadUXP-ea51616e31da82241c707407edbb82c20f84d319.tar
UXP-ea51616e31da82241c707407edbb82c20f84d319.tar.gz
UXP-ea51616e31da82241c707407edbb82c20f84d319.tar.lz
UXP-ea51616e31da82241c707407edbb82c20f84d319.tar.xz
UXP-ea51616e31da82241c707407edbb82c20f84d319.zip
Issue #1362 - Revert "Implement regular expression lookbehind"
This reverts commit fa473930f424bf17a9e545b601c84dd2e61364e3.
Diffstat (limited to 'js/src/irregexp/RegExpInterpreter.cpp')
-rw-r--r--js/src/irregexp/RegExpInterpreter.cpp74
1 files changed, 5 insertions, 69 deletions
diff --git a/js/src/irregexp/RegExpInterpreter.cpp b/js/src/irregexp/RegExpInterpreter.cpp
index d09b4671e..7fd2d983a 100644
--- a/js/src/irregexp/RegExpInterpreter.cpp
+++ b/js/src/irregexp/RegExpInterpreter.cpp
@@ -222,8 +222,8 @@ irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const CharT* cha
}
break;
BYTECODE(LOAD_CURRENT_CHAR) {
- int pos = current + (insn >> BYTECODE_SHIFT);
- if (pos >= (int)length || pos < 0) {
+ size_t pos = current + (insn >> BYTECODE_SHIFT);
+ if (pos >= length) {
pc = byteCode + Load32Aligned(pc + 4);
} else {
current_char = chars[pos];
@@ -238,8 +238,8 @@ irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const CharT* cha
break;
}
BYTECODE(LOAD_2_CURRENT_CHARS) {
- int pos = current + (insn >> BYTECODE_SHIFT);
- if (pos + 2 > (int)length || pos < 0) {
+ size_t pos = current + (insn >> BYTECODE_SHIFT);
+ if (pos + 2 > length) {
pc = byteCode + Load32Aligned(pc + 4);
} else {
CharT next = chars[pos + 1];
@@ -425,30 +425,6 @@ irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const CharT* cha
pc += BC_CHECK_NOT_BACK_REF_LENGTH;
break;
}
- BYTECODE(CHECK_NOT_BACK_REF_BACKWARD) {
- int from = registers[insn >> BYTECODE_SHIFT];
- int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
- if (from < 0 || len <= 0) {
- pc += BC_CHECK_NOT_BACK_REF_BACKWARD_LENGTH;
- break;
- }
- if (int(current) - len < 0) {
- pc = byteCode + Load32Aligned(pc + 4);
- break;
- } else {
- int i;
- for (i = 0; i < len; i++) {
- if (chars[from + i] != chars[int(current) - len + i]) {
- pc = byteCode + Load32Aligned(pc + 4);
- break;
- }
- }
- if (i < len) break;
- current -= len;
- }
- pc += BC_CHECK_NOT_BACK_REF_BACKWARD_LENGTH;
- break;
- }
BYTECODE(CHECK_NOT_BACK_REF_NO_CASE) {
int from = registers[insn >> BYTECODE_SHIFT];
int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
@@ -489,46 +465,6 @@ irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const CharT* cha
}
break;
}
- BYTECODE(CHECK_NOT_BACK_REF_NO_CASE_BACKWARD) {
- int from = registers[insn >> BYTECODE_SHIFT];
- int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
- if (from < 0 || len <= 0) {
- pc += BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_LENGTH;
- break;
- }
- if (int(current) - len < 0) {
- pc = byteCode + Load32Aligned(pc + 4);
- break;
- }
- if (CaseInsensitiveCompareStrings(chars + from, chars + int(current) - len, len * sizeof(CharT))) {
- current -= len;
- pc += BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_LENGTH;
- } else {
- pc = byteCode + Load32Aligned(pc + 4);
- }
- break;
-
- }
- BYTECODE(CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_UNICODE) {
- int from = registers[insn >> BYTECODE_SHIFT];
- int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
- if (from < 0 || len <= 0) {
- pc += BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_LENGTH;
- break;
- }
- if (int(current) - len < 0) {
- pc = byteCode + Load32Aligned(pc + 4);
- break;
- }
- if (CaseInsensitiveCompareUCStrings(chars + from, chars + int(current) - len, len * sizeof(CharT))) {
- current -= len;
- pc += BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_LENGTH;
- } else {
- pc = byteCode + Load32Aligned(pc + 4);
- }
- break;
-
- }
BYTECODE(CHECK_AT_START)
if (current == 0)
pc = byteCode + Load32Aligned(pc + 4);
@@ -536,7 +472,7 @@ irregexp::InterpretCode(JSContext* cx, const uint8_t* byteCode, const CharT* cha
pc += BC_CHECK_AT_START_LENGTH;
break;
BYTECODE(CHECK_NOT_AT_START)
- if (current + (insn >> BYTECODE_SHIFT) == 0)
+ if (current == 0)
pc += BC_CHECK_NOT_AT_START_LENGTH;
else
pc = byteCode + Load32Aligned(pc + 4);