Reviewers: marja,

Description:
Remove unique static RegExpEmpty instance.

R=ma...@chromium.org
BUG=chromium:430652
LOG=N

Please review this at https://codereview.chromium.org/716113002/

Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+3, -11 lines):
  M src/ast.h
  M src/parser.cc


Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index d19028d04f1d233bdbda46df868e43ac99416c65..d7119239c78355de4ac1c97fcbe255847c36d4fe 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;
-  }
 };


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()));
 }



--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to