Title: [104219] trunk/Source/_javascript_Core
Revision
104219
Author
[email protected]
Date
2012-01-05 14:30:50 -0800 (Thu, 05 Jan 2012)

Log Message

Refined the fast path for StringImpl::hash()
https://bugs.webkit.org/show_bug.cgi?id=75178

Reviewed by Darin Adler.

Moved the hash calculation code into an out-of-line function to clean up
the hot path.

No measurable benchmark change, but this knocks some samples off in
Instruments, and I think this is a step toward removing -fomit-frame-pointer.
        
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::hashSlowCase):
* wtf/text/StringImpl.h:
(WTF::StringImpl::hash): The patch.

* wtf/text/StringStatics.cpp:
(WTF::StringImpl::hashSlowCase): Abide by the cockamamie Windows build
scheme, which requires all out-of-line StringImpl functions used by
WebCore be defined in this file instead of StringImpl.cpp. (See http://trac.webkit.org/changeset/59187.)

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (104218 => 104219)


--- trunk/Source/_javascript_Core/ChangeLog	2012-01-05 22:29:07 UTC (rev 104218)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-01-05 22:30:50 UTC (rev 104219)
@@ -1,3 +1,26 @@
+2012-01-05  Geoffrey Garen  <[email protected]>
+
+        Refined the fast path for StringImpl::hash()
+        https://bugs.webkit.org/show_bug.cgi?id=75178
+
+        Reviewed by Darin Adler.
+
+        Moved the hash calculation code into an out-of-line function to clean up
+        the hot path.
+
+        No measurable benchmark change, but this knocks some samples off in
+        Instruments, and I think this is a step toward removing -fomit-frame-pointer.
+        
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::hashSlowCase):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::hash): The patch.
+
+        * wtf/text/StringStatics.cpp:
+        (WTF::StringImpl::hashSlowCase): Abide by the cockamamie Windows build
+        scheme, which requires all out-of-line StringImpl functions used by
+        WebCore be defined in this file instead of StringImpl.cpp. (See http://trac.webkit.org/changeset/59187.)
+
 2012-01-05  Gavin Barraclough  <[email protected]>
 
         Literal tab in JSONString fails

Modified: trunk/Source/_javascript_Core/_javascript_Core.exp (104218 => 104219)


--- trunk/Source/_javascript_Core/_javascript_Core.exp	2012-01-05 22:29:07 UTC (rev 104218)
+++ trunk/Source/_javascript_Core/_javascript_Core.exp	2012-01-05 22:30:50 UTC (rev 104219)
@@ -588,6 +588,7 @@
 __ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE
 __ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
 __ZNK3JSC9HashTable11deleteTableEv
+__ZNK3WTF10StringImpl12hashSlowCaseEv
 __ZNK3WTF10StringImpl17getData16SlowCaseEv
 __ZNK3WTF10StringImpl19upconvertCharactersEjj
 __ZNK3WTF12AtomicString5lowerEv

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (104218 => 104219)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-01-05 22:29:07 UTC (rev 104218)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-01-05 22:30:50 UTC (rev 104219)
@@ -50,8 +50,8 @@
     ?absoluteTimeToWaitTimeoutInterval@WTF@@YAKN@Z
     ?activityCallback@Heap@JSC@@QAEPAVGCActivityCallback@2@XZ
     ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
+    ?add@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z
     ?add@Identifier@JSC@@SA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PBD@Z
-    ?add@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z
     ?add@PropertyNameArray@JSC@@QAEXPAVStringImpl@WTF@@@Z
     ?addBytes@MD5@WTF@@QAEXPBEI@Z
     ?addBytes@SHA1@WTF@@QAEXPBEI@Z
@@ -128,7 +128,6 @@
     ?currentThread@WTF@@YAIXZ
     ?currentThreadIsHoldingLock@JSLock@JSC@@SA_NXZ
     ?currentTime@WTF@@YANXZ
-    ?execute@ParallelEnvironment@WTF@@QAEXPAX@Z
     ?data@CString@WTF@@QBEPBDXZ
     ?dateToDaysFrom1970@WTF@@YANHHH@Z
     ?dayInMonthFromDayInYear@WTF@@YAHH_N@Z
@@ -167,6 +166,7 @@
     ?evaluate@DebuggerCallFrame@JSC@@QBE?AVJSValue@2@ABVUString@2@AAV32@@Z
     ?evaluate@JSC@@YA?AVJSValue@1@PAVExecState@1@PAVScopeChainNode@1@ABVSourceCode@1@V21@PAV21@@Z
     ?exclude@Profile@JSC@@QAEXPBVProfileNode@2@@Z
+    ?execute@ParallelEnvironment@WTF@@QAEXPAX@Z
     ?expand@MarkStackArray@JSC@@AAEXXZ
     ?fastCalloc@WTF@@YAPAXII@Z
     ?fastFree@WTF@@YAXPAX@Z
@@ -217,6 +217,7 @@
     ?hasInstance@JSObject@JSC@@SA_NPAV12@PAVExecState@2@VJSValue@2@2@Z
     ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@ABVIdentifier@2@@Z
     ?hasProperty@JSObject@JSC@@QBE_NPAVExecState@2@I@Z
+    ?hashSlowCase@StringImpl@WTF@@ABEIXZ
     ?heap@Heap@JSC@@SAPAV12@VJSValue@2@@Z
     ?increment@RefCountedLeakCounter@WTF@@QAEXXZ
     ?init@AtomicString@WTF@@SAXXZ
@@ -256,9 +257,9 @@
     ?number@UString@JSC@@SA?AV12@H@Z
     ?number@UString@JSC@@SA?AV12@I@Z
     ?number@UString@JSC@@SA?AV12@N@Z
-    ?numberToString@WTF@@YAPBDNQAD@Z
     ?numberToFixedPrecisionString@WTF@@YAPBDNIQAD_N@Z
     ?numberToFixedWidthString@WTF@@YAPBDNIQAD@Z
+    ?numberToString@WTF@@YAPBDNQAD@Z
     ?objectCount@Heap@JSC@@QAEIXZ
     ?objectProtoFuncToString@JSC@@YI_JPAVExecState@1@@Z
     ?objectTypeCounts@Heap@JSC@@QAE?AV?$PassOwnPtr@V?$HashCountedSet@PBDU?$PtrHash@PBD@WTF@@U?$HashTraits@PBD@2@@WTF@@@WTF@@XZ

Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.h (104218 => 104219)


--- trunk/Source/_javascript_Core/wtf/text/StringImpl.h	2012-01-05 22:29:07 UTC (rev 104218)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.h	2012-01-05 22:30:50 UTC (rev 104219)
@@ -369,13 +369,9 @@
 
     unsigned hash() const
     {
-        if (!hasHash()) {
-            if (is8Bit())
-                setHash(StringHasher::computeHash(m_data8, m_length));
-            else
-                setHash(StringHasher::computeHash(m_data16, m_length));
-        }
-        return existingHash();
+        if (hasHash())
+            return existingHash();
+        return hashSlowCase();
     }
 
     inline bool hasOneRef() const
@@ -516,6 +512,7 @@
     template <class UCharPredicate> PassRefPtr<StringImpl> stripMatchedCharacters(UCharPredicate);
     template <typename CharType, class UCharPredicate> PassRefPtr<StringImpl> simplifyMatchedCharactersToSpace(UCharPredicate);
     NEVER_INLINE const UChar* getData16SlowCase() const;
+    NEVER_INLINE unsigned hashSlowCase() const;
 
     // The bottom bit in the ref count indicates a static (immortal) string.
     static const unsigned s_refCountFlagIsStaticString = 0x1;

Modified: trunk/Source/_javascript_Core/wtf/text/StringStatics.cpp (104218 => 104219)


--- trunk/Source/_javascript_Core/wtf/text/StringStatics.cpp	2012-01-05 22:29:07 UTC (rev 104218)
+++ trunk/Source/_javascript_Core/wtf/text/StringStatics.cpp	2012-01-05 22:30:50 UTC (rev 104219)
@@ -60,6 +60,15 @@
 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom, "xml")
 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom, "xmlns")
 
+NEVER_INLINE unsigned StringImpl::hashSlowCase() const
+{
+    if (is8Bit())
+        setHash(StringHasher::computeHash(m_data8, m_length));
+    else
+        setHash(StringHasher::computeHash(m_data16, m_length));
+    return existingHash();
+}
+
 void AtomicString::init()
 {
     static bool initialized;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to