Title: [242747] trunk/Source/WTF
Revision
242747
Author
[email protected]
Date
2019-03-11 15:37:43 -0700 (Mon, 11 Mar 2019)

Log Message

[JSC] Make StaticStringImpl & StaticSymbolImpl actually static
https://bugs.webkit.org/show_bug.cgi?id=194212

Reviewed by Mark Lam.

Avoid mutation onto refcounts if `isStatic()` returns true so that the content of StaticStringImpl never gets modified.

* wtf/text/StringImpl.h:
(WTF::StringImpl::ref):
(WTF::StringImpl::deref):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (242746 => 242747)


--- trunk/Source/WTF/ChangeLog	2019-03-11 22:31:14 UTC (rev 242746)
+++ trunk/Source/WTF/ChangeLog	2019-03-11 22:37:43 UTC (rev 242747)
@@ -1,3 +1,16 @@
+2019-03-11  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Make StaticStringImpl & StaticSymbolImpl actually static
+        https://bugs.webkit.org/show_bug.cgi?id=194212
+
+        Reviewed by Mark Lam.
+
+        Avoid mutation onto refcounts if `isStatic()` returns true so that the content of StaticStringImpl never gets modified.
+
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::ref):
+        (WTF::StringImpl::deref):
+
 2019-03-11  Sihui Liu  <[email protected]>
 
         Crash under WebCore::IDBDatabase::connectionToServerLost

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (242746 => 242747)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2019-03-11 22:31:14 UTC (rev 242746)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2019-03-11 22:37:43 UTC (rev 242747)
@@ -1064,6 +1064,8 @@
 {
     STRING_STATS_REF_STRING(*this);
 
+    if (UNLIKELY(isStatic()))
+        return;
     m_refCount += s_refCountIncrement;
 }
 
@@ -1071,6 +1073,8 @@
 {
     STRING_STATS_DEREF_STRING(*this);
 
+    if (UNLIKELY(isStatic()))
+        return;
     unsigned tempRefCount = m_refCount - s_refCountIncrement;
     if (!tempRefCount) {
         StringImpl::destroy(this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to