Re: [webkit-dev] When to use FastAllocBase?

2010-10-04 Thread Tony Gentilcore
Thanks for the responses. That clears everything up for me.

I would recommend we add something to
http://webkit.org/coding/coding-style.html, but it sounds like we
shouldn't do anything at this point since everything is change.

On Mon, Oct 4, 2010 at 11:46 AM, Darin Adler  wrote:
> On Oct 4, 2010, at 11:31 AM, Tony Gentilcore wrote:
>
>> If you subclass RefCounted or Noncopyable, which is very common, you pick 
>> up FastAllocBase.
>
> Yes, so in those cases you don’t want to use it.
>
>> So, my naive guess is that any class/struct which doesn't pick up 
>> FastAllocBase through its inheritance chain should subclass it directly. Is 
>> that a reasonable guideline?
>
> That’s OK, but:
>
>    1) FastAllocBase has been causing object size bloat, so we are planning to 
> switch from base classes to macros. See bug 42998 
> .
>
>    2) If the object will not ever be allocated with new, there is no benefit 
> to deriving from FastAllocBase.
>
>    3) Our original plan was to that on platforms where 
> ENABLE_GLOBAL_FASTMALLOC_NEW, such as Mac OS X, we would change the operator 
> new to check at runtime and immediately assert in debug builds if someone 
> forgot to use FastAllocBase. But as you can see if you look at FastMalloc.h, 
> this has not been done yet.
>
> So for the moment it’s fine to follow the guideline you mention, but (1) will 
> change how we do it soon, (2) is worth considering, and (3) will eventually 
> make the guideline clearer than it is now because we’ll notice when we do it 
> wrong!
>
>    -- Darin
>
>
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] When to use FastAllocBase?

2010-10-04 Thread Darin Adler
On Oct 4, 2010, at 11:31 AM, Tony Gentilcore wrote:

> If you subclass RefCounted or Noncopyable, which is very common, you pick 
> up FastAllocBase.

Yes, so in those cases you don’t want to use it.

> So, my naive guess is that any class/struct which doesn't pick up 
> FastAllocBase through its inheritance chain should subclass it directly. Is 
> that a reasonable guideline?

That’s OK, but:

1) FastAllocBase has been causing object size bloat, so we are planning to 
switch from base classes to macros. See bug 42998 
.

2) If the object will not ever be allocated with new, there is no benefit 
to deriving from FastAllocBase.

3) Our original plan was to that on platforms where 
ENABLE_GLOBAL_FASTMALLOC_NEW, such as Mac OS X, we would change the operator 
new to check at runtime and immediately assert in debug builds if someone 
forgot to use FastAllocBase. But as you can see if you look at FastMalloc.h, 
this has not been done yet.

So for the moment it’s fine to follow the guideline you mention, but (1) will 
change how we do it soon, (2) is worth considering, and (3) will eventually 
make the guideline clearer than it is now because we’ll notice when we do it 
wrong!

-- Darin

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] When to use FastAllocBase?

2010-10-04 Thread Adam Barth
On Mon, Oct 4, 2010 at 11:31 AM, Tony Gentilcore  wrote:
> For general reference, when is it appropriate to use FastAllocBase?
>
> If you subclass RefCounted or Noncopyable, which is very common,
> you pick up FastAllocBase. So, my naive guess is that any class/struct
> which doesn't pick up FastAllocBase through its inheritance chain
> should subclass it directly. Is that a reasonable guideline?

My understanding is that FastAllocBase is supposed to be on the
inheritance chain for every object that's allocated on the heap.

Adam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] When to use FastAllocBase?

2010-10-04 Thread Tony Gentilcore
For general reference, when is it appropriate to use FastAllocBase?

If you subclass RefCounted or Noncopyable, which is very common,
you pick up FastAllocBase. So, my naive guess is that any class/struct
which doesn't pick up FastAllocBase through its inheritance chain
should subclass it directly. Is that a reasonable guideline?

Thanks,
-Tony
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev