diff --git a/src/ast.h b/src/ast.h index d19028d04f..d7119239c7 100644 --- a/src/ast.h +++ b/src/ast.h @@ -3117,10 +3117,6 @@ class RegExpEmpty FINAL : public RegExpTree { virtual bool IsEmpty() OVERRIDE; virtual int min_match() OVERRIDE { return 0; } virtual int max_match() OVERRIDE { return 0; } - static RegExpEmpty* GetInstance() { - static RegExpEmpty* instance = ::new RegExpEmpty(); - return instance; - } }; diff --git a/src/parser.cc b/src/parser.cc index dafab10c1c..087b6bd9b8 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -111,7 +111,7 @@ void RegExpBuilder::FlushTerms() { int num_terms = terms_.length(); RegExpTree* alternative; if (num_terms == 0) { - alternative = RegExpEmpty::GetInstance(); + alternative = new (zone()) RegExpEmpty(); } else if (num_terms == 1) { alternative = terms_.last(); } else { @@ -126,12 +126,8 @@ void RegExpBuilder::FlushTerms() { RegExpTree* RegExpBuilder::ToRegExp() { FlushTerms(); int num_alternatives = alternatives_.length(); - if (num_alternatives == 0) { - return RegExpEmpty::GetInstance(); - } - if (num_alternatives == 1) { - return alternatives_.last(); - } + if (num_alternatives == 0) return new (zone()) RegExpEmpty(); + if (num_alternatives == 1) return alternatives_.last(); return new(zone()) RegExpDisjunction(alternatives_.GetList(zone())); }