Bug 1382023 - Fold repeated assertions. r=jandem

This is a pull of v8 commit c8e4c8b9263b5009716804f06f39225a9dd7fc68,
reviewed at https://codereview.chromium.org/2768443003.

--HG--
extra : histedit_source : a18886aba3443d84eb909f1f37a3d63b7aa415a9
This commit is contained in:
Sean Stangl 2017-07-18 15:37:00 -04:00
Родитель a9630006b9
Коммит f4e7d91218
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -129,6 +129,12 @@ void
RegExpBuilder::AddAssertion(RegExpTree* assert)
{
FlushText();
if (terms_.length() > 0 && terms_.last()->IsAssertion()) {
// Omit repeated assertions of the same type.
RegExpAssertion* last = terms_.last()->AsAssertion();
RegExpAssertion* next = assert->AsAssertion();
if (last->assertion_type() == next->assertion_type()) return;
}
terms_.Add(alloc, assert);
#ifdef DEBUG
last_added_ = ADD_ASSERT;