[Webkit-unassigned] [Bug 34282] Simplify anonymous slot implementation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 28 14:29:55 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34282





--- Comment #3 from Darin Adler <darin at apple.com>  2010-01-28 14:29:55 PST ---
(From update of attachment 47646)
>  PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype)
>  {
> -    PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
> +    PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
>      return result;
>  }

Why the local variable? Normally we don't use PassRefPtr for local variables,
and normally we wouldn't use a local variable at all for this case.

> +        static const unsigned AnonymousSlotCount = 0;
>      protected:

It's dangerous to have something like this as a public data member. It gives
the wrong value if you use it on a base class of an object of a derived class.
Can we make it protected instead? Maybe we can name it
InitialAnonymousSlotCount too.

>  Structure::~Structure()
>  {
>      if (m_previous) {
> -        if (m_nameInPrevious)
> -            m_previous->table.remove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious);
> -        else
> -            m_previous->table.removeAnonymousSlotTransition(m_anonymousSlotsInPrevious);
> +        ASSERT(m_nameInPrevious);
> +        m_previous->table.remove(make_pair(m_nameInPrevious.get(), m_attributesInPrevious), m_specificValueInPrevious);
>  
>      }

You should remove that extra blank line.

r=me

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list