Reviewers: ulan, tfarina,

https://codereview.chromium.org/141553007/diff/60001/src/zone.h
File src/zone.h (right):

https://codereview.chromium.org/141553007/diff/60001/src/zone.h#newcode146
src/zone.h:146: // Ideally, the delete operator should be private
instead of
On 2014/01/29 17:39:15, tfarina wrote:
can you update this comment while you are here?

Actually... I should've read the "MSVC requires the delete operator to
be public" part. It makes this CL pointless. Nevermind. Closing. Thanks
for pointing out the comment.

Description:
Make ZoneObject::operator delete not public.

This prevents a n00b mistake of just calling delete on a ZoneObject subclass
compile time rather than run time. (Sadly, it doesn't work for second-level
subclasses and beyond.)

BUG=

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

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

Affected files (+2, -1 lines):
  M src/jsregexp.h
  M src/zone.h


Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index dfd415d5af8ad041a6959016d046b3a9a6a87610..480429b5efbba5dc2f6cfd88cfd739bd7e93adf9 100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -591,7 +591,6 @@ class RegExpNode: public ZoneObject {
   : replacement_(NULL), trace_count_(0), zone_(zone) {
     bm_info_[0] = bm_info_[1] = NULL;
   }
-  virtual ~RegExpNode();
   virtual void Accept(NodeVisitor* visitor) = 0;
// Generates a goto to this node or actually generates the code at this point.
   virtual void Emit(RegExpCompiler* compiler, Trace* trace) = 0;
@@ -685,6 +684,7 @@ class RegExpNode: public ZoneObject {
   enum LimitResult { DONE, CONTINUE };
   RegExpNode* replacement_;

+  virtual ~RegExpNode();
   LimitResult LimitVersions(RegExpCompiler* compiler, Trace* trace);

   void set_bm_info(bool not_at_start, BoyerMooreLookahead* bm) {
Index: src/zone.h
diff --git a/src/zone.h b/src/zone.h
index bd7cc39b0c4f224b0646792fbd8ed262fdc5f986..5b17243bea6cf3b380f880f74adf6a75afea69e3 100644
--- a/src/zone.h
+++ b/src/zone.h
@@ -151,6 +151,7 @@ class ZoneObject {

   // ZoneObjects should never be deleted individually; use
   // Zone::DeleteAll() to delete all zone objects in one go.
+ protected:
   void operator delete(void*, size_t) { UNREACHABLE(); }
   void operator delete(void* pointer, Zone* zone) { UNREACHABLE(); }
 };


--
--
v8-dev mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to