зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
a9630006b9
Коммит
f4e7d91218
|
@ -129,6 +129,12 @@ void
|
||||||
RegExpBuilder::AddAssertion(RegExpTree* assert)
|
RegExpBuilder::AddAssertion(RegExpTree* assert)
|
||||||
{
|
{
|
||||||
FlushText();
|
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);
|
terms_.Add(alloc, assert);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
last_added_ = ADD_ASSERT;
|
last_added_ = ADD_ASSERT;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче