- Revision
- 171838
- Author
- [email protected]
- Date
- 2014-07-30 22:38:30 -0700 (Wed, 30 Jul 2014)
Log Message
PropertyName's internal string is always atomic.
<https://webkit.org/b/135451>
Source/_javascript_Core:
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:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (171837 => 171838)
--- trunk/Source/_javascript_Core/ChangeLog 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-07-31 05:38:30 UTC (rev 171838)
@@ -1,3 +1,23 @@
+2014-07-30 Andreas Kling <[email protected]>
+
+ PropertyName's internal string is always atomic.
+ <https://webkit.org/b/135451>
+
+ 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):
+
2014-07-30 Andy Estes <[email protected]>
USE(CONTENT_FILTERING) should be ENABLE(CONTENT_FILTERING)
Modified: trunk/Source/_javascript_Core/runtime/PropertyName.h (171837 => 171838)
--- trunk/Source/_javascript_Core/runtime/PropertyName.h 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/_javascript_Core/runtime/PropertyName.h 2014-07-31 05:38:30 UTC (rev 171838)
@@ -79,25 +79,27 @@
class PropertyName {
public:
PropertyName(const Identifier& propertyName)
- : m_impl(propertyName.impl())
+ : m_impl(static_cast<AtomicStringImpl*>(propertyName.impl()))
{
ASSERT(!m_impl || m_impl->isAtomic());
}
PropertyName(const PrivateName& propertyName)
- : m_impl(propertyName.uid())
+ : m_impl(static_cast<AtomicStringImpl*>(propertyName.uid()))
{
- ASSERT(m_impl && m_impl->isEmptyUnique());
+ ASSERT(m_impl);
+ ASSERT(m_impl->isEmptyUnique());
+ ASSERT(m_impl->isAtomic());
}
- StringImpl* uid() const
+ AtomicStringImpl* uid() const
{
return m_impl;
}
- StringImpl* publicName() const
+ AtomicStringImpl* publicName() const
{
- return m_impl->isEmptyUnique() ? 0 : m_impl;
+ return m_impl->isEmptyUnique() ? nullptr : m_impl;
}
static const uint32_t NotAnIndex = UINT_MAX;
@@ -108,7 +110,7 @@
}
private:
- StringImpl* m_impl;
+ AtomicStringImpl* m_impl;
};
inline bool operator==(PropertyName a, const Identifier& b)
Modified: trunk/Source/WTF/ChangeLog (171837 => 171838)
--- trunk/Source/WTF/ChangeLog 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WTF/ChangeLog 2014-07-31 05:38:30 UTC (rev 171838)
@@ -1,3 +1,17 @@
+2014-07-30 Andreas Kling <[email protected]>
+
+ PropertyName's internal string is always atomic.
+ <https://webkit.org/b/135451>
+
+ 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:
+
2014-07-30 Andy Estes <[email protected]>
USE(CONTENT_FILTERING) should be ENABLE(CONTENT_FILTERING)
Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (171837 => 171838)
--- trunk/Source/WTF/wtf/text/AtomicString.cpp 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp 2014-07-31 05:38:30 UTC (rev 171838)
@@ -432,31 +432,6 @@
return *addResult.iterator;
}
-template<typename CharacterType>
-static inline HashSet<StringImpl*>::iterator findString(const StringImpl* stringImpl)
-{
- HashAndCharacters<CharacterType> buffer = { stringImpl->existingHash(), stringImpl->characters<CharacterType>(), stringImpl->length() };
- return stringTable().find<HashAndCharactersTranslator<CharacterType>>(buffer);
-}
-
-AtomicStringImpl* AtomicString::findStringWithHash(const StringImpl& stringImpl)
-{
- ASSERT(stringImpl.existingHash());
-
- if (!stringImpl.length())
- return static_cast<AtomicStringImpl*>(StringImpl::empty());
-
- AtomicStringTableLocker locker;
- HashSet<StringImpl*>::iterator iterator;
- if (stringImpl.is8Bit())
- iterator = findString<LChar>(&stringImpl);
- else
- iterator = findString<UChar>(&stringImpl);
- if (iterator == stringTable().end())
- return 0;
- return static_cast<AtomicStringImpl*>(*iterator);
-}
-
void AtomicString::remove(StringImpl* string)
{
ASSERT(string->isAtomic());
Modified: trunk/Source/WTF/wtf/text/AtomicString.h (171837 => 171838)
--- trunk/Source/WTF/wtf/text/AtomicString.h 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WTF/wtf/text/AtomicString.h 2014-07-31 05:38:30 UTC (rev 171838)
@@ -86,7 +86,6 @@
AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
- WTF_EXPORT_STRING_API static AtomicStringImpl* findStringWithHash(const StringImpl&);
WTF_EXPORT_STRING_API static AtomicStringImpl* find(LChar*, unsigned length);
WTF_EXPORT_STRING_API static AtomicStringImpl* find(UChar*, unsigned length);
static AtomicStringImpl* find(StringImpl* string)
Modified: trunk/Source/WebCore/ChangeLog (171837 => 171838)
--- trunk/Source/WebCore/ChangeLog 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WebCore/ChangeLog 2014-07-31 05:38:30 UTC (rev 171838)
@@ -1,3 +1,27 @@
+2014-07-30 Andreas Kling <[email protected]>
+
+ PropertyName's internal string is always atomic.
+ <https://webkit.org/b/135451>
+
+ 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):
+
2014-07-30 Benjamin Poulain <[email protected]>
ElementRuleCollector: group the shadow tree code
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (171837 => 171838)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp 2014-07-31 05:38:30 UTC (rev 171838)
@@ -98,15 +98,6 @@
return jsStringWithCache(exec, url.string());
}
-AtomicStringImpl* findAtomicString(PropertyName propertyName)
-{
- StringImpl* impl = propertyName.publicName();
- if (!impl)
- return 0;
- ASSERT(impl->existingHash());
- return AtomicString::findStringWithHash(*impl);
-}
-
String valueToStringWithNullCheck(ExecState* exec, JSValue value)
{
if (value.isNull())
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (171837 => 171838)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2014-07-31 05:38:30 UTC (rev 171838)
@@ -283,7 +283,6 @@
String propertyNameToString(JSC::PropertyName);
AtomicString propertyNameToAtomicString(JSC::PropertyName);
-AtomicStringImpl* findAtomicString(JSC::PropertyName);
String valueToStringWithNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null
String valueToStringWithUndefinedOrNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null or undefined
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (171837 => 171838)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp 2014-07-31 05:38:30 UTC (rev 171838)
@@ -82,7 +82,7 @@
ASSERT(document);
ASSERT(document->isHTMLDocument());
- AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
+ AtomicStringImpl* atomicPropertyName = propertyName.publicName();
if (!atomicPropertyName || !toHTMLDocument(document)->hasWindowNamedItem(*atomicPropertyName))
return JSValue::encode(jsUndefined());
@@ -245,7 +245,7 @@
// Allow shortcuts like 'Image1' instead of document.images.Image1
Document* document = thisObject->impl().frame()->document();
if (document->isHTMLDocument()) {
- AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
+ AtomicStringImpl* atomicPropertyName = propertyName.publicName();
if (atomicPropertyName && toHTMLDocument(document)->hasWindowNamedItem(*atomicPropertyName)) {
slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, namedItemGetter);
return true;
@@ -322,7 +322,7 @@
// Allow shortcuts like 'Image1' instead of document.images.Image1
Document* document = thisObject->impl().frame()->document();
if (document->isHTMLDocument()) {
- AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
+ AtomicStringImpl* atomicPropertyName = propertyName.publicName();
if (atomicPropertyName && toHTMLDocument(document)->hasWindowNamedItem(*atomicPropertyName)) {
slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, namedItemGetter);
return true;
Modified: trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp (171837 => 171838)
--- trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp 2014-07-31 03:36:35 UTC (rev 171837)
+++ trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp 2014-07-31 05:38:30 UTC (rev 171838)
@@ -53,7 +53,7 @@
bool JSHTMLDocument::canGetItemsForName(ExecState*, HTMLDocument* document, PropertyName propertyName)
{
- AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
+ AtomicStringImpl* atomicPropertyName = propertyName.publicName();
return atomicPropertyName && document->hasDocumentNamedItem(*atomicPropertyName);
}
@@ -62,7 +62,7 @@
JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(slotBase);
HTMLDocument& document = thisObj->impl();
- AtomicStringImpl* atomicPropertyName = findAtomicString(propertyName);
+ AtomicStringImpl* atomicPropertyName = propertyName.publicName();
if (!atomicPropertyName || !document.hasDocumentNamedItem(*atomicPropertyName))
return JSValue::encode(jsUndefined());