<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209309] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209309">209309</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-12-03 16:28:49 -0800 (Sat, 03 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Refactor SymbolImpl layout
https://bugs.webkit.org/show_bug.cgi?id=165247
Reviewed by Darin Adler.
Source/JavaScriptCore:
Use SymbolImpl::{create, createNullSymbol} instead.
* runtime/PrivateName.h:
(JSC::PrivateName::PrivateName):
Source/WTF:
This patch moves SymbolImpl initialization from StringImpl to SymbolImpl.
In SymbolImpl, we create the appropriate fields. At that time, these fields
should be aligned to the BufferSubstring StringImpl.
And we newly create the `m_flags` in SymbolImpl. Instead of using special
StringImpl::null(), we store s_flagIsNullSymbol flag here. In WTF, we have
the invariant that StringImpl::empty() is the only atomic empty string.
But StringImpl::null() breaks this invariant. Using a special flag is safer
way to represent the null Symbol `Symbol()`.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/StdLibExtras.h:
(WTF::roundUpToMultipleOfImpl0):
(WTF::roundUpToMultipleOfImpl):
(WTF::roundUpToMultipleOf):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
(WTF::StringImpl::createSymbol): Deleted.
(WTF::StringImpl::createNullSymbol): Deleted.
* wtf/text/StringImpl.h:
(WTF::StringImpl::isAtomic):
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::requiresCopy):
(WTF::StringImpl::isNullSymbol): Deleted.
(WTF::StringImpl::symbolAwareHash): Deleted.
(WTF::StringImpl::existingSymbolAwareHash): Deleted.
(WTF::StringImpl::null): Deleted.
(WTF::StringImpl::extractFoldedStringInSymbol): Deleted.
(WTF::StringImpl::symbolRegistry): Deleted.
(WTF::StringImpl::hashForSymbol): Deleted.
* wtf/text/StringStatics.cpp:
(WTF::StringImpl::nextHashForSymbol): Deleted.
* wtf/text/SymbolImpl.cpp: Copied from Source/WTF/wtf/text/SymbolRegistry.cpp.
(WTF::SymbolImpl::nextHashForSymbol):
(WTF::SymbolImpl::create):
(WTF::SymbolImpl::createNullSymbol):
* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::hashForSymbol):
(WTF::SymbolImpl::symbolRegistry):
(WTF::SymbolImpl::isNullSymbol):
(WTF::SymbolImpl::extractFoldedString):
(WTF::SymbolImpl::SymbolImpl):
(WTF::StringImpl::symbolAwareHash):
(WTF::StringImpl::existingSymbolAwareHash):
* wtf/text/SymbolRegistry.cpp:
(WTF::SymbolRegistry::~SymbolRegistry):
(WTF::SymbolRegistry::symbolForKey):
(WTF::SymbolRegistry::keyForSymbol):
* wtf/text/UniquedStringImpl.h:
(WTF::UniquedStringImpl::UniquedStringImpl):
Tools:
* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimePrivateNameh">trunk/Source/JavaScriptCore/runtime/PrivateName.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWTFwtfStdLibExtrash">trunk/Source/WTF/wtf/StdLibExtras.h</a></li>
<li><a href="#trunkSourceWTFwtftextStringImplcpp">trunk/Source/WTF/wtf/text/StringImpl.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextStringImplh">trunk/Source/WTF/wtf/text/StringImpl.h</a></li>
<li><a href="#trunkSourceWTFwtftextStringStaticscpp">trunk/Source/WTF/wtf/text/StringStatics.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextSymbolImplh">trunk/Source/WTF/wtf/text/SymbolImpl.h</a></li>
<li><a href="#trunkSourceWTFwtftextSymbolRegistrycpp">trunk/Source/WTF/wtf/text/SymbolRegistry.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextUniquedStringImplh">trunk/Source/WTF/wtf/text/UniquedStringImpl.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFStringImplcpp">trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtftextSymbolImplcpp">trunk/Source/WTF/wtf/text/SymbolImpl.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-12-03 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Refactor SymbolImpl layout
+ https://bugs.webkit.org/show_bug.cgi?id=165247
+
+ Reviewed by Darin Adler.
+
+ Use SymbolImpl::{create, createNullSymbol} instead.
+
+ * runtime/PrivateName.h:
+ (JSC::PrivateName::PrivateName):
+
</ins><span class="cx"> 2016-12-03 JF Bastien <jfbastien@apple.com>
</span><span class="cx">
</span><span class="cx"> WebAssembly: update binary format to 0xD version
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimePrivateNameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/PrivateName.h (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/PrivateName.h        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/JavaScriptCore/runtime/PrivateName.h        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> class PrivateName {
</span><span class="cx"> public:
</span><span class="cx"> PrivateName()
</span><del>- : m_uid(StringImpl::createNullSymbol())
</del><ins>+ : m_uid(SymbolImpl::createNullSymbol())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">
</span><span class="cx"> enum DescriptionTag { Description };
</span><span class="cx"> explicit PrivateName(DescriptionTag, const String& description)
</span><del>- : m_uid(StringImpl::createSymbol(*description.impl()))
</del><ins>+ : m_uid(SymbolImpl::create(*description.impl()))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/ChangeLog        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+2016-12-03 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Refactor SymbolImpl layout
+ https://bugs.webkit.org/show_bug.cgi?id=165247
+
+ Reviewed by Darin Adler.
+
+ This patch moves SymbolImpl initialization from StringImpl to SymbolImpl.
+ In SymbolImpl, we create the appropriate fields. At that time, these fields
+ should be aligned to the BufferSubstring StringImpl.
+
+ And we newly create the `m_flags` in SymbolImpl. Instead of using special
+ StringImpl::null(), we store s_flagIsNullSymbol flag here. In WTF, we have
+ the invariant that StringImpl::empty() is the only atomic empty string.
+ But StringImpl::null() breaks this invariant. Using a special flag is safer
+ way to represent the null Symbol `Symbol()`.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/StdLibExtras.h:
+ (WTF::roundUpToMultipleOfImpl0):
+ (WTF::roundUpToMultipleOfImpl):
+ (WTF::roundUpToMultipleOf):
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::~StringImpl):
+ (WTF::StringImpl::createSymbol): Deleted.
+ (WTF::StringImpl::createNullSymbol): Deleted.
+ * wtf/text/StringImpl.h:
+ (WTF::StringImpl::isAtomic):
+ (WTF::StringImpl::StringImpl):
+ (WTF::StringImpl::requiresCopy):
+ (WTF::StringImpl::isNullSymbol): Deleted.
+ (WTF::StringImpl::symbolAwareHash): Deleted.
+ (WTF::StringImpl::existingSymbolAwareHash): Deleted.
+ (WTF::StringImpl::null): Deleted.
+ (WTF::StringImpl::extractFoldedStringInSymbol): Deleted.
+ (WTF::StringImpl::symbolRegistry): Deleted.
+ (WTF::StringImpl::hashForSymbol): Deleted.
+ * wtf/text/StringStatics.cpp:
+ (WTF::StringImpl::nextHashForSymbol): Deleted.
+ * wtf/text/SymbolImpl.cpp: Copied from Source/WTF/wtf/text/SymbolRegistry.cpp.
+ (WTF::SymbolImpl::nextHashForSymbol):
+ (WTF::SymbolImpl::create):
+ (WTF::SymbolImpl::createNullSymbol):
+ * wtf/text/SymbolImpl.h:
+ (WTF::SymbolImpl::hashForSymbol):
+ (WTF::SymbolImpl::symbolRegistry):
+ (WTF::SymbolImpl::isNullSymbol):
+ (WTF::SymbolImpl::extractFoldedString):
+ (WTF::SymbolImpl::SymbolImpl):
+ (WTF::StringImpl::symbolAwareHash):
+ (WTF::StringImpl::existingSymbolAwareHash):
+ * wtf/text/SymbolRegistry.cpp:
+ (WTF::SymbolRegistry::~SymbolRegistry):
+ (WTF::SymbolRegistry::symbolForKey):
+ (WTF::SymbolRegistry::keyForSymbol):
+ * wtf/text/UniquedStringImpl.h:
+ (WTF::UniquedStringImpl::UniquedStringImpl):
+
</ins><span class="cx"> 2016-12-01 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> Introduce StringImpl::StaticStringImpl with constexpr constructor
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -355,6 +355,7 @@
</span><span class="cx">                 FE8925B01D00DAEC0046907E /* Indenter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8925AF1D00DAEC0046907E /* Indenter.h */; };
</span><span class="cx">                 FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
</span><span class="cx">                 FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
</span><ins>+                52183012C99E476A84EEBEA8 /* SymbolImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F72BBDB107FA424886178B9E /* SymbolImpl.cpp */; };
</ins><span class="cx"> /* End PBXBuildFile section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXContainerItemProxy section */
</span><span class="lines">@@ -722,6 +723,7 @@
</span><span class="cx">                 FE8925AF1D00DAEC0046907E /* Indenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Indenter.h; sourceTree = "<group>"; };
</span><span class="cx">                 FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
</span><ins>+                F72BBDB107FA424886178B9E /* SymbolImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SymbolImpl.cpp; path = SymbolImpl.cpp; sourceTree = "<group>"; };
</ins><span class="cx"> /* End PBXFileReference section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXFrameworksBuildPhase section */
</span><span class="lines">@@ -1187,6 +1189,7 @@
</span><span class="cx">                                 70ECA60C1B02426800449739 /* UniquedStringImpl.h */,
</span><span class="cx">                                 A8A4732D151A825B004123FF /* WTFString.cpp */,
</span><span class="cx">                                 A8A4732E151A825B004123FF /* WTFString.h */,
</span><ins>+                                F72BBDB107FA424886178B9E /* SymbolImpl.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = text;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -1710,6 +1713,7 @@
</span><span class="cx">                                 E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */,
</span><span class="cx">                                 A8A47445151A825B004123FF /* WTFString.cpp in Sources */,
</span><span class="cx">                                 A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */,
</span><ins>+                                52183012C99E476A84EEBEA8 /* SymbolImpl.cpp in Sources */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -246,6 +246,7 @@
</span><span class="cx"> text/StringImpl.cpp
</span><span class="cx"> text/StringStatics.cpp
</span><span class="cx"> text/StringView.cpp
</span><ins>+ text/SymbolImpl.cpp
</ins><span class="cx"> text/SymbolRegistry.cpp
</span><span class="cx"> text/TextBreakIterator.cpp
</span><span class="cx"> text/WTFString.cpp
</span></span></pre></div>
<a id="trunkSourceWTFwtfStdLibExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/StdLibExtras.h (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/StdLibExtras.h        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/StdLibExtras.h        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -186,18 +186,27 @@
</span><span class="cx"> #endif
</span><span class="cx"> #define WTF_ARRAY_LENGTH(array) sizeof(::WTF::ArrayLengthHelperFunction(array))
</span><span class="cx">
</span><ins>+ALWAYS_INLINE constexpr size_t roundUpToMultipleOfImpl0(size_t remainderMask, size_t x)
+{
+ return (x + remainderMask) & ~remainderMask;
+}
+
+ALWAYS_INLINE constexpr size_t roundUpToMultipleOfImpl(size_t divisor, size_t x)
+{
+ return roundUpToMultipleOfImpl0(divisor - 1, x);
+}
+
</ins><span class="cx"> // Efficient implementation that takes advantage of powers of two.
</span><span class="cx"> inline size_t roundUpToMultipleOf(size_t divisor, size_t x)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(divisor && !(divisor & (divisor - 1)));
</span><del>- size_t remainderMask = divisor - 1;
- return (x + remainderMask) & ~remainderMask;
</del><ins>+ return roundUpToMultipleOfImpl(divisor, x);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-template<size_t divisor> inline size_t roundUpToMultipleOf(size_t x)
</del><ins>+template<size_t divisor> inline constexpr size_t roundUpToMultipleOf(size_t x)
</ins><span class="cx"> {
</span><span class="cx"> static_assert(divisor && !(divisor & (divisor - 1)), "divisor must be a power of two!");
</span><del>- return roundUpToMultipleOf(divisor, x);
</del><ins>+ return roundUpToMultipleOfImpl(divisor, x);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> enum BinarySearchMode {
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.cpp        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -101,7 +101,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-StringImpl::StaticStringImpl StringImpl::s_atomicNullString("", StringImpl::StringAtomic);
</del><span class="cx"> StringImpl::StaticStringImpl StringImpl::s_atomicEmptyString("", StringImpl::StringAtomic);
</span><span class="cx">
</span><span class="cx"> StringImpl::~StringImpl()
</span><span class="lines">@@ -115,8 +114,12 @@
</span><span class="cx"> if (isAtomic() && length() && !isSymbol())
</span><span class="cx"> AtomicStringImpl::remove(static_cast<AtomicStringImpl*>(this));
</span><span class="cx">
</span><del>- if (isSymbol() && symbolRegistry())
- symbolRegistry()->remove(static_cast<SymbolImpl&>(*this));
</del><ins>+ if (isSymbol()) {
+ auto& symbol = static_cast<SymbolImpl&>(*this);
+ auto* symbolRegistry = symbol.symbolRegistry();
+ if (symbolRegistry)
+ symbolRegistry->remove(symbol);
+ }
</ins><span class="cx">
</span><span class="cx"> BufferOwnership ownership = bufferOwnership();
</span><span class="cx">
</span><span class="lines">@@ -292,26 +295,6 @@
</span><span class="cx"> return create(string, length);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<SymbolImpl> StringImpl::createSymbol(StringImpl& rep)
-{
- auto* ownerRep = (rep.bufferOwnership() == BufferSubstring) ? rep.substringBuffer() : &rep;
-
- // We allocate a buffer that contains
- // 1. the StringImpl struct
- // 2. the pointer to the owner string
- // 3. the pointer to the symbol registry
- // 4. the placeholder for symbol aware hash value (allocated size is pointer size, but only 4 bytes are used)
- auto* stringImpl = static_cast<StringImpl*>(fastMalloc(allocationSize<StringImpl*>(3)));
- if (rep.is8Bit())
- return adoptRef(static_cast<SymbolImpl&>(*new (NotNull, stringImpl) StringImpl(CreateSymbol, rep.m_data8, rep.length(), *ownerRep)));
- return adoptRef(static_cast<SymbolImpl&>(*new (NotNull, stringImpl) StringImpl(CreateSymbol, rep.m_data16, rep.length(), *ownerRep)));
-}
-
-Ref<SymbolImpl> StringImpl::createNullSymbol()
-{
- return createSymbol(*null());
-}
-
</del><span class="cx"> bool StringImpl::containsOnlyWhitespace()
</span><span class="cx"> {
</span><span class="cx"> // FIXME: The definition of whitespace here includes a number of characters
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.h (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.h        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/text/StringImpl.h        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -139,6 +139,7 @@
</span><span class="cx"> friend struct WTF::UCharBufferTranslator;
</span><span class="cx"> friend class JSC::LLInt::Data;
</span><span class="cx"> friend class JSC::LLIntOffsetsExtractor;
</span><ins>+ friend class SymbolImpl;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> enum BufferOwnership {
</span><span class="lines">@@ -281,43 +282,6 @@
</span><span class="cx"> STRING_STATS_ADD_16BIT_STRING2(m_length, true);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- enum CreateSymbolTag { CreateSymbol };
- // Used to create new symbol strings that holds existing 8-bit [[Description]] string as a substring buffer (BufferSubstring).
- StringImpl(CreateSymbolTag, const LChar* characters, unsigned length, Ref<StringImpl>&& base)
- : m_refCount(s_refCountIncrement)
- , m_length(length)
- , m_data8(characters)
- , m_hashAndFlags(s_hashFlag8BitBuffer | StringSymbol | BufferSubstring)
- {
- ASSERT(is8Bit());
- ASSERT(m_data8);
- ASSERT(base->bufferOwnership() != BufferSubstring);
-
- substringBuffer() = &base.leakRef();
- symbolRegistry() = nullptr;
- hashForSymbol() = nextHashForSymbol();
-
- STRING_STATS_ADD_8BIT_STRING2(m_length, true);
- }
-
- // Used to create new symbol strings that holds existing 16-bit [[Description]] string as a substring buffer (BufferSubstring).
- StringImpl(CreateSymbolTag, const UChar* characters, unsigned length, Ref<StringImpl>&& base)
- : m_refCount(s_refCountIncrement)
- , m_length(length)
- , m_data16(characters)
- , m_hashAndFlags(StringSymbol | BufferSubstring)
- {
- ASSERT(!is8Bit());
- ASSERT(m_data16);
- ASSERT(base->bufferOwnership() != BufferSubstring);
-
- substringBuffer() = &base.leakRef();
- symbolRegistry() = nullptr;
- hashForSymbol() = nextHashForSymbol();
-
- STRING_STATS_ADD_16BIT_STRING2(m_length, true);
- }
-
</del><span class="cx"> public:
</span><span class="cx"> WTF_EXPORT_STRING_API static void destroy(StringImpl*);
</span><span class="cx">
</span><span class="lines">@@ -390,9 +354,6 @@
</span><span class="cx"> return constructInternal<T>(resultImpl, length);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- WTF_EXPORT_STRING_API static Ref<SymbolImpl> createNullSymbol();
- WTF_EXPORT_STRING_API static Ref<SymbolImpl> createSymbol(StringImpl& rep);
-
</del><span class="cx"> // Reallocate the StringImpl. The originalString must be only owned by the Ref,
</span><span class="cx"> // and the buffer ownership must be BufferInternal. Just like the input pointer of realloc(),
</span><span class="cx"> // the originalString can't be used after this function.
</span><span class="lines">@@ -466,7 +427,6 @@
</span><span class="cx"> StringKind stringKind() const { return static_cast<StringKind>(m_hashAndFlags & s_hashMaskStringKind); }
</span><span class="cx"> bool isSymbol() const { return m_hashAndFlags & s_hashFlagStringKindIsSymbol; }
</span><span class="cx"> bool isAtomic() const { return m_hashAndFlags & s_hashFlagStringKindIsAtomic; }
</span><del>- bool isNullSymbol() const { return isSymbol() && (substringBuffer() == null()); }
</del><span class="cx">
</span><span class="cx"> void setIsAtomic(bool isAtomic)
</span><span class="cx"> {
</span><span class="lines">@@ -536,20 +496,9 @@
</span><span class="cx">
</span><span class="cx"> WTF_EXPORT_PRIVATE unsigned concurrentHash() const;
</span><span class="cx">
</span><del>- unsigned symbolAwareHash() const
- {
- if (isSymbol())
- return hashForSymbol();
- return hash();
- }
</del><ins>+ unsigned symbolAwareHash() const;
+ unsigned existingSymbolAwareHash() const;
</ins><span class="cx">
</span><del>- unsigned existingSymbolAwareHash() const
- {
- if (isSymbol())
- return hashForSymbol();
- return existingHash();
- }
-
</del><span class="cx"> bool isStatic() const { return m_refCount & s_refCountFlagIsStaticString; }
</span><span class="cx">
</span><span class="cx"> inline size_t refCount() const
</span><span class="lines">@@ -620,9 +569,7 @@
</span><span class="cx"> unsigned m_hashAndFlags;
</span><span class="cx"> };
</span><span class="cx">
</span><del>- WTF_EXPORTDATA static StaticStringImpl s_atomicNullString;
</del><span class="cx"> WTF_EXPORTDATA static StaticStringImpl s_atomicEmptyString;
</span><del>- ALWAYS_INLINE static StringImpl* null() { return reinterpret_cast<StringImpl*>(&s_atomicNullString); }
</del><span class="cx"> ALWAYS_INLINE static StringImpl* empty() { return reinterpret_cast<StringImpl*>(&s_atomicEmptyString); }
</span><span class="cx">
</span><span class="cx"> // FIXME: Does this really belong in StringImpl?
</span><span class="lines">@@ -778,52 +725,47 @@
</span><span class="cx"> ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- Ref<StringImpl> extractFoldedStringInSymbol()
- {
- ASSERT(isSymbol());
- ASSERT(bufferOwnership() == BufferSubstring);
- ASSERT(substringBuffer());
- ASSERT(!substringBuffer()->isSymbol());
- return createSubstringSharingImpl(*this, 0, length());
- }
</del><ins>+protected:
+ ~StringImpl();
</ins><span class="cx">
</span><del>- SymbolRegistry* const& symbolRegistry() const
- {
- ASSERT(isSymbol());
- return *(tailPointer<SymbolRegistry*>() + 1);
- }
</del><ins>+ enum CreateSymbolTag { CreateSymbol };
</ins><span class="cx">
</span><del>- SymbolRegistry*& symbolRegistry()
</del><ins>+ // Used to create new symbol strings that holds existing 8-bit [[Description]] string as a substring buffer (BufferSubstring).
+ StringImpl(CreateSymbolTag, const LChar* characters, unsigned length)
+ : m_refCount(s_refCountIncrement)
+ , m_length(length)
+ , m_data8(characters)
+ , m_hashAndFlags(s_hashFlag8BitBuffer | StringSymbol | BufferSubstring)
</ins><span class="cx"> {
</span><del>- ASSERT(isSymbol());
- return *(tailPointer<SymbolRegistry*>() + 1);
</del><ins>+ ASSERT(is8Bit());
+ ASSERT(m_data8);
+ STRING_STATS_ADD_8BIT_STRING2(m_length, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- const unsigned& hashForSymbol() const
</del><ins>+ // Used to create new symbol strings that holds existing 16-bit [[Description]] string as a substring buffer (BufferSubstring).
+ StringImpl(CreateSymbolTag, const UChar* characters, unsigned length)
+ : m_refCount(s_refCountIncrement)
+ , m_length(length)
+ , m_data16(characters)
+ , m_hashAndFlags(StringSymbol | BufferSubstring)
</ins><span class="cx"> {
</span><del>- return const_cast<StringImpl*>(this)->hashForSymbol();
</del><ins>+ ASSERT(!is8Bit());
+ ASSERT(m_data16);
+ STRING_STATS_ADD_16BIT_STRING2(m_length, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned& hashForSymbol()
</del><ins>+ // Null symbol.
+ StringImpl(CreateSymbolTag)
+ : m_refCount(s_refCountIncrement)
+ , m_length(0)
+ , m_data8(empty()->characters8())
+ , m_hashAndFlags(s_hashFlag8BitBuffer | StringSymbol | BufferSubstring)
</ins><span class="cx"> {
</span><del>- ASSERT(isSymbol());
- return *reinterpret_cast<unsigned*>((tailPointer<SymbolRegistry*>() + 2));
</del><ins>+ ASSERT(is8Bit());
+ ASSERT(m_data8);
+ STRING_STATS_ADD_8BIT_STRING2(m_length, true);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-protected:
- ~StringImpl();
-
-private:
- bool requiresCopy() const
- {
- if (bufferOwnership() != BufferInternal)
- return true;
-
- if (is8Bit())
- return m_data8 == tailPointer<LChar>();
- return m_data16 == tailPointer<UChar>();
- }
-
</del><span class="cx"> template<typename T>
</span><span class="cx"> static size_t allocationSize(unsigned tailElementCount)
</span><span class="cx"> {
</span><span class="lines">@@ -841,6 +783,17 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+private:
+ bool requiresCopy() const
+ {
+ if (bufferOwnership() != BufferInternal)
+ return true;
+
+ if (is8Bit())
+ return m_data8 == tailPointer<LChar>();
+ return m_data16 == tailPointer<UChar>();
+ }
+
</ins><span class="cx"> template<typename T>
</span><span class="cx"> const T* tailPointer() const
</span><span class="cx"> {
</span><span class="lines">@@ -882,7 +835,6 @@
</span><span class="cx"> template <typename CharType> static Ref<StringImpl> reallocateInternal(Ref<StringImpl>&&, unsigned, CharType*&);
</span><span class="cx"> template <typename CharType> static Ref<StringImpl> createInternal(const CharType*, unsigned);
</span><span class="cx"> WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const;
</span><del>- WTF_EXPORT_PRIVATE static unsigned nextHashForSymbol();
</del><span class="cx">
</span><span class="cx"> // The bottom bit in the ref count indicates a static (immortal) string.
</span><span class="cx"> static const unsigned s_refCountFlagIsStaticString = 0x1;
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringStaticscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringStatics.cpp (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringStatics.cpp        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/text/StringStatics.cpp        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -41,20 +41,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>-// In addition to the normal hash value, store specialized hash value for
-// symbolized StringImpl*. And don't use the normal hash value for symbolized
-// StringImpl* when they are treated as Identifiers. Unique nature of these
-// symbolized StringImpl* keys means that we don't need them to match any other
-// string (in fact, that's exactly the oposite of what we want!), and the
-// normal hash would lead to lots of conflicts.
-unsigned StringImpl::nextHashForSymbol()
-{
- static unsigned s_nextHashForSymbol = 0;
- s_nextHashForSymbol += 1 << s_flagCount;
- s_nextHashForSymbol |= 1 << 31;
- return s_nextHashForSymbol;
-}
-
</del><span class="cx"> WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
</span><span class="cx"> WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom)
</span><span class="cx"> WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom)
</span></span></pre></div>
<a id="trunkSourceWTFwtftextSymbolImplcppfromrev209308trunkSourceWTFwtftextSymbolRegistrycpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WTF/wtf/text/SymbolImpl.cpp (from rev 209308, trunk/Source/WTF/wtf/text/SymbolRegistry.cpp) (0 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/SymbolImpl.cpp         (rev 0)
+++ trunk/Source/WTF/wtf/text/SymbolImpl.cpp        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SymbolImpl.h"
+
+namespace WTF {
+
+// In addition to the normal hash value, store specialized hash value for
+// symbolized StringImpl*. And don't use the normal hash value for symbolized
+// StringImpl* when they are treated as Identifiers. Unique nature of these
+// symbolized StringImpl* keys means that we don't need them to match any other
+// string (in fact, that's exactly the oposite of what we want!), and the
+// normal hash would lead to lots of conflicts.
+unsigned SymbolImpl::nextHashForSymbol()
+{
+ static unsigned s_nextHashForSymbol = 0;
+ s_nextHashForSymbol += 1 << s_flagCount;
+ s_nextHashForSymbol |= 1 << 31;
+ return s_nextHashForSymbol;
+}
+
+Ref<SymbolImpl> SymbolImpl::create(StringImpl& rep)
+{
+ auto* ownerRep = (rep.bufferOwnership() == BufferSubstring) ? rep.substringBuffer() : &rep;
+ ASSERT(ownerRep->bufferOwnership() != BufferSubstring);
+ if (rep.is8Bit())
+ return adoptRef(*new SymbolImpl(rep.m_data8, rep.length(), *ownerRep));
+ return adoptRef(*new SymbolImpl(rep.m_data16, rep.length(), *ownerRep));
+}
+
+Ref<SymbolImpl> SymbolImpl::createNullSymbol()
+{
+ return adoptRef(*new SymbolImpl);
+}
+
+} // namespace WTF
</ins></span></pre></div>
<a id="trunkSourceWTFwtftextSymbolImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/SymbolImpl.h (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/SymbolImpl.h        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/text/SymbolImpl.h        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
</del><ins>+ * Copyright (C) 2015-2016 Yusuke Suzuki <utatane.tea@gmail.com>.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef SymbolImpl_h
-#define SymbolImpl_h
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include <wtf/text/UniquedStringImpl.h>
</span><span class="cx">
</span><span class="lines">@@ -34,9 +33,77 @@
</span><span class="cx"> // It is uniqued string impl, but is not registered in Atomic String tables, so it's not atomic.
</span><span class="cx"> class SymbolImpl : public UniquedStringImpl {
</span><span class="cx"> private:
</span><del>- SymbolImpl() = delete;
</del><ins>+ static constexpr const unsigned s_flagIsNullSymbol = 1u;
+
+public:
+ unsigned hashForSymbol() const { return m_hashForSymbol; }
+ SymbolRegistry* const& symbolRegistry() const { return m_symbolRegistry; }
+ SymbolRegistry*& symbolRegistry() { return m_symbolRegistry; }
+ bool isNullSymbol() const { return m_flags & s_flagIsNullSymbol; }
+
+ WTF_EXPORT_STRING_API static Ref<SymbolImpl> createNullSymbol();
+ WTF_EXPORT_STRING_API static Ref<SymbolImpl> create(StringImpl& rep);
+
+ Ref<StringImpl> extractFoldedString()
+ {
+ ASSERT(substringBuffer());
+ ASSERT(substringBuffer() == m_owner);
+ ASSERT(!substringBuffer()->isSymbol());
+ return createSubstringSharingImpl(*this, 0, length());
+ }
+
+private:
+ WTF_EXPORT_PRIVATE static unsigned nextHashForSymbol();
+
+ friend class StringImpl;
+
+ SymbolImpl(const LChar* characters, unsigned length, Ref<StringImpl>&& base)
+ : UniquedStringImpl(CreateSymbol, characters, length)
+ , m_owner(&base.leakRef())
+ , m_hashForSymbol(nextHashForSymbol())
+ {
+ ASSERT(StringImpl::tailOffset<StringImpl*>() == OBJECT_OFFSETOF(SymbolImpl, m_owner));
+ }
+
+ SymbolImpl(const UChar* characters, unsigned length, Ref<StringImpl>&& base)
+ : UniquedStringImpl(CreateSymbol, characters, length)
+ , m_owner(&base.leakRef())
+ , m_hashForSymbol(nextHashForSymbol())
+ {
+ ASSERT(StringImpl::tailOffset<StringImpl*>() == OBJECT_OFFSETOF(SymbolImpl, m_owner));
+ }
+
+ SymbolImpl()
+ : UniquedStringImpl(CreateSymbol)
+ , m_owner(StringImpl::empty())
+ , m_hashForSymbol(nextHashForSymbol())
+ , m_flags(s_flagIsNullSymbol)
+ {
+ ASSERT(StringImpl::tailOffset<StringImpl*>() == OBJECT_OFFSETOF(SymbolImpl, m_owner));
+ }
+
+ // The pointer to the owner string should be immediately following after the StringImpl layout,
+ // since we would like to align the layout of SymbolImpl to the one of BufferSubstring StringImpl.
+ StringImpl* m_owner;
+ SymbolRegistry* m_symbolRegistry { nullptr };
+ unsigned m_hashForSymbol;
+ unsigned m_flags { 0 };
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+inline unsigned StringImpl::symbolAwareHash() const
+{
+ if (isSymbol())
+ return static_cast<const SymbolImpl*>(this)->hashForSymbol();
+ return hash();
+}
+
+inline unsigned StringImpl::existingSymbolAwareHash() const
+{
+ if (isSymbol())
+ return static_cast<const SymbolImpl*>(this)->hashForSymbol();
+ return existingHash();
+}
+
</ins><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx"> // SymbolImpls created from StaticASCIILiteral will ASSERT
</span><span class="cx"> // in the generic ValueCheck<T>::checkConsistency
</span><span class="lines">@@ -57,5 +124,3 @@
</span><span class="cx"> } // namespace WTF
</span><span class="cx">
</span><span class="cx"> using WTF::SymbolImpl;
</span><del>-
-#endif // SymbolImpl_h
</del></span></pre></div>
<a id="trunkSourceWTFwtftextSymbolRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/SymbolRegistry.cpp (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/SymbolRegistry.cpp        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/text/SymbolRegistry.cpp        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> SymbolRegistry::~SymbolRegistry()
</span><span class="cx"> {
</span><span class="cx"> for (auto& key : m_table)
</span><del>- key.impl()->symbolRegistry() = nullptr;
</del><ins>+ static_cast<SymbolImpl&>(*key.impl()).symbolRegistry() = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Ref<SymbolImpl> SymbolRegistry::symbolForKey(const String& rep)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> if (!addResult.isNewEntry)
</span><span class="cx"> return *static_cast<SymbolImpl*>(addResult.iterator->impl());
</span><span class="cx">
</span><del>- auto symbol = StringImpl::createSymbol(*rep.impl());
</del><ins>+ auto symbol = SymbolImpl::create(*rep.impl());
</ins><span class="cx"> symbol->symbolRegistry() = this;
</span><span class="cx"> *addResult.iterator = SymbolRegistryKey(&symbol.get());
</span><span class="cx"> return symbol;
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> String SymbolRegistry::keyForSymbol(SymbolImpl& uid)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(uid.symbolRegistry() == this);
</span><del>- return uid.extractFoldedStringInSymbol();
</del><ins>+ return uid.extractFoldedString();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void SymbolRegistry::remove(SymbolImpl& uid)
</span></span></pre></div>
<a id="trunkSourceWTFwtftextUniquedStringImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/UniquedStringImpl.h (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/UniquedStringImpl.h        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Source/WTF/wtf/text/UniquedStringImpl.h        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -35,6 +35,10 @@
</span><span class="cx"> class UniquedStringImpl : public StringImpl {
</span><span class="cx"> private:
</span><span class="cx"> UniquedStringImpl() = delete;
</span><ins>+protected:
+ UniquedStringImpl(CreateSymbolTag, const LChar* characters, unsigned length) : StringImpl(CreateSymbol, characters, length) { }
+ UniquedStringImpl(CreateSymbolTag, const UChar* characters, unsigned length) : StringImpl(CreateSymbol, characters, length) { }
+ UniquedStringImpl(CreateSymbolTag) : StringImpl(CreateSymbol) { }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> #if !ASSERT_DISABLED
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Tools/ChangeLog        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-12-03 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ Refactor SymbolImpl layout
+ https://bugs.webkit.org/show_bug.cgi?id=165247
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/Tests/WTF/StringImpl.cpp:
+ (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2016-12-03 Dan Bernstein <mitz@apple.com>
</span><span class="cx">
</span><span class="cx"> Fixed the build after r209307.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFStringImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp (209308 => 209309)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp        2016-12-04 00:11:41 UTC (rev 209308)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp        2016-12-04 00:28:49 UTC (rev 209309)
</span><span class="lines">@@ -516,7 +516,7 @@
</span><span class="cx">
</span><span class="cx"> TEST(WTF, StringImplCreateNullSymbol)
</span><span class="cx"> {
</span><del>- auto reference = StringImpl::createNullSymbol();
</del><ins>+ auto reference = SymbolImpl::createNullSymbol();
</ins><span class="cx"> ASSERT_TRUE(reference->isSymbol());
</span><span class="cx"> ASSERT_TRUE(reference->isNullSymbol());
</span><span class="cx"> ASSERT_FALSE(reference->isAtomic());
</span><span class="lines">@@ -527,7 +527,7 @@
</span><span class="cx"> TEST(WTF, StringImplCreateSymbol)
</span><span class="cx"> {
</span><span class="cx"> auto original = stringFromUTF8("original");
</span><del>- auto reference = StringImpl::createSymbol(original);
</del><ins>+ auto reference = SymbolImpl::create(original);
</ins><span class="cx"> ASSERT_TRUE(reference->isSymbol());
</span><span class="cx"> ASSERT_FALSE(reference->isNullSymbol());
</span><span class="cx"> ASSERT_FALSE(reference->isAtomic());
</span><span class="lines">@@ -537,12 +537,11 @@
</span><span class="cx"> ASSERT_TRUE(equal(reference.ptr(), "original"));
</span><span class="cx">
</span><span class="cx"> auto empty = stringFromUTF8("");
</span><del>- auto emptyReference = StringImpl::createSymbol(empty);
</del><ins>+ auto emptyReference = SymbolImpl::create(empty);
</ins><span class="cx"> ASSERT_TRUE(emptyReference->isSymbol());
</span><span class="cx"> ASSERT_FALSE(emptyReference->isNullSymbol());
</span><span class="cx"> ASSERT_FALSE(emptyReference->isAtomic());
</span><span class="cx"> ASSERT_FALSE(empty->isSymbol());
</span><del>- ASSERT_FALSE(empty->isNullSymbol());
</del><span class="cx"> ASSERT_TRUE(empty->isAtomic());
</span><span class="cx"> ASSERT_EQ(empty->length(), emptyReference->length());
</span><span class="cx"> ASSERT_TRUE(equal(emptyReference.ptr(), ""));
</span><span class="lines">@@ -551,7 +550,7 @@
</span><span class="cx"> TEST(WTF, StringImplSymbolToAtomicString)
</span><span class="cx"> {
</span><span class="cx"> auto original = stringFromUTF8("original");
</span><del>- auto reference = StringImpl::createSymbol(original);
</del><ins>+ auto reference = SymbolImpl::create(original);
</ins><span class="cx"> ASSERT_TRUE(reference->isSymbol());
</span><span class="cx"> ASSERT_FALSE(reference->isAtomic());
</span><span class="cx">
</span><span class="lines">@@ -564,7 +563,7 @@
</span><span class="cx">
</span><span class="cx"> TEST(WTF, StringImplNullSymbolToAtomicString)
</span><span class="cx"> {
</span><del>- auto reference = StringImpl::createNullSymbol();
</del><ins>+ auto reference = SymbolImpl::createNullSymbol();
</ins><span class="cx"> ASSERT_TRUE(reference->isSymbol());
</span><span class="cx"> ASSERT_FALSE(reference->isAtomic());
</span><span class="cx">
</span><span class="lines">@@ -587,8 +586,6 @@
</span><span class="cx"> TEST(WTF, StringImplEmpty)
</span><span class="cx"> {
</span><span class="cx"> ASSERT_FALSE(StringImpl::empty()->length());
</span><del>- ASSERT_FALSE(StringImpl::null()->length());
- ASSERT_NE(StringImpl::null(), StringImpl::empty());
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre>
</div>
</div>
</body>
</html>