Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(896)

Unified Diff: src/parser.cc

Issue 716113002: Remove unique static RegExpEmpty instance. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index dafab10c1cc4194ec8da5d71c7a7cc5a8fcdcc0d..087b6bd9b8c7645f53566f5d2376ee0378d7aebf 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()));
}
« no previous file with comments | « src/ast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698