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:39:14 +0100
commite0baeba546f8f45bc1ec981a60b615a28f4142af (patch)
treea71ec1879c612c55f22fae35d4f2eb767bf45e42 /js/src/irregexp/RegExpInterpreter.cpp
parentb1abb9aebe9de3507c93f31cf1b7ffff3432e481 (diff)
downloadUXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar.gz
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar.lz
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.tar.xz
UXP-e0baeba546f8f45bc1ec981a60b615a28f4142af.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);