Ignore:
Timestamp:
Jul 30, 2014, 10:38:30 PM (11 years ago)
Author:
[email protected]
Message:

PropertyName's internal string is always atomic.
<https://webkit.org/b/135451>

Source/JavaScriptCore:
Now that we've merged the JSC::Identifier and WTF::AtomicString tables,
we know that any string that's an Identifier is guaranteed to be atomic.

A PropertyName can be either an Identifier or a PrivateName, and the
private names are also guaranteed to be atomic internally.

Make PropertyName vend AtomicStringImpl* instead of StringImpl*.

Reviewed by Benjamin Poulain.

  • runtime/PropertyName.h:

(JSC::PropertyName::PropertyName):
(JSC::PropertyName::uid):
(JSC::PropertyName::publicName):

Source/WebCore:
Use PropertyName::publicName() directly instead of taking the slow route
through AtomicString::findStringWithHash().

These strings are always atomic, and findStringWithHash() would trudge
through a full hash lookup just to discover that indeed, they are!

Reviewed by Benjamin Poulain.

  • bindings/js/JSDOMBinding.cpp:

(WebCore::findAtomicString): Deleted.

  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::namedItemGetter):
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertySlotByIndex):

  • bindings/js/JSHTMLDocumentCustom.cpp:

(WebCore::JSHTMLDocument::canGetItemsForName):
(WebCore::JSHTMLDocument::nameGetter):

Source/WTF:
Remove AtomicString::findStringWithHash() since nobody uses it anymore.

Reviewed by Benjamin Poulain.

  • wtf/text/AtomicString.cpp:

(WTF::findString): Deleted.
(WTF::AtomicString::findStringWithHash): Deleted.

  • wtf/text/AtomicString.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/PropertyName.h

    r165999 r171838  
    8080public:
    8181    PropertyName(const Identifier& propertyName)
    82         : m_impl(propertyName.impl())
     82        : m_impl(static_cast<AtomicStringImpl*>(propertyName.impl()))
    8383    {
    8484        ASSERT(!m_impl || m_impl->isAtomic());
     
    8686
    8787    PropertyName(const PrivateName& propertyName)
    88         : m_impl(propertyName.uid())
     88        : m_impl(static_cast<AtomicStringImpl*>(propertyName.uid()))
    8989    {
    90         ASSERT(m_impl && m_impl->isEmptyUnique());
     90        ASSERT(m_impl);
     91        ASSERT(m_impl->isEmptyUnique());
     92        ASSERT(m_impl->isAtomic());
    9193    }
    9294
    93     StringImpl* uid() const
     95    AtomicStringImpl* uid() const
    9496    {
    9597        return m_impl;
    9698    }
    9799
    98     StringImpl* publicName() const
     100    AtomicStringImpl* publicName() const
    99101    {
    100         return m_impl->isEmptyUnique() ? 0 : m_impl;
     102        return m_impl->isEmptyUnique() ? nullptr : m_impl;
    101103    }
    102104
     
    109111
    110112private:
    111     StringImpl* m_impl;
     113    AtomicStringImpl* m_impl;
    112114};
    113115
Note: See TracChangeset for help on using the changeset viewer.