Bug 1642493: Clean up remaining references to ENABLE_NEW_REGEXP and old irregexp r=mgaudet

I kept a running list of code that would be dead once we removed the old engine. This is what was on that list.

Note: The regexp_parse tests used a testing function that parsed a regexp and returned an AST to compare against the expected AST. They are being deleted because the tests are fragile in the face of upstream changes, not particularly useful, and a lot of work to convert.

Depends on D77727

Differential Revision: https://phabricator.services.mozilla.com/D77728
This commit is contained in:
Iain Ireland 2020-06-04 14:35:04 +00:00
Родитель 408c1ea24e
Коммит 31ded7e5aa
89 изменённых файлов: 3 добавлений и 1391 удалений

Просмотреть файл

@ -15,10 +15,6 @@ js/src/new-regexp/.*
js/src/zydis/.*
# Generated by js/src/util/make_unicode.py
# Note: the irregexp files are already excluded with the rest of js/src/irregexp
# but we add them here in case that ever changes.
js/src/irregexp/RegExpCharacters-inl.h
js/src/irregexp/RegExpCharacters.cpp
js/src/util/Unicode.cpp
js/src/util/UnicodeNonBMP.h

Просмотреть файл

@ -626,19 +626,6 @@ set_config('ENABLE_SHARED_MEMORY', enable_shared_memory)
set_define('ENABLE_SHARED_MEMORY', enable_shared_memory)
# Initial support for new regexp engine
# ==================================================
js_option('--disable-new-regexp', help='{Enable|Disable} new regexp engine')
@depends('--disable-new-regexp')
def enable_new_regexp(value):
if value:
return True
set_config('ENABLE_NEW_REGEXP', enable_new_regexp)
set_define('ENABLE_NEW_REGEXP', enable_new_regexp)
# Support for WebAssembly SIMD
# =====================================================

Просмотреть файл

@ -11,6 +11,7 @@ include('../js-standalone.mozbuild')
UNIFIED_SOURCES += [
'testExample.cpp',
'testRegExp.cpp',
'tests.cpp',
'testStructuredCloneReader.cpp',
'testWasm.cpp',
@ -21,11 +22,6 @@ if CONFIG['JS_BUILD_BINAST']:
'testBinASTReader.cpp',
]
if CONFIG['ENABLE_NEW_REGEXP']:
UNIFIED_SOURCES += [
'testRegExp.cpp',
]
DEFINES['EXPORT_JS_API'] = True
LOCAL_INCLUDES += [

Просмотреть файл

@ -1,205 +0,0 @@
load(libdir + "asserts.js");
// helper functions
function Disjunction(alternatives) {
return{
type: "Disjunction",
alternatives: alternatives
};
}
function Alternative(nodes) {
return {
type: "Alternative",
nodes: nodes
};
}
function Empty() {
return {
type: "Empty"
};
}
function Text(elements) {
return {
type: "Text",
elements: elements
};
}
function Assertion(type) {
return {
type: "Assertion",
assertion_type: type
};
}
function Atom(data) {
return {
type: "Atom",
data: data
};
}
const kInfinity = 0x7FFFFFFF;
function Quantifier(min, max, type, body) {
return {
type: "Quantifier",
min: min,
max: max,
quantifier_type: type,
body: body
};
}
function Lookahead(body) {
return {
type: "Lookahead",
is_positive: true,
body: body
};
}
function NegativeLookahead(body) {
return {
type: "Lookahead",
is_positive: false,
body: body
};
}
function BackReference(index) {
return {
type: "BackReference",
index: index
};
}
function CharacterClass(ranges) {
return {
type: "CharacterClass",
is_negated: false,
ranges: ranges.map(([from, to]) => ({ from ,to }))
};
}
function NegativeCharacterClass(ranges) {
return {
type: "CharacterClass",
is_negated: true,
ranges: ranges.map(([from, to]) => ({ from ,to }))
};
}
function Capture(index, body) {
return {
type: "Capture",
index: index,
body: body
};
}
function AllSurrogateAndCharacterClass(ranges) {
return Disjunction([
CharacterClass(ranges),
Alternative([
CharacterClass([["\uD800", "\uDBFF"]]),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
]),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
CharacterClass([["\uDC00", "\uDFFF"]])
]),
Text([
CharacterClass([["\uD800", "\uDBFF"]]),
CharacterClass([["\uDC00", "\uDFFF"]])
])
]);
}
// testing functions
var all_flags = [
"",
"i",
"m",
"u",
"im",
"iu",
"mu",
"imu",
];
var no_unicode_flags = [
"",
"i",
"m",
"im",
];
var unicode_flags = [
"u",
"iu",
"mu",
"imu",
];
var no_multiline_flags = [
"",
"i",
"u",
"iu",
];
var multiline_flags = [
"m",
"im",
"mu",
"imu",
];
function test_flags(pattern, flags, match_only, expected) {
for (var flag of flags) {
assertDeepEq(parseRegExp(pattern, flag, match_only), expected);
}
}
function make_mix(tree) {
if (tree.type == "Atom") {
return Atom("X" + tree.data + "Y");
}
if (tree.type == "CharacterClass") {
return Text([
Atom("X"),
tree,
Atom("Y")
]);
}
if (tree.type == "Alternative") {
return Alternative([
Atom("X"),
...tree.nodes,
Atom("Y")
]);
}
return Alternative([
Atom("X"),
tree,
Atom("Y")
]);
}
function test_mix(pattern, flags, expected) {
test_flags(pattern, flags, false, expected);
test_flags("X" + pattern + "Y", flags, false, make_mix(expected));
}
function test(pattern, flags, expected) {
test_flags(pattern, flags, false, expected);
}
function test_match_only(pattern, flags, expected) {
test_flags(pattern, flags, true, expected);
}

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1 +0,0 @@
|jit-test| skip-if: typeof parseRegExp === 'undefined'

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1 +0,0 @@
|jit-test| skip-if: typeof parseRegExp === 'undefined'

Просмотреть файл

@ -1,17 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("^", no_multiline_flags,
Assertion("START_OF_INPUT"));
test_mix("^", multiline_flags,
Assertion("START_OF_LINE"));
test_mix("$", no_multiline_flags,
Assertion("END_OF_INPUT"));
test_mix("$", multiline_flags,
Assertion("END_OF_LINE"));
test_mix("\\b", all_flags,
Assertion("BOUNDARY"));
test_mix("\\B", all_flags,
Assertion("NON_BOUNDARY"));

Просмотреть файл

@ -1,51 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("a", all_flags,
Atom("a"));
test_mix("abc\u3042\u3044\u3046", all_flags,
Atom("abc\u3042\u3044\u3046"));
// raw brace
test("{", no_unicode_flags,
Atom("{"));
test("{a", no_unicode_flags,
Atom("{a"));
test("a{b", no_unicode_flags,
Atom("a{b"));
test("}", no_unicode_flags,
Atom("}"));
test("}a", no_unicode_flags,
Atom("}a"));
test("a}b", no_unicode_flags,
Atom("a}b"));
// raw surrogate pair
test("X\uD83D\uDC38Y", unicode_flags,
Text([
Atom("X"),
Atom("\uD83D\uDC38"),
Atom("Y")
]));
test("X\uD83DY", unicode_flags,
Alternative([
Atom("X"),
Alternative([
Atom("\uD83D"),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
]),
Atom("Y")
]));
test("X\uDC38Y", unicode_flags,
Alternative([
Atom("X"),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
Atom("\uDC38"),
]),
Atom("Y")
]));

Просмотреть файл

@ -1,112 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("\\d", all_flags,
CharacterClass([["0", "9"]]));
test_mix("\\D", no_unicode_flags,
CharacterClass([
["\u0000", "/"],
[":", "\uFFFF"]
]));
test_mix("\\D", unicode_flags,
AllSurrogateAndCharacterClass([
["\u0000", "/"],
[":", "\uD7FF"],
["\uE000", "\uFFFF"]
]));
test_mix("\\s", all_flags,
CharacterClass([
["\t", "\r"],
[" ", " "],
["\u00A0", "\u00A0"],
["\u1680", "\u1680"],
["\u2000", "\u200A"],
["\u2028", "\u2029"],
["\u202F", "\u202F"],
["\u205F", "\u205F"],
["\u3000", "\u3000"],
["\uFEFF", "\uFEFF"]
]));
test_mix("\\S", no_unicode_flags,
CharacterClass([
["\u0000", "\u0008"],
["\u000E", "\u001F"],
["!", "\u009F"],
["\u00A1", "\u167F"],
["\u1681", "\u1FFF"],
["\u200B", "\u2027"],
["\u202A", "\u202E"],
["\u2030", "\u205E"],
["\u2060", "\u2FFF"],
["\u3001", "\uFEFE"],
["\uFF00", "\uFFFF"]
]));
test_mix("\\S", unicode_flags,
AllSurrogateAndCharacterClass([
["\u0000", "\u0008"],
["\u000E", "\u001F"],
["!", "\u009F"],
["\u00A1", "\u167F"],
["\u1681", "\u1FFF"],
["\u200B", "\u2027"],
["\u202A", "\u202E"],
["\u2030", "\u205E"],
["\u2060", "\u2FFF"],
["\u3001", "\uD7FF"],
["\uE000", "\uFEFE"],
["\uFF00", "\uFFFF"]
]));
test_mix("\\w", no_unicode_flags,
CharacterClass([
["0", "9"],
["A", "Z"],
["_", "_"],
["a", "z"]
]));
test_mix("\\w", ["u", "mu"],
CharacterClass([
["0", "9"],
["A", "Z"],
["_", "_"],
["a", "z"]
]));
test_mix("\\w", ["iu", "imu"],
CharacterClass([
["0", "9"],
["A", "Z"],
["_", "_"],
["a", "z"],
["\u017F", "\u017F"],
["\u212A", "\u212A"]
]));
test_mix("\\W", no_unicode_flags,
CharacterClass([
["\u0000", "/"],
[":", "@"],
["[", "^"],
["`", "`"],
["{", "\uFFFF"]
]));
test_mix("\\W", ["u", "mu"],
AllSurrogateAndCharacterClass([
["\u0000", "/"],
[":", "@"],
["[", "^"],
["`", "`"],
["{", "\uD7FF"],
["\uE000", "\uFFFF"]
]));
test_mix("\\W", ["iu", "imu"],
AllSurrogateAndCharacterClass([
["\u0000", "/"],
[":", "@"],
["[", "^"],
["`", "`"],
["{", "\u017E"],
["\u0180", "\u2129"],
["\u212B", "\uD7FF"],
["\uE000", "\uFFFF"]
]));

Просмотреть файл

@ -1,16 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("\\f", all_flags,
Atom("\u000c"));
test_mix("\\n", all_flags,
Atom("\u000a"));
test_mix("\\r", all_flags,
Atom("\u000d"));
test_mix("\\t", all_flags,
Atom("\u0009"));
test_mix("\\v", all_flags,
Atom("\u000b"));

Просмотреть файл

@ -1,10 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("\\ca", all_flags,
Atom("\u0001"));
test_mix("\\cz", all_flags,
Atom("\u001a"));
test_mix("\\cA", all_flags,
Atom("\u0001"));
test_mix("\\cZ", all_flags,
Atom("\u001a"));

Просмотреть файл

@ -1,84 +0,0 @@
load(libdir + "regexp_parse.js");
// LegacyOctalEscapeSequence
test_mix("\\1", no_unicode_flags,
Atom("\u0001"));
test_mix("\\2", no_unicode_flags,
Atom("\u0002"));
test_mix("\\3", no_unicode_flags,
Atom("\u0003"));
test_mix("\\4", no_unicode_flags,
Atom("\u0004"));
test_mix("\\5", no_unicode_flags,
Atom("\u0005"));
test_mix("\\6", no_unicode_flags,
Atom("\u0006"));
test_mix("\\7", no_unicode_flags,
Atom("\u0007"));
test_mix("\\8", no_unicode_flags,
Atom("8"));
test_mix("\\9", no_unicode_flags,
Atom("9"));
test_mix("\\10", no_unicode_flags,
Atom("\u0008"));
test_mix("\\11", no_unicode_flags,
Atom("\u0009"));
test_mix("\\189", no_unicode_flags,
Atom("\u{0001}89"));
test_mix("\\1089", no_unicode_flags,
Atom("\u{0008}89"));
test_mix("\\10189", no_unicode_flags,
Atom("A89"));
test_mix("\\101189", no_unicode_flags,
Atom("A189"));
// BackReference
test_mix("()\\1", no_unicode_flags,
Alternative([
Capture(1, Empty()),
BackReference(1)
]));
test_mix("()\\1", unicode_flags,
Alternative([
Capture(1, Empty()),
Alternative([
BackReference(1),
Assertion("NOT_IN_SURROGATE_PAIR")
])
]));
test_mix("()()()()()()()()()()\\10", no_unicode_flags,
Alternative([
Capture(1, Empty()),
Capture(2, Empty()),
Capture(3, Empty()),
Capture(4, Empty()),
Capture(5, Empty()),
Capture(6, Empty()),
Capture(7, Empty()),
Capture(8, Empty()),
Capture(9, Empty()),
Capture(10, Empty()),
BackReference(10)
]));
test_mix("()()()()()()()()()()\\10", unicode_flags,
Alternative([
Capture(1, Empty()),
Capture(2, Empty()),
Capture(3, Empty()),
Capture(4, Empty()),
Capture(5, Empty()),
Capture(6, Empty()),
Capture(7, Empty()),
Capture(8, Empty()),
Capture(9, Empty()),
Capture(10, Empty()),
Alternative([
BackReference(10),
Assertion("NOT_IN_SURROGATE_PAIR")
])
]));

Просмотреть файл

@ -1,16 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("\\x00", all_flags,
Atom("\u0000"));
test_mix("\\xFF", all_flags,
Atom("\u00FF"));
test_mix("\\x0", no_unicode_flags,
Atom("x0"));
test_mix("\\x000", all_flags,
Atom("\u{0000}0"));
test_mix("\\xG", no_unicode_flags,
Atom("xG"));
test_mix("\\x0G", no_unicode_flags,
Atom("x0G"));

Просмотреть файл

@ -1,52 +0,0 @@
load(libdir + "regexp_parse.js");
// SyntaxCharacter
test("\\^", all_flags,
Atom("^"));
test("\\$", all_flags,
Atom("$"));
test("\\\\", all_flags,
Atom("\\"));
test("\\.", all_flags,
Atom("."));
test("\\*", all_flags,
Atom("*"));
test("\\+", all_flags,
Atom("+"));
test("\\?", all_flags,
Atom("?"));
test("\\(", all_flags,
Atom("("));
test("\\)", all_flags,
Atom(")"));
test("\\[", all_flags,
Atom("["));
test("\\]", all_flags,
Atom("]"));
test("\\{", all_flags,
Atom("{"));
test("\\}", all_flags,
Atom("}"));
test("\\|", all_flags,
Atom("|"));
// Slash
test("\\/", all_flags,
Atom("/"));
// SourceCharacter
test("\\P", no_unicode_flags,
Atom("P"));
test("\\uX", no_unicode_flags,
Atom("uX"));
test("\\u{0000}", no_unicode_flags,
Quantifier(0, 0, "GREEDY", Atom("u")));
test("\\c_", no_unicode_flags,
Atom("\\c_"));

Просмотреть файл

@ -1,4 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("\\0", all_flags,
Atom("\u0000"));

Просмотреть файл

@ -1,105 +0,0 @@
load(libdir + "regexp_parse.js");
// LeadSurrogate TrailSurrogate
test("\\uD83D\\uDC38", all_flags,
Atom("\uD83D\uDC38"));
test("X\\uD83D\\uDC38Y", no_unicode_flags,
Atom("X\uD83D\uDC38Y"));
test("X\\uD83D\\uDC38Y", unicode_flags,
Text([
Atom("X"),
Atom("\uD83D\uDC38"),
Atom("Y")
]));
// LeadSurrogate
test_mix("\\uD83D", no_unicode_flags,
Atom("\uD83D"));
test("\\uD83D", unicode_flags,
Alternative([
Atom("\uD83D"),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
]));
test("X\\uD83DY", unicode_flags,
Alternative([
Atom("X"),
Alternative([
Atom("\uD83D"),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
]),
Atom("Y")
]));
// TrailSurrogate
test_mix("\\uDC38", no_unicode_flags,
Atom("\uDC38"));
test("\\uDC38", unicode_flags,
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
Atom("\uDC38"),
]));
test("X\\uDC38Y", unicode_flags,
Alternative([
Atom("X"),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
Atom("\uDC38"),
]),
Atom("Y")
]));
// NonSurrogate / Hex4Digits
test_mix("\\u0000", all_flags,
Atom("\u0000"));
test_mix("\\uFFFF", all_flags,
Atom("\uFFFF"));
// braced HexDigits
test_mix("\\u{0000}", unicode_flags,
Atom("\u0000"));
test_mix("\\u{FFFF}", unicode_flags,
Atom("\uFFFF"));
test("\\u{1F438}", unicode_flags,
Atom("\uD83D\uDC38"));
test("X\\u{1F438}Y", unicode_flags,
Text([
Atom("X"),
Atom("\uD83D\uDC38"),
Atom("Y")
]));
test("\\u{D83D}", unicode_flags,
Alternative([
Atom("\uD83D"),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
]));
test("X\\u{D83D}Y", unicode_flags,
Alternative([
Atom("X"),
Alternative([
Atom("\uD83D"),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
]),
Atom("Y")
]));
test("\\u{DC38}", unicode_flags,
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
Atom("\uDC38"),
]));
test("X\\u{DC38}Y", unicode_flags,
Alternative([
Atom("X"),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
Atom("\uDC38"),
]),
Atom("Y")
]));

Просмотреть файл

@ -1,18 +0,0 @@
load(libdir + "regexp_parse.js");
test("()", all_flags,
Capture(1, Empty()));
test("(a)", all_flags,
Capture(1, Atom("a")));
test("((a()b))c(d)", all_flags,
Alternative([
Capture(1, Capture(2, Alternative([
Atom("a"),
Capture(3, Empty()),
Atom("b")
]))),
Atom("c"),
Capture(4, Atom("d"))
]));

Просмотреть файл

@ -1,71 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("[]", all_flags,
NegativeCharacterClass([
["\u0000", "\uFFFF"]
]));
test("[a]", all_flags,
CharacterClass([
["a", "a"]
]));
test("[abc\u3042\u3044\u3046]", all_flags,
CharacterClass([
["a", "a"],
["b", "b"],
["c", "c"],
["\u3042", "\u3042"],
["\u3044", "\u3044"],
["\u3046", "\u3046"],
]));
test("[a-c\u3042-\u3046]", all_flags,
CharacterClass([
["a", "c"],
["\u3042", "\u3046"]
]));
test("[-]", all_flags,
CharacterClass([
["-", "-"]
]));
// raw surrogate pair
test("[X\uD83D\uDC38Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"],
]),
Atom("\uD83D\uDC38")
]));
test("[X\uD83DY]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"]
]),
Alternative([
CharacterClass([
["\uD83D", "\uD83D"]
]),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
])
]));
test("[X\uDC38Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"]
]),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
CharacterClass([
["\uDC38", "\uDC38"]
])
])
]));

Просмотреть файл

@ -1,112 +0,0 @@
load(libdir + "regexp_parse.js");
test("[\\d]", all_flags,
CharacterClass([["0", "9"]]));
test("[\\D]", no_unicode_flags,
CharacterClass([
["\u0000", "/"],
[":", "\uFFFF"]
]));
test("[\\D]", unicode_flags,
AllSurrogateAndCharacterClass([
["\u0000", "/"],
[":", "\uD7FF"],
["\uE000", "\uFFFF"]
]));
test("[\\s]", all_flags,
CharacterClass([
["\t", "\r"],
[" ", " "],
["\u00A0", "\u00A0"],
["\u1680", "\u1680"],
["\u2000", "\u200A"],
["\u2028", "\u2029"],
["\u202F", "\u202F"],
["\u205F", "\u205F"],
["\u3000", "\u3000"],
["\uFEFF", "\uFEFF"]
]));
test("[\\S]", no_unicode_flags,
CharacterClass([
["\u0000", "\u0008"],
["\u000E", "\u001F"],
["!", "\u009F"],
["\u00A1", "\u167F"],
["\u1681", "\u1FFF"],
["\u200B", "\u2027"],
["\u202A", "\u202E"],
["\u2030", "\u205E"],
["\u2060", "\u2FFF"],
["\u3001", "\uFEFE"],
["\uFF00", "\uFFFF"]
]));
test("[\\S]", unicode_flags,
AllSurrogateAndCharacterClass([
["\u0000", "\u0008"],
["\u000E", "\u001F"],
["!", "\u009F"],
["\u00A1", "\u167F"],
["\u1681", "\u1FFF"],
["\u200B", "\u2027"],
["\u202A", "\u202E"],
["\u2030", "\u205E"],
["\u2060", "\u2FFF"],
["\u3001", "\uD7FF"],
["\uE000", "\uFEFE"],
["\uFF00", "\uFFFF"]
]));
test("[\\w]", no_unicode_flags,
CharacterClass([
["0", "9"],
["A", "Z"],
["_", "_"],
["a", "z"]
]));
test("[\\w]", ["u", "mu"],
CharacterClass([
["0", "9"],
["A", "Z"],
["_", "_"],
["a", "z"]
]));
test("[\\w]", ["iu", "imu"],
CharacterClass([
["0", "9"],
["A", "Z"],
["_", "_"],
["a", "z"],
["\u017F", "\u017F"],
["\u212A", "\u212A"]
]));
test("[\\W]", no_unicode_flags,
CharacterClass([
["\u0000", "/"],
[":", "@"],
["[", "^"],
["`", "`"],
["{", "\uFFFF"]
]));
test("[\\W]", ["u", "mu"],
AllSurrogateAndCharacterClass([
["\u0000", "/"],
[":", "@"],
["[", "^"],
["`", "`"],
["{", "\uD7FF"],
["\uE000", "\uFFFF"]
]));
test("[\\W]", ["iu", "imu"],
AllSurrogateAndCharacterClass([
["\u0000", "/"],
[":", "@"],
["[", "^"],
["`", "`"],
["{", "\u017E"],
["\u0180", "\u2129"],
["\u212B", "\uD7FF"],
["\uE000", "\uFFFF"]
]));

Просмотреть файл

@ -1,10 +0,0 @@
load(libdir + "regexp_parse.js");
test("[\b]", all_flags,
CharacterClass([
["\u0008", "\u0008"]
]));
test("[\-]", all_flags,
CharacterClass([
["-", "-"]
]));

Просмотреть файл

@ -1,26 +0,0 @@
load(libdir + "regexp_parse.js");
test("[\\f]", all_flags,
CharacterClass([
["\u000c", "\u000c"]
]));
test("[\\n]", all_flags,
CharacterClass([
["\u000a", "\u000a"]
]));
test("[\\r]", all_flags,
CharacterClass([
["\u000d", "\u000d"]
]));
test("[\\t]", all_flags,
CharacterClass([
["\u0009", "\u0009"]
]));
test("[\\v]", all_flags,
CharacterClass([
["\u000b", "\u000b"]
]));

Просмотреть файл

@ -1,32 +0,0 @@
load(libdir + "regexp_parse.js");
test("[\\ca]", all_flags,
CharacterClass([
["\u0001", "\u0001"]
]));
test("[\\cz]", all_flags,
CharacterClass([
["\u001a", "\u001a"]
]));
test("[\\cA]", all_flags,
CharacterClass([
["\u0001", "\u0001"]
]));
test("[\\cZ]", all_flags,
CharacterClass([
["\u001a", "\u001a"]
]));
// Invalid
test("[\\c]", no_unicode_flags,
CharacterClass([
["\\", "\\"],
["c", "c"]
]));
test("[\\c=]", no_unicode_flags,
CharacterClass([
["\\", "\\"],
["c", "c"],
["=", "="]
]));

Просмотреть файл

@ -1,36 +0,0 @@
load(libdir + "regexp_parse.js");
test("[\\x00]", all_flags,
CharacterClass([
["\u0000", "\u0000"]
]));
test("[\\xff]", all_flags,
CharacterClass([
["\u00FF", "\u00FF"]
]));
// Invalid
test("[\\x]", no_unicode_flags,
CharacterClass([
["x", "x"]
]));
test("[\\xG]", no_unicode_flags,
CharacterClass([
["x", "x"],
["G", "G"]
]));
test("[\\x0]", no_unicode_flags,
CharacterClass([
["x", "x"],
["0", "0"]
]));
test("[\\x0G]", no_unicode_flags,
CharacterClass([
["x", "x"],
["0", "0"],
["G", "G"],
]));

Просмотреть файл

@ -1,6 +0,0 @@
load(libdir + "regexp_parse.js");
test("[\\0]", all_flags,
CharacterClass([
["\u0000", "\u0000"]
]));

Просмотреть файл

@ -1,159 +0,0 @@
load(libdir + "regexp_parse.js");
// LeadSurrogate TrailSurrogate
test("[X\\uD83D\\uDC38Y]", no_unicode_flags,
CharacterClass([
["X", "X"],
["\uD83D", "\uD83D"],
["\uDC38", "\uDC38"],
["Y", "Y"]
]));
test("[X\\uD83D\\uDC38Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"],
]),
Atom("\uD83D\uDC38")
]));
// LeadSurrogate
test("[X\\uD83DY]", no_unicode_flags,
CharacterClass([
["X", "X"],
["\uD83D", "\uD83D"],
["Y", "Y"]
]));
test("[X\\uD83DY]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"]
]),
Alternative([
CharacterClass([
["\uD83D", "\uD83D"]
]),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
])
]));
// TrailSurrogate
test("[X\\uDC38Y]", no_unicode_flags,
CharacterClass([
["X", "X"],
["\uDC38", "\uDC38"],
["Y", "Y"]
]));
test("[X\\uDC38Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"]
]),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
CharacterClass([
["\uDC38", "\uDC38"]
])
])
]));
// NonSurrogate / Hex4Digits
test("[X\\u0000Y]", all_flags,
CharacterClass([
["X", "X"],
["\u0000", "\u0000"],
["Y", "Y"]
]));
test("[X\\uFFFFY]", all_flags,
CharacterClass([
["X", "X"],
["\uFFFF", "\uFFFF"],
["Y", "Y"]
]));
// braced HexDigits
test("[X\\u{0000}Y]", unicode_flags,
CharacterClass([
["X", "X"],
["\u0000", "\u0000"],
["Y", "Y"]
]));
test("[X\\uFFFFY]", unicode_flags,
CharacterClass([
["X", "X"],
["\uFFFF", "\uFFFF"],
["Y", "Y"]
]));
test("[X\\u{1F438}Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"],
]),
Atom("\uD83D\uDC38")
]));
test("[X\\u{D83D}Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"]
]),
Alternative([
CharacterClass([
["\uD83D", "\uD83D"]
]),
NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
])
]));
test("[X\\u{DC38}Y]", unicode_flags,
Disjunction([
CharacterClass([
["X", "X"],
["Y", "Y"]
]),
Alternative([
Assertion("NOT_AFTER_LEAD_SURROGATE"),
CharacterClass([
["\uDC38", "\uDC38"]
])
])
]));
// Invalid
test("[\\u]", no_unicode_flags,
CharacterClass([
["u", "u"]
]));
test("[\\uG]", no_unicode_flags,
CharacterClass([
["u", "u"],
["G", "G"]
]));
test("[\\uD83]", no_unicode_flags,
CharacterClass([
["u", "u"],
["D", "D"],
["8", "8"],
["3", "3"]
]));
test("[\\uD83G]", no_unicode_flags,
CharacterClass([
["u", "u"],
["D", "D"],
["8", "8"],
["3", "3"],
["G", "G"]
]));

Просмотреть файл

@ -1,39 +0,0 @@
load(libdir + "regexp_parse.js");
test("a|\u3042", all_flags,
Disjunction([
Atom("a"),
Atom("\u3042")
]));
test("a|\u3042|abc", all_flags,
Disjunction([
Atom("a"),
Atom("\u3042"),
Atom("abc")
]));
test("|", all_flags,
Disjunction([
Empty(),
Empty()
]));
test("||", all_flags,
Disjunction([
Empty(),
Empty(),
Empty()
]));
test("abc|", all_flags,
Disjunction([
Atom("abc"),
Empty()
]));
test("|abc", all_flags,
Disjunction([
Empty(),
Atom("abc")
]));

Просмотреть файл

@ -1,4 +0,0 @@
load(libdir + "regexp_parse.js");
test("", all_flags,
Empty());

Просмотреть файл

@ -1,18 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix(".", no_unicode_flags,
CharacterClass([
["\u0000", "\u0009"],
["\u000b", "\u000c"],
["\u000e", "\u2027"],
["\u202A", "\uFFFF"]
]));
test_mix(".", unicode_flags,
AllSurrogateAndCharacterClass([
["\u0000", "\u0009"],
["\u000b", "\u000c"],
["\u000e", "\u2027"],
["\u202A", "\uD7FF"],
["\uE000", "\uFFFF"]
]));

Просмотреть файл

@ -1,12 +0,0 @@
load(libdir + "regexp_parse.js");
test("(?:)", all_flags,
Empty());
test("(?:a)", all_flags,
Atom("a"));
test("X(?:a)Y", all_flags,
Text([
Atom("X"),
Atom("a"),
Atom("Y")
]));

Просмотреть файл

@ -1,28 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("(?=abc)", all_flags,
Lookahead(Atom("abc")));
test_mix("(?!abc)", all_flags,
NegativeLookahead(Atom("abc")));
test_mix("(?=abc)+", no_unicode_flags,
Lookahead(Atom("abc")));
// Lookahead becomes Empty because max_match of Lookahead is 0 and the min vaue
// of Quantifier is also 0.
test("(?=abc)*", no_unicode_flags,
Empty());
test("X(?=abc)*Y", no_unicode_flags,
Alternative([
Atom("X"),
Atom("Y"),
]));
test("(?=abc)?", no_unicode_flags,
Empty());
test("X(?=abc)?Y", no_unicode_flags,
Alternative([
Atom("X"),
Atom("Y"),
]));

Просмотреть файл

@ -1,32 +0,0 @@
load(libdir + "regexp_parse.js");
// Leading and trailing .* are ignored if match_only==true.
test_match_only(".*abc", all_flags,
Atom("abc"));
test_match_only("abc.*", all_flags,
Atom("abc"));
test_match_only(".*?abc", no_unicode_flags,
Alternative([
Quantifier(0, kInfinity, "NON_GREEDY",
CharacterClass([
["\u0000", "\u0009"],
["\u000b", "\u000c"],
["\u000e", "\u2027"],
["\u202A", "\uFFFF"]
])),
Atom("abc")
]));
test_match_only(".*?abc", unicode_flags,
Alternative([
Quantifier(0, kInfinity, "NON_GREEDY",
AllSurrogateAndCharacterClass([
["\u0000", "\u0009"],
["\u000b", "\u000c"],
["\u000e", "\u2027"],
["\u202A", "\uD7FF"],
["\uE000", "\uFFFF"]
])),
Atom("abc")
]));

Просмотреть файл

@ -1,55 +0,0 @@
load(libdir + "regexp_parse.js");
test_mix("a*", all_flags,
Quantifier(0, kInfinity, "GREEDY", Atom("a")));
test_mix("a*?", all_flags,
Quantifier(0, kInfinity, "NON_GREEDY", Atom("a")));
test_mix("a+", all_flags,
Quantifier(1, kInfinity, "GREEDY", Atom("a")));
test_mix("a+?", all_flags,
Quantifier(1, kInfinity, "NON_GREEDY", Atom("a")));
test_mix("a?", all_flags,
Quantifier(0, 1, "GREEDY", Atom("a")));
test_mix("a??", all_flags,
Quantifier(0, 1, "NON_GREEDY", Atom("a")));
test_mix("a{3}", all_flags,
Quantifier(3, 3, "GREEDY", Atom("a")));
test_mix("a{3}?", all_flags,
Quantifier(3, 3, "NON_GREEDY", Atom("a")));
test_mix("a{3,}", all_flags,
Quantifier(3, kInfinity, "GREEDY", Atom("a")));
test_mix("a{3,}?", all_flags,
Quantifier(3, kInfinity, "NON_GREEDY", Atom("a")));
test_mix("a{3,5}", all_flags,
Quantifier(3, 5, "GREEDY", Atom("a")));
test_mix("a{3,5}?", all_flags,
Quantifier(3, 5, "NON_GREEDY", Atom("a")));
// Surrogate Pair and Quantifier
test("\\uD83D\\uDC38+", no_unicode_flags,
Alternative([
Atom("\uD83D"),
Quantifier(1, kInfinity, "GREEDY", Atom("\uDC38"))
]));
test("\\uD83D\\uDC38+", unicode_flags,
Quantifier(1, kInfinity, "GREEDY", Atom("\uD83D\uDC38")));
// Invalid
test_mix("a{", no_unicode_flags,
Atom("a{"));
test_mix("a{1", no_unicode_flags,
Atom("a{1"));
test_mix("a{1,", no_unicode_flags,
Atom("a{1,"));
test_mix("a{1,2", no_unicode_flags,
Atom("a{1,2"));
test_mix("a{,", no_unicode_flags,
Atom("a{,"));

Просмотреть файл

@ -1 +0,0 @@
|jit-test| skip-if: typeof parseRegExp === 'undefined'

Просмотреть файл

@ -89,9 +89,6 @@ static constexpr Register PseudoStackPointer{Registers::x28};
static constexpr ARMRegister PseudoStackPointer64 = {Registers::x28, 64};
static constexpr ARMRegister PseudoStackPointer32 = {Registers::x28, 32};
// StackPointer for use by irregexp.
static constexpr Register RegExpStackPointer = PseudoStackPointer;
static constexpr Register IntArgReg0{Registers::x0};
static constexpr Register IntArgReg1{Registers::x1};
static constexpr Register IntArgReg2{Registers::x2};

Просмотреть файл

@ -548,7 +548,6 @@ MSG_DEF(JSMSG_UNDEFINED_CURRENCY, 0, JSEXN_TYPEERR, "undefined currency in
MSG_DEF(JSMSG_UNDEFINED_UNIT, 0, JSEXN_TYPEERR, "undefined unit in NumberFormat() with unit style")
// RegExp
MSG_DEF(JSMSG_BACK_REF_OUT_OF_RANGE, 0, JSEXN_SYNTAXERR, "back reference out of range in regular expression")
MSG_DEF(JSMSG_BAD_CLASS_RANGE, 0, JSEXN_SYNTAXERR, "invalid range in character class")
MSG_DEF(JSMSG_ESCAPE_AT_END_OF_REGEXP, 0, JSEXN_SYNTAXERR, "\\ at end of pattern")
MSG_DEF(JSMSG_EXEC_NOT_OBJORNULL, 0, JSEXN_TYPEERR, "RegExp exec method should return object or null")
@ -561,7 +560,6 @@ MSG_DEF(JSMSG_NEWREGEXP_FLAGGED, 0, JSEXN_TYPEERR, "can't supply flags whe
MSG_DEF(JSMSG_NOTHING_TO_REPEAT, 0, JSEXN_SYNTAXERR, "nothing to repeat")
MSG_DEF(JSMSG_NUMBERS_OUT_OF_ORDER, 0, JSEXN_SYNTAXERR, "numbers out of order in {} quantifier.")
MSG_DEF(JSMSG_RANGE_WITH_CLASS_ESCAPE, 0, JSEXN_SYNTAXERR, "character class escape cannot be used in class range in regular expression")
MSG_DEF(JSMSG_RAW_BRACE_IN_REGEXP, 0, JSEXN_SYNTAXERR, "raw brace is not allowed in regular expression with unicode flag")
MSG_DEF(JSMSG_RAW_BRACKET_IN_REGEXP, 0, JSEXN_SYNTAXERR, "raw bracket is not allowed in regular expression with unicode flag")
MSG_DEF(JSMSG_TOO_MANY_PARENS, 0, JSEXN_INTERNALERR, "too many parentheses in regular expression")
MSG_DEF(JSMSG_UNICODE_OVERFLOW, 1, JSEXN_SYNTAXERR, "Unicode codepoint must not be greater than 0x10FFFF in {0}")

Просмотреть файл

@ -455,26 +455,14 @@ if CONFIG['MOZ_VTUNE']:
'-Wno-stringop-overflow'
]
if not CONFIG['ENABLE_NEW_REGEXP']:
UNIFIED_SOURCES += [
'irregexp/NativeRegExpMacroAssembler.cpp',
'irregexp/RegExpAST.cpp',
'irregexp/RegExpCharacters.cpp',
'irregexp/RegExpEngine.cpp',
'irregexp/RegExpInterpreter.cpp',
'irregexp/RegExpMacroAssembler.cpp',
'irregexp/RegExpParser.cpp',
'irregexp/RegExpStack.cpp',
]
DIRS += [
'build',
'debugger',
'frontend',
'gc',
'jit',
'wasm',
] + (['new-regexp'] if CONFIG['ENABLE_NEW_REGEXP'] else [])
'new-regexp',
'wasm']
if CONFIG['JS_JITSPEW']:
DIRS += ['zydis']

Просмотреть файл

@ -45,23 +45,6 @@ namespace frontend {
class TokenStreamAnyChars;
}
// Temporary definitions until irregexp is updated from upstream.
namespace irregexp {
constexpr size_t JS_HOWMANY(size_t x, size_t y) { return (x + y - 1) / y; }
constexpr size_t JS_ROUNDUP(size_t x, size_t y) { return JS_HOWMANY(x, y) * y; }
template <class T>
static constexpr inline T Min(T t1, T t2) {
return t1 < t2 ? t1 : t2;
}
template <class T>
static constexpr inline T Max(T t1, T t2) {
return t1 > t2 ? t1 : t2;
}
} // namespace irregexp
extern RegExpObject* RegExpAlloc(JSContext* cx, NewObjectKind newKind,
HandleObject proto = nullptr);