<!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>[165982] trunk/Source</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/165982">165982</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2014-03-20 12:26:31 -0700 (Thu, 20 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge AtomicString, Identifier
https://bugs.webkit.org/show_bug.cgi?id=128624

Reviewed by Geoff Garen.

Source/JavaScriptCore: 

WTF::StringImpl currently supports two uniquing mechanism - AtomicString and
Identifer - that is one too many.

Remove Identifier in favour of AtomicString. Identifier had two interesting
mechanisms that we preserve.

(1) JSC API VMs each get their own string table, switch the string table on
    API entry/exit.
(2) JSC caches a pointer to the string table on the VM to avoid a thread
    specific access. Adds a new AtomicString::add method to support this.

* API/JSAPIWrapperObject.mm:
    - updated includes.
* JavaScriptCore.xcodeproj/project.pbxproj:
    - added IdentifierInlines.h.
* inspector/JSInjectedScriptHostPrototype.cpp:
* inspector/JSJavaScriptCallFramePrototype.cpp:
    - updated includes.
* interpreter/CallFrame.h:
(JSC::ExecState::atomicStringTable):
    - added, used via AtomicString::add to avoid thread-specific access.
* runtime/ConsolePrototype.cpp:
    - updated includes.
* runtime/Identifier.cpp:
(JSC::Identifier::add):
(JSC::Identifier::add8):
    - vm-&gt;smallStrings.singleCharacterStringRep now returns Atomic strings, use AtomicString::add.
* runtime/Identifier.h:
(JSC::Identifier::Identifier):
    - added ASSERTS.
(JSC::Identifier::add):
    - vm-&gt;smallStrings.singleCharacterStringRep now returns Atomic strings, use AtomicString::add.
* runtime/IdentifierInlines.h: Added.
(JSC::Identifier::add):
    - moved from Identifier.h, use AtomicString::add.
* runtime/JSCInlines.h:
    - added IdentifierInlines.h.
* runtime/JSLock.h:
    - removed IdentifierTable.
* runtime/PropertyNameArray.cpp:
    - updated includes.
* runtime/SmallStrings.cpp:
(JSC::SmallStringsStorage::SmallStringsStorage):
    - ensure all single character strings are Atomic.
* runtime/VM.cpp:
(JSC::VM::VM):
    - instantiate CommonIdentifiers with the correct AtomicStringTable set on thread data.
* runtime/VM.h:
(JSC::VM::atomicStringTable):
    - added, used via AtomicString::add to avoid thread-specific access.

Source/WebKit: 

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
    - exports no longer needed.

Source/WTF: 

WTF::StringImpl currently supports two uniquing mechanism - AtomicString and
Identifer - that is one too many.

Remove Identifier in favour of AtomicString. Identifier had two interesting
mechanisms that we preserve.

(1) JSC API VMs each get their own string table, switch the string table on
    API entry/exit.
(2) JSC caches a pointer to the string table on the VM to avoid a thread
    specific access. Adds a new AtomicString::add method to support this.

* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
    - remove allocation of IdentifierTable.
(WTF::WTFThreadData::~WTFThreadData):
    - remove deletion of IdentifierTable.
* wtf/WTFThreadData.h:
(WTF::WTFThreadData::atomicStringTable):
    - table is now switched by JSC API, return the current table.
(WTF::WTFThreadData::currentIdentifierTable):
    - now returns the current AtomicStringTable.
(WTF::WTFThreadData::setCurrentIdentifierTable):
    - now sets the current AtomicStringTable.
(WTF::WTFThreadData::resetCurrentIdentifierTable):
    - now resets the AtomicStringTable.
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::addSlowCase):
    - add without thread-specific access to access string table.
* wtf/text/AtomicString.h:
(WTF::AtomicString::addWithStringTableProvider):
    - add without thread-specific access (used by JSC, string table provided by VM or ExecState).
* wtf/text/AtomicStringTable.cpp:
(WTF::AtomicStringTable::create):
    - renamed m_atomicStringTable -&gt; m_defaultAtomicStringTable.
(WTF::AtomicStringTable::~AtomicStringTable):
(WTF::AtomicStringTable::destroy):
    - clearing of table moved from AtomicStringTable::destroy to destructor.
* wtf/text/AtomicStringTable.h:
    - added destructor.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
    - Identifers no longer exist; no need to remove them from IdentifierTable.
* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl):
    - removed s_hashFlagIsIdentifier.
(WTF::StringImpl::flagIsIdentifier):
    - s_hashFlagIsIdentifier -&gt; s_hashFlagIsAtomic.
(WTF::StringImpl::isIdentifier):
    - now synonymous to isAtomic().
* wtf/text/StringStatics.cpp:
(WTF::StringImpl::hashAndFlagsForEmptyUnique):
    - removed s_hashFlagIsIdentifier.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreAPIJSAPIWrapperObjectmm">trunk/Source/JavaScriptCore/API/JSAPIWrapperObject.mm</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSInjectedScriptHostPrototypecpp">trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSJavaScriptCallFramePrototypecpp">trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterCallFrameh">trunk/Source/JavaScriptCore/interpreter/CallFrame.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeConsolePrototypecpp">trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeIdentifiercpp">trunk/Source/JavaScriptCore/runtime/Identifier.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeIdentifierh">trunk/Source/JavaScriptCore/runtime/Identifier.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSCInlinesh">trunk/Source/JavaScriptCore/runtime/JSCInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSLockh">trunk/Source/JavaScriptCore/runtime/JSLock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimePropertyNameArraycpp">trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeSmallStringscpp">trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMcpp">trunk/Source/JavaScriptCore/runtime/VM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfWTFThreadDatacpp">trunk/Source/WTF/wtf/WTFThreadData.cpp</a></li>
<li><a href="#trunkSourceWTFwtfWTFThreadDatah">trunk/Source/WTF/wtf/WTFThreadData.h</a></li>
<li><a href="#trunkSourceWTFwtftextAtomicStringcpp">trunk/Source/WTF/wtf/text/AtomicString.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextAtomicStringh">trunk/Source/WTF/wtf/text/AtomicString.h</a></li>
<li><a href="#trunkSourceWTFwtftextAtomicStringTablecpp">trunk/Source/WTF/wtf/text/AtomicStringTable.cpp</a></li>
<li><a href="#trunkSourceWTFwtftextAtomicStringTableh">trunk/Source/WTF/wtf/text/AtomicStringTable.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="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojWebKitExportGeneratorWebKitExportsdefin">trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreruntimeIdentifierInlinesh">trunk/Source/JavaScriptCore/runtime/IdentifierInlines.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreAPIJSAPIWrapperObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/API/JSAPIWrapperObject.mm (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/API/JSAPIWrapperObject.mm        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/API/JSAPIWrapperObject.mm        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -27,13 +27,10 @@
</span><span class="cx"> #include &quot;JSAPIWrapperObject.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DelayedReleaseScope.h&quot;
</span><del>-#include &quot;JSCJSValueInlines.h&quot;
</del><ins>+#include &quot;JSCInlines.h&quot;
</ins><span class="cx"> #include &quot;JSCallbackObject.h&quot;
</span><del>-#include &quot;JSCellInlines.h&quot;
</del><span class="cx"> #include &quot;JSVirtualMachineInternal.h&quot;
</span><del>-#include &quot;SlotVisitorInlines.h&quot;
</del><span class="cx"> #include &quot;Structure.h&quot;
</span><del>-#include &quot;StructureInlines.h&quot;
</del><span class="cx"> 
</span><span class="cx"> #if JSC_OBJC_API_ENABLED
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2014-03-20  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        Merge AtomicString, Identifier
+        https://bugs.webkit.org/show_bug.cgi?id=128624
+
+        Reviewed by Geoff Garen.
+
+        WTF::StringImpl currently supports two uniquing mechanism - AtomicString and
+        Identifer - that is one too many.
+
+        Remove Identifier in favour of AtomicString. Identifier had two interesting
+        mechanisms that we preserve.
+
+        (1) JSC API VMs each get their own string table, switch the string table on
+            API entry/exit.
+        (2) JSC caches a pointer to the string table on the VM to avoid a thread
+            specific access. Adds a new AtomicString::add method to support this.
+
+        * API/JSAPIWrapperObject.mm:
+            - updated includes.
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+            - added IdentifierInlines.h.
+        * inspector/JSInjectedScriptHostPrototype.cpp:
+        * inspector/JSJavaScriptCallFramePrototype.cpp:
+            - updated includes.
+        * interpreter/CallFrame.h:
+        (JSC::ExecState::atomicStringTable):
+            - added, used via AtomicString::add to avoid thread-specific access.
+        * runtime/ConsolePrototype.cpp:
+            - updated includes.
+        * runtime/Identifier.cpp:
+        (JSC::Identifier::add):
+        (JSC::Identifier::add8):
+            - vm-&gt;smallStrings.singleCharacterStringRep now returns Atomic strings, use AtomicString::add.
+        * runtime/Identifier.h:
+        (JSC::Identifier::Identifier):
+            - added ASSERTS.
+        (JSC::Identifier::add):
+            - vm-&gt;smallStrings.singleCharacterStringRep now returns Atomic strings, use AtomicString::add.
+        * runtime/IdentifierInlines.h: Added.
+        (JSC::Identifier::add):
+            - moved from Identifier.h, use AtomicString::add.
+        * runtime/JSCInlines.h:
+            - added IdentifierInlines.h.
+        * runtime/JSLock.h:
+            - removed IdentifierTable.
+        * runtime/PropertyNameArray.cpp:
+            - updated includes.
+        * runtime/SmallStrings.cpp:
+        (JSC::SmallStringsStorage::SmallStringsStorage):
+            - ensure all single character strings are Atomic.
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+            - instantiate CommonIdentifiers with the correct AtomicStringTable set on thread data.
+        * runtime/VM.h:
+        (JSC::VM::atomicStringTable):
+            - added, used via AtomicString::add to avoid thread-specific access.
+
</ins><span class="cx"> 2014-03-20  Gabor Rapcsanyi  &lt;rgabor@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [ARM64] Fix assembler build issues and add cacheFlush support for Linux
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -844,6 +844,7 @@
</span><span class="cx">                 860161E40F3A83C100F84710 /* MacroAssemblerX86.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 860161E50F3A83C100F84710 /* MacroAssemblerX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                8606DDEA18DA44AB00A383D0 /* IdentifierInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 860BD801148EA6F200112B2F /* Intrinsic.h in Headers */ = {isa = PBXBuildFile; fileRef = 86BF642A148DB2B5004DE36A /* Intrinsic.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 8612E4CD152389EC00C836BE /* MatchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 8612E4CB1522918400C836BE /* MatchResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 86158AB3155C8B4000B45C9C /* PropertyName.h in Headers */ = {isa = PBXBuildFile; fileRef = 86158AB2155C8B3F00B45C9C /* PropertyName.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2363,6 +2364,7 @@
</span><span class="cx">                 8603CEF214C7546400AE59E3 /* CodeProfiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeProfiling.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 8603CEF314C7546400AE59E3 /* CodeProfiling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeProfiling.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChangeLog; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdentifierInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 8612E4CB1522918400C836BE /* MatchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchResult.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 86158AB2155C8B3F00B45C9C /* PropertyName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PropertyName.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 862553CE16136AA5009F17D0 /* JSProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSProxy.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3950,6 +3952,7 @@
</span><span class="cx">                                 BC337BDE0E1AF0B80076918A /* GetterSetter.h */,
</span><span class="cx">                                 933A349D038AE80F008635CE /* Identifier.cpp */,
</span><span class="cx">                                 933A349A038AE7C6008635CE /* Identifier.h */,
</span><ins>+                                8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */,
</ins><span class="cx">                                 0FB7F38D15ED8E3800F167B2 /* IndexingHeader.h */,
</span><span class="cx">                                 0FB7F38E15ED8E3800F167B2 /* IndexingHeaderInlines.h */,
</span><span class="cx">                                 0F13E04C16164A1B00DC8DE7 /* IndexingType.cpp */,
</span><span class="lines">@@ -5309,6 +5312,7 @@
</span><span class="cx">                                 A53243981856A489002ED692 /* InspectorJS.json in Headers */,
</span><span class="cx">                                 A532438818568335002ED692 /* InspectorJSBackendDispatchers.h in Headers */,
</span><span class="cx">                                 A532438A18568335002ED692 /* InspectorJSFrontendDispatchers.h in Headers */,
</span><ins>+                                8606DDEA18DA44AB00A383D0 /* IdentifierInlines.h in Headers */,
</ins><span class="cx">                                 A532438C18568335002ED692 /* InspectorJSTypeBuilders.h in Headers */,
</span><span class="cx">                                 A50E4B6218809DD50068A46D /* InspectorRuntimeAgent.h in Headers */,
</span><span class="cx">                                 A55D93AC18514F7900400DED /* InspectorTypeBuilder.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSInjectedScriptHostPrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> #include &quot;GetterSetter.h&quot;
</span><span class="cx"> #include &quot;Identifier.h&quot;
</span><span class="cx"> #include &quot;InjectedScriptHost.h&quot;
</span><del>-#include &quot;JSCJSValueInlines.h&quot;
</del><ins>+#include &quot;JSCInlines.h&quot;
</ins><span class="cx"> #include &quot;JSFunction.h&quot;
</span><span class="cx"> #include &quot;JSInjectedScriptHost.h&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSJavaScriptCallFramePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #include &quot;Error.h&quot;
</span><span class="cx"> #include &quot;GetterSetter.h&quot;
</span><span class="cx"> #include &quot;Identifier.h&quot;
</span><del>-#include &quot;JSCJSValueInlines.h&quot;
</del><ins>+#include &quot;JSCInlines.h&quot;
</ins><span class="cx"> #include &quot;JSFunction.h&quot;
</span><span class="cx"> #include &quot;JSJavaScriptCallFrame.h&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterCallFrameh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/CallFrame.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/CallFrame.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/interpreter/CallFrame.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx">         JSValue exception() const { return vm().exception(); }
</span><span class="cx">         bool hadException() const { return !vm().exception().isEmpty(); }
</span><span class="cx"> 
</span><ins>+        IdentifierTable&amp; atomicStringTable() const { return vm().atomicStringTable(); }
</ins><span class="cx">         const CommonIdentifiers&amp; propertyNames() const { return *vm().propertyNames; }
</span><span class="cx">         const MarkedArgumentBuffer&amp; emptyList() const { return *vm().emptyList; }
</span><span class="cx">         Interpreter* interpreter() { return vm().interpreter; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeConsolePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -29,11 +29,10 @@
</span><span class="cx"> #include &quot;ConsoleClient.h&quot;
</span><span class="cx"> #include &quot;Error.h&quot;
</span><span class="cx"> #include &quot;ExceptionHelpers.h&quot;
</span><del>-#include &quot;JSCJSValueInlines.h&quot;
</del><ins>+#include &quot;JSCInlines.h&quot;
</ins><span class="cx"> #include &quot;JSConsole.h&quot;
</span><span class="cx"> #include &quot;ScriptArguments.h&quot;
</span><span class="cx"> #include &quot;ScriptCallStackFactory.h&quot;
</span><del>-#include &quot;StructureInlines.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIdentifiercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Identifier.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Identifier.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/Identifier.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include &lt;wtf/FastMalloc.h&gt;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/text/ASCIIFastPath.h&gt;
</span><ins>+#include &lt;wtf/text/AtomicStringTable.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/StringHash.h&gt;
</span><span class="cx"> 
</span><span class="cx"> using WTF::ThreadSpecific;
</span><span class="lines">@@ -48,62 +49,14 @@
</span><span class="cx">     delete table;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-struct IdentifierASCIIStringTranslator {
-    static unsigned hash(const LChar* c)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(c);
-    }
-
-    static bool equal(StringImpl* r, const LChar* s)
-    {
-        return Identifier::equal(r, s);
-    }
-
-    static void translate(StringImpl*&amp; location, const LChar* c, unsigned hash)
-    {
-        size_t length = strlen(reinterpret_cast&lt;const char*&gt;(c));
-        location = &amp;StringImpl::createFromLiteral(reinterpret_cast&lt;const char*&gt;(c), length).leakRef();
-        location-&gt;setHash(hash);
-    }
-};
-
-struct IdentifierLCharFromUCharTranslator {
-    static unsigned hash(const CharBuffer&lt;UChar&gt;&amp; buf)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
-    }
-    
-    static bool equal(StringImpl* str, const CharBuffer&lt;UChar&gt;&amp; buf)
-    {
-        return Identifier::equal(str, buf.s, buf.length);
-    }
-    
-    static void translate(StringImpl*&amp; location, const CharBuffer&lt;UChar&gt;&amp; buf, unsigned hash)
-    {
-        LChar* d;
-        StringImpl&amp; r = StringImpl::createUninitialized(buf.length, d).leakRef();
-        WTF::copyLCharsFromUCharSource(d, buf.s, buf.length);
-        r.setHash(hash);
-        location = &amp;r;
-    }
-};
-
</del><span class="cx"> PassRef&lt;StringImpl&gt; Identifier::add(VM* vm, const char* c)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(c);
</span><span class="cx">     ASSERT(c[0]);
</span><span class="cx">     if (!c[1])
</span><del>-        return add(vm, vm-&gt;smallStrings.singleCharacterStringRep(c[0]));
</del><ins>+        return *vm-&gt;smallStrings.singleCharacterStringRep(c[0]);
</ins><span class="cx"> 
</span><del>-    IdentifierTable&amp; identifierTable = *vm-&gt;identifierTable;
-
-    HashSet&lt;StringImpl*&gt;::AddResult addResult = identifierTable.add&lt;const LChar*, IdentifierASCIIStringTranslator&gt;(reinterpret_cast&lt;const LChar*&gt;(c));
-
-    // If the string is newly-translated, then we need to adopt it.
-    // The boolean in the pair tells us if that is so.
-    RefPtr&lt;StringImpl&gt; addedString = addResult.isNewEntry ? adoptRef(*addResult.iterator) : *addResult.iterator;
-
-    return addedString.releaseNonNull();
</del><ins>+    return *AtomicString::add(c);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassRef&lt;StringImpl&gt; Identifier::add(ExecState* exec, const char* c)
</span><span class="lines">@@ -117,44 +70,14 @@
</span><span class="cx">         UChar c = s[0];
</span><span class="cx">         ASSERT(c &lt;= 0xff);
</span><span class="cx">         if (canUseSingleCharacterString(c))
</span><del>-            return add(vm, vm-&gt;smallStrings.singleCharacterStringRep(c));
</del><ins>+            return *vm-&gt;smallStrings.singleCharacterStringRep(c);
</ins><span class="cx">     }
</span><del>-    
</del><span class="cx">     if (!length)
</span><span class="cx">         return *StringImpl::empty();
</span><del>-    CharBuffer&lt;UChar&gt; buf = { s, static_cast&lt;unsigned&gt;(length) };
-    HashSet&lt;StringImpl*&gt;::AddResult addResult = vm-&gt;identifierTable-&gt;add&lt;CharBuffer&lt;UChar&gt;, IdentifierLCharFromUCharTranslator &gt;(buf);
-    
-    // If the string is newly-translated, then we need to adopt it.
-    // The boolean in the pair tells us if that is so.
-    return addResult.isNewEntry ? adoptRef(**addResult.iterator) : **addResult.iterator;
-}
</del><span class="cx"> 
</span><del>-PassRef&lt;StringImpl&gt; Identifier::addSlowCase(VM* vm, StringImpl* r)
-{
-    if (r-&gt;isEmptyUnique())
-        return *r;
-    ASSERT(!r-&gt;isIdentifier());
-    // The empty &amp; null strings are static singletons, and static strings are handled
-    // in ::add() in the header, so we should never get here with a zero length string.
-    ASSERT(r-&gt;length());
-
-    if (r-&gt;length() == 1) {
-        UChar c = (*r)[0];
-        if (c &lt;= maxSingleCharacterString)
-            r = vm-&gt;smallStrings.singleCharacterStringRep(c);
-            if (r-&gt;isIdentifier())
-                return *r;
-    }
-
-    return **vm-&gt;identifierTable-&gt;add(r).iterator;
</del><ins>+    return *AtomicString::add(s, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRef&lt;StringImpl&gt; Identifier::addSlowCase(ExecState* exec, StringImpl* r)
-{
-    return addSlowCase(&amp;exec-&gt;vm(), r);
-}
-
</del><span class="cx"> Identifier Identifier::from(ExecState* exec, unsigned value)
</span><span class="cx"> {
</span><span class="cx">     return Identifier(exec, exec-&gt;vm().numericStrings.add(value));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIdentifierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Identifier.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Identifier.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/Identifier.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -36,21 +36,21 @@
</span><span class="cx">     public:
</span><span class="cx">         Identifier() { }
</span><span class="cx">         enum EmptyIdentifierFlag { EmptyIdentifier };
</span><del>-        Identifier(EmptyIdentifierFlag) : m_string(StringImpl::empty()) { }
</del><ins>+        Identifier(EmptyIdentifierFlag) : m_string(StringImpl::empty()) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
</ins><span class="cx"> 
</span><span class="cx">         // Only to be used with string literals.
</span><span class="cx">         template&lt;unsigned charactersCount&gt;
</span><del>-        Identifier(ExecState* exec, const char (&amp;characters)[charactersCount]) : m_string(add(exec, characters)) { }
</del><ins>+        Identifier(ExecState* exec, const char (&amp;characters)[charactersCount]) : m_string(add(exec, characters)) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
</ins><span class="cx">         template&lt;unsigned charactersCount&gt;
</span><del>-        Identifier(VM* vm, const char (&amp;characters)[charactersCount]) : m_string(add(vm, characters)) { }
</del><ins>+        Identifier(VM* vm, const char (&amp;characters)[charactersCount]) : m_string(add(vm, characters)) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
</ins><span class="cx"> 
</span><del>-        Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { }
-        Identifier(ExecState* exec, const String&amp; s) : m_string(add(exec, s.impl())) { }
</del><ins>+        Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
+        Identifier(ExecState* exec, const String&amp; s) : m_string(add(exec, s.impl())) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
</ins><span class="cx"> 
</span><del>-        Identifier(VM* vm, const LChar* s, int length) : m_string(add(vm, s, length)) { }
-        Identifier(VM* vm, const UChar* s, int length) : m_string(add(vm, s, length)) { }
-        Identifier(VM* vm, StringImpl* rep) : m_string(add(vm, rep)) { } 
-        Identifier(VM* vm, const String&amp; s) : m_string(add(vm, s.impl())) { }
</del><ins>+        Identifier(VM* vm, const LChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
+        Identifier(VM* vm, const UChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
+        Identifier(VM* vm, StringImpl* rep) : m_string(add(vm, rep)) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
+        Identifier(VM* vm, const String&amp; s) : m_string(add(vm, s.impl())) { ASSERT(m_string.impl()-&gt;isIdentifier()); }
</ins><span class="cx"> 
</span><span class="cx">         const String&amp; string() const { return m_string; }
</span><span class="cx">         StringImpl* impl() const { return m_string.impl(); }
</span><span class="lines">@@ -110,28 +110,9 @@
</span><span class="cx">         static PassRef&lt;StringImpl&gt; add8(VM*, const UChar*, int length);
</span><span class="cx">         template &lt;typename T&gt; ALWAYS_INLINE static bool canUseSingleCharacterString(T);
</span><span class="cx"> 
</span><del>-        static PassRef&lt;StringImpl&gt; add(ExecState* exec, StringImpl* r)
-        {
-#ifndef NDEBUG
-            checkCurrentIdentifierTable(exec);
-#endif
-            if (r-&gt;isIdentifier())
-                return *r;
-            return addSlowCase(exec, r);
-        }
-        static PassRef&lt;StringImpl&gt; add(VM* vm, StringImpl* r)
-        {
-#ifndef NDEBUG
-            checkCurrentIdentifierTable(vm);
-#endif
-            if (r-&gt;isIdentifier())
-                return *r;
-            return addSlowCase(vm, r);
-        }
</del><ins>+        static PassRef&lt;StringImpl&gt; add(ExecState*, StringImpl*);
+        static PassRef&lt;StringImpl&gt; add(VM*, StringImpl*);
</ins><span class="cx"> 
</span><del>-        JS_EXPORT_PRIVATE static PassRef&lt;StringImpl&gt; addSlowCase(ExecState*, StringImpl* r);
-        JS_EXPORT_PRIVATE static PassRef&lt;StringImpl&gt; addSlowCase(VM*, StringImpl* r);
-
</del><span class="cx">         JS_EXPORT_PRIVATE static void checkCurrentIdentifierTable(ExecState*);
</span><span class="cx">         JS_EXPORT_PRIVATE static void checkCurrentIdentifierTable(VM*);
</span><span class="cx">     };
</span><span class="lines">@@ -148,51 +129,17 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;typename T&gt;
</span><del>-    struct CharBuffer {
-        const T* s;
-        unsigned int length;
-    };
-    
-    template &lt;typename T&gt;
-    struct IdentifierCharBufferTranslator {
-        static unsigned hash(const CharBuffer&lt;T&gt;&amp; buf)
-        {
-            return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
-        }
-        
-        static bool equal(StringImpl* str, const CharBuffer&lt;T&gt;&amp; buf)
-        {
-            return Identifier::equal(str, buf.s, buf.length);
-        }
-
-        static void translate(StringImpl*&amp; location, const CharBuffer&lt;T&gt;&amp; buf, unsigned hash)
-        {
-            T* d;
-            StringImpl&amp; r = StringImpl::createUninitialized(buf.length, d).leakRef();
-            for (unsigned i = 0; i != buf.length; i++)
-                d[i] = buf.s[i];
-            r.setHash(hash);
-            location = &amp;r;
-        }
-    };
-
-    template &lt;typename T&gt;
</del><span class="cx">     PassRef&lt;StringImpl&gt; Identifier::add(VM* vm, const T* s, int length)
</span><span class="cx">     {
</span><span class="cx">         if (length == 1) {
</span><span class="cx">             T c = s[0];
</span><span class="cx">             if (canUseSingleCharacterString(c))
</span><del>-                return add(vm, vm-&gt;smallStrings.singleCharacterStringRep(c));
</del><ins>+                return *vm-&gt;smallStrings.singleCharacterStringRep(c);
</ins><span class="cx">         }
</span><del>-        
</del><span class="cx">         if (!length)
</span><span class="cx">             return *StringImpl::empty();
</span><del>-        CharBuffer&lt;T&gt; buf = { s, static_cast&lt;unsigned&gt;(length) };
-        HashSet&lt;StringImpl*&gt;::AddResult addResult = vm-&gt;identifierTable-&gt;add&lt;CharBuffer&lt;T&gt;, IdentifierCharBufferTranslator&lt;T&gt;&gt;(buf);
</del><span class="cx">         
</span><del>-        // If the string is newly-translated, then we need to adopt it.
-        // The boolean in the pair tells us if that is so.
-        return addResult.isNewEntry ? adoptRef(**addResult.iterator) : **addResult.iterator;
</del><ins>+        return *AtomicString::add(s, length);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inline bool operator==(const Identifier&amp; a, const Identifier&amp; b)
</span><span class="lines">@@ -256,14 +203,6 @@
</span><span class="cx">     typedef HashMap&lt;RefPtr&lt;StringImpl&gt;, int, IdentifierRepHash, HashTraits&lt;RefPtr&lt;StringImpl&gt;&gt;, IdentifierMapIndexHashTraits&gt; IdentifierMap;
</span><span class="cx">     typedef HashMap&lt;StringImpl*, int, IdentifierRepHash, HashTraits&lt;StringImpl*&gt;, IdentifierMapIndexHashTraits&gt; BorrowedIdentifierMap;
</span><span class="cx"> 
</span><del>-    template&lt;typename U, typename V&gt;
-    HashSet&lt;StringImpl*&gt;::AddResult IdentifierTable::add(U value)
-    {
-        HashSet&lt;StringImpl*&gt;::AddResult result = m_table.add&lt;V&gt;(value);
-        (*result.iterator)-&gt;setIsIdentifier(true);
-        return result;
-    }
-
</del><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIdentifierInlinesh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/IdentifierInlines.h (0 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/IdentifierInlines.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/IdentifierInlines.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * 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. ``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
+ * 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. 
+ */
+
+#ifndef IdentifierInlines_h
+#define IdentifierInlines_h
+
+#include &quot;CallFrame.h&quot;
+#include &quot;Identifier.h&quot;
+
+namespace JSC  {
+
+inline PassRef&lt;StringImpl&gt; Identifier::add(ExecState* exec, StringImpl* r)
+{
+#ifndef NDEBUG
+    checkCurrentIdentifierTable(exec);
+#endif
+    return *AtomicString::addWithStringTableProvider(*exec, r);
+}
+inline PassRef&lt;StringImpl&gt; Identifier::add(VM* vm, StringImpl* r)
+{
+#ifndef NDEBUG
+    checkCurrentIdentifierTable(vm);
+#endif
+    return *AtomicString::addWithStringTableProvider(*vm, r);
+}
+
+} // namespace JSC
+
+#endif // IdentifierInlines_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSCInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSCInlines.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSCInlines.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/JSCInlines.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include &quot;CallFrameInlines.h&quot;
</span><span class="cx"> #include &quot;ExceptionHelpers.h&quot;
</span><span class="cx"> #include &quot;GCIncomingRefCountedInlines.h&quot;
</span><ins>+#include &quot;IdentifierInlines.h&quot;
</ins><span class="cx"> #include &quot;Interpreter.h&quot;
</span><span class="cx"> #include &quot;JSArrayBufferViewInlines.h&quot;
</span><span class="cx"> #include &quot;JSCJSValueInlines.h&quot;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSLockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSLock.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSLock.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/JSLock.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/ThreadSafeRefCounted.h&gt;
</span><ins>+#include &lt;wtf/WTFThreadData.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -49,7 +50,6 @@
</span><span class="cx">     // DropAllLocks object takes care to release the JSLock only if your
</span><span class="cx">     // thread acquired it to begin with.
</span><span class="cx"> 
</span><del>-    class IdentifierTable;
</del><span class="cx">     class ExecState;
</span><span class="cx">     class VM;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimePropertyNameArraycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -21,8 +21,8 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;PropertyNameArray.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;JSCInlines.h&quot;
</ins><span class="cx"> #include &quot;JSObject.h&quot;
</span><del>-
</del><span class="cx"> #include &quot;Structure.h&quot;
</span><span class="cx"> #include &quot;StructureChain.h&quot;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeSmallStringscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     RefPtr&lt;StringImpl&gt; baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer);
</span><span class="cx">     for (unsigned i = 0; i &lt; singleCharacterStringCount; ++i) {
</span><span class="cx">         characterBuffer[i] = i;
</span><del>-        m_reps[i] = StringImpl::createSubstringSharingImpl(baseString, i, 1);
</del><ins>+        m_reps[i] = AtomicString::add(PassRefPtr&lt;StringImpl&gt;(StringImpl::createSubstringSharingImpl(baseString, i, 1)).get());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -195,7 +195,7 @@
</span><span class="cx">     , promiseConstructorTable(adoptPtr(new HashTable(JSC::promiseConstructorTable)))
</span><span class="cx"> #endif
</span><span class="cx">     , identifierTable(vmType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
</span><del>-    , propertyNames(new CommonIdentifiers(this))
</del><ins>+    , propertyNames(nullptr)
</ins><span class="cx">     , emptyList(new MarkedArgumentBuffer)
</span><span class="cx">     , parserArena(adoptPtr(new ParserArena))
</span><span class="cx">     , keywords(adoptPtr(new Keywords(*this)))
</span><span class="lines">@@ -246,6 +246,7 @@
</span><span class="cx">     // Need to be careful to keep everything consistent here
</span><span class="cx">     JSLockHolder lock(this);
</span><span class="cx">     IdentifierTable* existingEntryIdentifierTable = wtfThreadData().setCurrentIdentifierTable(identifierTable);
</span><ins>+    propertyNames = new CommonIdentifiers(this);
</ins><span class="cx">     structureStructure.set(*this, Structure::createStructure(*this));
</span><span class="cx">     structureRareDataStructure.set(*this, StructureRareData::createStructure(*this, 0, jsNull()));
</span><span class="cx">     debuggerActivationStructure.set(*this, DebuggerActivation::createStructure(*this, 0, jsNull()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -77,7 +77,6 @@
</span><span class="cx">     class ExecState;
</span><span class="cx">     class HandleStack;
</span><span class="cx">     class Identifier;
</span><del>-    class IdentifierTable;
</del><span class="cx">     class Interpreter;
</span><span class="cx">     class JSGlobalObject;
</span><span class="cx">     class JSObject;
</span><span class="lines">@@ -296,6 +295,8 @@
</span><span class="cx">         DateInstanceCache dateInstanceCache;
</span><span class="cx">         WTF::SimpleStats machineCodeBytesPerBytecodeWordForBaselineJIT;
</span><span class="cx"> 
</span><ins>+        IdentifierTable&amp; atomicStringTable() const { return *identifierTable; }
+
</ins><span class="cx">         void setInDefineOwnProperty(bool inDefineOwnProperty)
</span><span class="cx">         {
</span><span class="cx">             m_inDefineOwnProperty = inDefineOwnProperty;
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/ChangeLog        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2014-03-20  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        Merge AtomicString, Identifier
+        https://bugs.webkit.org/show_bug.cgi?id=128624
+
+        Reviewed by Geoff Garen.
+
+        WTF::StringImpl currently supports two uniquing mechanism - AtomicString and
+        Identifer - that is one too many.
+
+        Remove Identifier in favour of AtomicString. Identifier had two interesting
+        mechanisms that we preserve.
+
+        (1) JSC API VMs each get their own string table, switch the string table on
+            API entry/exit.
+        (2) JSC caches a pointer to the string table on the VM to avoid a thread
+            specific access. Adds a new AtomicString::add method to support this.
+
+        * wtf/WTFThreadData.cpp:
+        (WTF::WTFThreadData::WTFThreadData):
+            - remove allocation of IdentifierTable.
+        (WTF::WTFThreadData::~WTFThreadData):
+            - remove deletion of IdentifierTable.
+        * wtf/WTFThreadData.h:
+        (WTF::WTFThreadData::atomicStringTable):
+            - table is now switched by JSC API, return the current table.
+        (WTF::WTFThreadData::currentIdentifierTable):
+            - now returns the current AtomicStringTable.
+        (WTF::WTFThreadData::setCurrentIdentifierTable):
+            - now sets the current AtomicStringTable.
+        (WTF::WTFThreadData::resetCurrentIdentifierTable):
+            - now resets the AtomicStringTable.
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::addSlowCase):
+            - add without thread-specific access to access string table.
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::addWithStringTableProvider):
+            - add without thread-specific access (used by JSC, string table provided by VM or ExecState).
+        * wtf/text/AtomicStringTable.cpp:
+        (WTF::AtomicStringTable::create):
+            - renamed m_atomicStringTable -&gt; m_defaultAtomicStringTable.
+        (WTF::AtomicStringTable::~AtomicStringTable):
+        (WTF::AtomicStringTable::destroy):
+            - clearing of table moved from AtomicStringTable::destroy to destructor.
+        * wtf/text/AtomicStringTable.h:
+            - added destructor.
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::~StringImpl):
+            - Identifers no longer exist; no need to remove them from IdentifierTable.
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::StringImpl):
+            - removed s_hashFlagIsIdentifier.
+        (WTF::StringImpl::flagIsIdentifier):
+            - s_hashFlagIsIdentifier -&gt; s_hashFlagIsAtomic.
+        (WTF::StringImpl::isIdentifier):
+            - now synonymous to isAtomic().
+        * wtf/text/StringStatics.cpp:
+        (WTF::StringImpl::hashAndFlagsForEmptyUnique):
+            - removed s_hashFlagIsIdentifier.
+
</ins><span class="cx"> 2014-03-20  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed Clang build fix for the GTK port after r165952.
</span></span></pre></div>
<a id="trunkSourceWTFwtfWTFThreadDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/WTFThreadData.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WTFThreadData.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/WTFThreadData.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -41,12 +41,9 @@
</span><span class="cx"> 
</span><span class="cx"> WTFThreadData::WTFThreadData()
</span><span class="cx">     : m_apiData(0)
</span><del>-    , m_atomicStringTable(0)
</del><ins>+    , m_currentAtomicStringTable(0)
+    , m_defaultAtomicStringTable(0)
</ins><span class="cx">     , m_atomicStringTableDestructor(0)
</span><del>-#if !USE(WEB_THREAD)
-    , m_defaultIdentifierTable(new JSC::IdentifierTable())
-    , m_currentIdentifierTable(m_defaultIdentifierTable)
-#endif
</del><span class="cx">     , m_stackBounds(StackBounds::currentThreadStackBounds())
</span><span class="cx"> #if ENABLE(STACK_STATS)
</span><span class="cx">     , m_stackStats()
</span><span class="lines">@@ -54,23 +51,14 @@
</span><span class="cx">     , m_savedStackPointerAtVMEntry(0)
</span><span class="cx">     , m_savedLastStackTop(stack().origin())
</span><span class="cx"> {
</span><del>-#if USE(WEB_THREAD)
-    static JSC::IdentifierTable* sharedIdentifierTable = new JSC::IdentifierTable();
-    if (pthread_main_np() || isWebThread())
-        m_defaultIdentifierTable = sharedIdentifierTable;
-    else
-        m_defaultIdentifierTable = new JSC::IdentifierTable();
-
-    m_currentIdentifierTable = m_defaultIdentifierTable;
-#endif
</del><span class="cx">     AtomicStringTable::create(*this);
</span><ins>+    m_currentAtomicStringTable = m_defaultAtomicStringTable;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WTFThreadData::~WTFThreadData()
</span><span class="cx"> {
</span><span class="cx">     if (m_atomicStringTableDestructor)
</span><del>-        m_atomicStringTableDestructor(m_atomicStringTable);
-    delete m_defaultIdentifierTable;
</del><ins>+        m_atomicStringTableDestructor(m_defaultAtomicStringTable);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(PTHREAD_GETSPECIFIC_DIRECT)
</span><span class="lines">@@ -86,21 +74,3 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WTF
</span><del>-
-namespace JSC {
-
-IdentifierTable::~IdentifierTable()
-{
-    HashSet&lt;StringImpl*&gt;::iterator end = m_table.end();
-    for (HashSet&lt;StringImpl*&gt;::iterator iter = m_table.begin(); iter != end; ++iter)
-        (*iter)-&gt;setIsIdentifier(false);
-}
-
-HashSet&lt;StringImpl*&gt;::AddResult IdentifierTable::add(StringImpl* value)
-{
-    HashSet&lt;StringImpl*&gt;::AddResult result = m_table.add(value);
-    (*result.iterator)-&gt;setIsIdentifier(true);
-    return result;
-}
-
-} // namespace JSC
</del></span></pre></div>
<a id="trunkSourceWTFwtfWTFThreadDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/WTFThreadData.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/WTFThreadData.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/WTFThreadData.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -49,28 +49,10 @@
</span><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// FIXME: This is a temporary layering violation until we move more of the string code from JavaScriptCore to WTF.
-namespace JSC {
-
-class IdentifierTable {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    WTF_EXPORT_PRIVATE ~IdentifierTable();
-
-    WTF_EXPORT_PRIVATE HashSet&lt;StringImpl*&gt;::AddResult add(StringImpl*);
-    template&lt;typename U, typename V&gt; HashSet&lt;StringImpl*&gt;::AddResult add(U);
-
-    bool remove(StringImpl* identifier) { return m_table.remove(identifier); }
-
-private:
-    HashSet&lt;StringImpl*&gt; m_table;
-};
-
-}
-
</del><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><span class="cx"> class AtomicStringTable;
</span><ins>+typedef AtomicStringTable IdentifierTable;
</ins><span class="cx"> 
</span><span class="cx"> typedef void (*AtomicStringTableDestructor)(AtomicStringTable*);
</span><span class="cx"> 
</span><span class="lines">@@ -82,24 +64,24 @@
</span><span class="cx"> 
</span><span class="cx">     AtomicStringTable* atomicStringTable()
</span><span class="cx">     {
</span><del>-        return m_atomicStringTable;
</del><ins>+        return m_currentAtomicStringTable;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    JSC::IdentifierTable* currentIdentifierTable()
</del><ins>+    IdentifierTable* currentIdentifierTable()
</ins><span class="cx">     {
</span><del>-        return m_currentIdentifierTable;
</del><ins>+        return m_currentAtomicStringTable;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    JSC::IdentifierTable* setCurrentIdentifierTable(JSC::IdentifierTable* identifierTable)
</del><ins>+    IdentifierTable* setCurrentIdentifierTable(IdentifierTable* identifierTable)
</ins><span class="cx">     {
</span><del>-        JSC::IdentifierTable* oldIdentifierTable = m_currentIdentifierTable;
-        m_currentIdentifierTable = identifierTable;
</del><ins>+        IdentifierTable* oldIdentifierTable = m_currentAtomicStringTable;
+        m_currentAtomicStringTable = identifierTable;
</ins><span class="cx">         return oldIdentifierTable;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void resetCurrentIdentifierTable()
</span><span class="cx">     {
</span><del>-        m_currentIdentifierTable = m_defaultIdentifierTable;
</del><ins>+        m_currentAtomicStringTable = m_defaultAtomicStringTable;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     const StackBounds&amp; stack()
</span><span class="lines">@@ -142,11 +124,10 @@
</span><span class="cx">     void* m_apiData;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    AtomicStringTable* m_atomicStringTable;
</del><ins>+    AtomicStringTable* m_currentAtomicStringTable;
+    AtomicStringTable* m_defaultAtomicStringTable;
</ins><span class="cx">     AtomicStringTableDestructor m_atomicStringTableDestructor;
</span><span class="cx"> 
</span><del>-    JSC::IdentifierTable* m_defaultIdentifierTable;
-    JSC::IdentifierTable* m_currentIdentifierTable;
</del><span class="cx">     StackBounds m_stackBounds;
</span><span class="cx"> #if ENABLE(STACK_STATS)
</span><span class="cx">     StackStats::PerThreadStats m_stackStats;
</span><span class="lines">@@ -188,5 +169,6 @@
</span><span class="cx"> 
</span><span class="cx"> using WTF::WTFThreadData;
</span><span class="cx"> using WTF::wtfThreadData;
</span><ins>+using WTF::IdentifierTable;
</ins><span class="cx"> 
</span><span class="cx"> #endif // WTFThreadData_h
</span></span></pre></div>
<a id="trunkSourceWTFwtftextAtomicStringcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/AtomicString.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -414,6 +414,24 @@
</span><span class="cx">     return *addResult.iterator;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;StringImpl&gt; AtomicString::addSlowCase(AtomicStringTable&amp; stringTable, StringImpl* string)
+{
+    if (!string-&gt;length())
+        return StringImpl::empty();
+
+    ASSERT_WITH_MESSAGE(!string-&gt;isAtomic(), &quot;AtomicString should not hit the slow case if the string is already atomic.&quot;);
+
+    AtomicStringTableLocker locker;
+    HashSet&lt;StringImpl*&gt;::AddResult addResult = stringTable.table().add(string);
+
+    if (addResult.isNewEntry) {
+        ASSERT(*addResult.iterator == string);
+        string-&gt;setIsAtomic(true);
+    }
+
+    return *addResult.iterator;
+}
+
</ins><span class="cx"> template&lt;typename CharacterType&gt;
</span><span class="cx"> static inline HashSet&lt;StringImpl*&gt;::iterator findString(const StringImpl* stringImpl)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWTFwtftextAtomicStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/AtomicString.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/AtomicString.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/AtomicString.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><ins>+class AtomicStringTable;
</ins><span class="cx"> struct AtomicStringHash;
</span><span class="cx"> 
</span><span class="cx"> class AtomicString {
</span><span class="lines">@@ -168,12 +169,6 @@
</span><span class="cx">     void show() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-private:
-    // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
-    AtomicString(ASCIILiteral);
-
-    String m_string;
-    
</del><span class="cx">     WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; add(const LChar*);
</span><span class="cx">     ALWAYS_INLINE static PassRefPtr&lt;StringImpl&gt; add(const char* s) { return add(reinterpret_cast&lt;const LChar*&gt;(s)); };
</span><span class="cx">     WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; add(const LChar*, unsigned length);
</span><span class="lines">@@ -191,11 +186,29 @@
</span><span class="cx">         return addSlowCase(string);
</span><span class="cx">     }
</span><span class="cx">     WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; addFromLiteralData(const char* characters, unsigned length);
</span><del>-    WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; addSlowCase(StringImpl*);
</del><span class="cx"> #if USE(CF)
</span><span class="cx">     WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; add(CFStringRef);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    template&lt;typename StringTableProvider&gt;
+    ALWAYS_INLINE static PassRefPtr&lt;StringImpl&gt; addWithStringTableProvider(StringTableProvider&amp; stringTableProvider, StringImpl* string)
+    {
+        if (!string || string-&gt;isAtomic()) {
+            ASSERT_WITH_MESSAGE(!string || !string-&gt;length() || isInAtomicStringTable(string), &quot;The atomic string comes from an other thread!&quot;);
+            return string;
+        }
+        return addSlowCase(stringTableProvider.atomicStringTable(), string);
+    }
+
+private:
+    // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
+    AtomicString(ASCIILiteral);
+
+    String m_string;
+    
+    WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; addSlowCase(StringImpl*);
+    WTF_EXPORT_STRING_API static PassRefPtr&lt;StringImpl&gt; addSlowCase(AtomicStringTable&amp;, StringImpl*);
+
</ins><span class="cx">     WTF_EXPORT_STRING_API static AtomicStringImpl* findSlowCase(StringImpl&amp;);
</span><span class="cx">     WTF_EXPORT_STRING_API static AtomicString fromUTF8Internal(const char*, const char*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtftextAtomicStringTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/AtomicStringTable.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/AtomicStringTable.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/AtomicStringTable.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -37,25 +37,28 @@
</span><span class="cx"> 
</span><span class="cx">     bool currentThreadIsWebThread = isWebThread();
</span><span class="cx">     if (currentThreadIsWebThread || isUIThread())
</span><del>-        data.m_atomicStringTable = sharedStringTable;
</del><ins>+        data.m_defaultAtomicStringTable = sharedStringTable;
</ins><span class="cx">     else
</span><del>-        data.m_atomicStringTable = new AtomicStringTable;
</del><ins>+        data.m_defaultAtomicStringTable = new AtomicStringTable;
</ins><span class="cx"> 
</span><span class="cx">     // We do the following so that its destruction happens only
</span><span class="cx">     // once - on the main UI thread.
</span><span class="cx">     if (!currentThreadIsWebThread)
</span><span class="cx">         data.m_atomicStringTableDestructor = AtomicStringTable::destroy;
</span><span class="cx"> #else
</span><del>-    data.m_atomicStringTable = new AtomicStringTable;
</del><ins>+    data.m_defaultAtomicStringTable = new AtomicStringTable;
</ins><span class="cx">     data.m_atomicStringTableDestructor = AtomicStringTable::destroy;
</span><span class="cx"> #endif // USE(WEB_THREAD)
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+AtomicStringTable::~AtomicStringTable()
+{
+    for (auto* string : m_table)
+        string-&gt;setIsAtomic(false);
+}
+
</ins><span class="cx"> void AtomicStringTable::destroy(AtomicStringTable* table)
</span><span class="cx"> {
</span><del>-    HashSet&lt;StringImpl*&gt;::iterator end = table-&gt;m_table.end();
-    for (HashSet&lt;StringImpl*&gt;::iterator iter = table-&gt;m_table.begin(); iter != end; ++iter)
-        (*iter)-&gt;setIsAtomic(false);
</del><span class="cx">     delete table;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtftextAtomicStringTableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/AtomicStringTable.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/AtomicStringTable.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/AtomicStringTable.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> class AtomicStringTable {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><ins>+    WTF_EXPORT_PRIVATE ~AtomicStringTable();
</ins><span class="cx"> 
</span><span class="cx">     static void create(WTFThreadData&amp;);
</span><span class="cx">     HashSet&lt;StringImpl*&gt;&amp; table() { return m_table; }
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -115,10 +115,6 @@
</span><span class="cx"> 
</span><span class="cx">     if (isAtomic() &amp;&amp; m_length)
</span><span class="cx">         AtomicString::remove(this);
</span><del>-    if (isIdentifier() &amp;&amp; m_length) {
-        if (!wtfThreadData().currentIdentifierTable()-&gt;remove(this))
-            CRASH();
-    }
</del><span class="cx"> 
</span><span class="cx">     BufferOwnership ownership = bufferOwnership();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.h (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.h        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/StringImpl.h        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -44,14 +44,9 @@
</span><span class="cx"> @class NSString;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// FIXME: This is a temporary layering violation while we move string code to WTF.
-// Landing the file moves in one patch, will follow on with patches to change the namespaces.
</del><span class="cx"> namespace JSC {
</span><del>-struct IdentifierASCIIStringTranslator;
</del><span class="cx"> namespace LLInt { class Data; }
</span><span class="cx"> class LLIntOffsetsExtractor;
</span><del>-template &lt;typename T&gt; struct IdentifierCharBufferTranslator;
-struct IdentifierLCharFromUCharTranslator;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="lines">@@ -132,10 +127,6 @@
</span><span class="cx"> 
</span><span class="cx"> class StringImpl {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(StringImpl); WTF_MAKE_FAST_ALLOCATED;
</span><del>-    friend struct JSC::IdentifierASCIIStringTranslator;
-    friend struct JSC::IdentifierCharBufferTranslator&lt;LChar&gt;;
-    friend struct JSC::IdentifierCharBufferTranslator&lt;UChar&gt;;
-    friend struct JSC::IdentifierLCharFromUCharTranslator;
</del><span class="cx">     friend struct WTF::CStringTranslator;
</span><span class="cx">     template&lt;typename CharacterType&gt; friend struct WTF::HashAndCharactersTranslator;
</span><span class="cx">     friend struct WTF::HashAndUTF8CharactersTranslator;
</span><span class="lines">@@ -163,7 +154,7 @@
</span><span class="cx">         : m_refCount(s_refCountFlagIsStaticString)
</span><span class="cx">         , m_length(0)
</span><span class="cx">         , m_data8(reinterpret_cast&lt;const LChar*&gt;(&amp;m_length))
</span><del>-        , m_hashAndFlags(s_hashFlag8BitBuffer | s_hashFlagIsIdentifier | s_hashFlagIsAtomic | BufferOwned)
</del><ins>+        , m_hashAndFlags(s_hashFlag8BitBuffer | s_hashFlagIsAtomic | BufferOwned)
</ins><span class="cx">     {
</span><span class="cx">         // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
</span><span class="cx">         // with impunity. The empty string is special because it is never entered into
</span><span class="lines">@@ -404,7 +395,7 @@
</span><span class="cx"> 
</span><span class="cx">     static unsigned flagsOffset() { return OBJECT_OFFSETOF(StringImpl, m_hashAndFlags); }
</span><span class="cx">     static unsigned flagIs8Bit() { return s_hashFlag8BitBuffer; }
</span><del>-    static unsigned flagIsIdentifier() { return s_hashFlagIsIdentifier; }
</del><ins>+    static unsigned flagIsIdentifier() { return s_hashFlagIsAtomic; }
</ins><span class="cx">     static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data8); }
</span><span class="cx"> 
</span><span class="cx">     template&lt;typename CharType, size_t inlineCapacity, typename OverflowHandler&gt;
</span><span class="lines">@@ -472,18 +463,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool has16BitShadow() const { return m_hashAndFlags &amp; s_hashFlagHas16BitShadow; }
</span><span class="cx">     WTF_EXPORT_STRING_API void upconvertCharacters(unsigned, unsigned) const;
</span><del>-    bool isIdentifier() const { return m_hashAndFlags &amp; s_hashFlagIsIdentifier; }
-    bool isIdentifierOrUnique() const { return isIdentifier() || isEmptyUnique(); }
-    void setIsIdentifier(bool isIdentifier)
-    {
-        ASSERT(!isStatic());
-        ASSERT(!isEmptyUnique());
-        if (isIdentifier)
-            m_hashAndFlags |= s_hashFlagIsIdentifier;
-        else
-            m_hashAndFlags &amp;= ~s_hashFlagIsIdentifier;
-    }
-
</del><ins>+    bool isIdentifier() const { return isAtomic(); }
</ins><span class="cx">     bool isEmptyUnique() const
</span><span class="cx">     {
</span><span class="cx">         return !length() &amp;&amp; !isStatic();
</span><span class="lines">@@ -814,7 +794,6 @@
</span><span class="cx">     static const unsigned s_hashFlag8BitBuffer = 1u &lt;&lt; 5;
</span><span class="cx">     static const unsigned s_hashFlagIsAtomic = 1u &lt;&lt; 4;
</span><span class="cx">     static const unsigned s_hashFlagDidReportCost = 1u &lt;&lt; 3;
</span><del>-    static const unsigned s_hashFlagIsIdentifier = 1u &lt;&lt; 2;
</del><span class="cx">     static const unsigned s_hashMaskBufferOwnership = 1u | (1u &lt;&lt; 1);
</span><span class="cx"> 
</span><span class="cx"> #ifdef STRING_STATS
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringStaticscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringStatics.cpp (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringStatics.cpp        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WTF/wtf/text/StringStatics.cpp        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> // lead to lots of conflicts.
</span><span class="cx"> unsigned StringImpl::hashAndFlagsForEmptyUnique()
</span><span class="cx"> {
</span><del>-    static unsigned s_nextHashAndFlagsForEmptyUnique = BufferInternal | s_hashFlag8BitBuffer | s_hashFlagIsIdentifier | s_hashFlagIsAtomic;
</del><ins>+    static unsigned s_nextHashAndFlagsForEmptyUnique = BufferInternal | s_hashFlag8BitBuffer | s_hashFlagIsAtomic;
</ins><span class="cx">     s_nextHashAndFlagsForEmptyUnique += 1 &lt;&lt; s_flagCount;
</span><span class="cx">     s_nextHashAndFlagsForEmptyUnique |= 1 &lt;&lt; 31;
</span><span class="cx">     return s_nextHashAndFlagsForEmptyUnique;
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WebKit/ChangeLog        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-03-20  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        Merge AtomicString, Identifier
+        https://bugs.webkit.org/show_bug.cgi?id=128624
+
+        Reviewed by Geoff Garen.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
+            - exports no longer needed.
+
</ins><span class="cx"> 2014-03-20  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r165962.
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojWebKitExportGeneratorWebKitExportsdefin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (165981 => 165982)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in        2014-03-20 18:49:59 UTC (rev 165981)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in        2014-03-20 19:26:31 UTC (rev 165982)
</span><span class="lines">@@ -174,8 +174,6 @@
</span><span class="cx">         symbolWithPointer(?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z, ?absoluteBoundingBoxRect@RenderObject@WebCore@@QEBA?AVIntRect@2@_N@Z)
</span><span class="cx">         symbolWithPointer(?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ, ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QEBA?AVIntRect@2@XZ)
</span><span class="cx">         symbolWithPointer(?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ, ?description@DocumentMarker@WebCore@@QEBAAEBVString@WTF@@XZ)
</span><del>-        symbolWithPointer(?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z, ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PEBD@Z)
-        symbolWithPointer(?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z, ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PEBE@Z)
</del><span class="cx">         symbolWithPointer(?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z, ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PEAVStringImpl@2@@Z)
</span><span class="cx">         symbolWithPointer(?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z, ?cacheDOMStructure@WebCore@@YAPEAVStructure@JSC@@PEAVJSDOMGlobalObject@1@PEAV23@PEBUClassInfo@3@@Z)
</span><span class="cx">         symbolWithPointer(?childItemWithTarget@HistoryItem@WebCore@@QBEPAV12@ABVString@WTF@@@Z, ?childItemWithTarget@HistoryItem@WebCore@@QEBAPEAV12@AEBVString@WTF@@@Z)
</span><span class="lines">@@ -406,7 +404,6 @@
</span><span class="cx">         symbolWithPointer(??1StyleSheetContents@WebCore@@QAE@XZ, ??1StyleSheetContents@WebCore@@QEAA@XZ)
</span><span class="cx">         symbolWithPointer(?pauseAnimationAtTime@AnimationController@WebCore@@QAE_NPAVRenderElement@2@ABVAtomicString@WTF@@N@Z, ?pauseAnimationAtTime@AnimationController@WebCore@@QEAA_NPEAVRenderElement@2@AEBVAtomicString@WTF@@N@Z)
</span><span class="cx">         symbolWithPointer(?pauseTransitionAtTime@AnimationController@WebCore@@QAE_NPAVRenderElement@2@ABVString@WTF@@N@Z, ?pauseTransitionAtTime@AnimationController@WebCore@@QEAA_NPEAVRenderElement@2@AEBVString@WTF@@N@Z)
</span><del>-        symbolWithPointer(?addFromLiteralData@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBDI@Z, ?addFromLiteralData@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PEBDI@Z)
</del><span class="cx">         symbolWithPointer(?memoryCache@WebCore@@YAPAVMemoryCache@1@XZ, ?memoryCache@WebCore@@YAPEAVMemoryCache@1@XZ)
</span><span class="cx">         symbolWithPointer(?resourceForURL@MemoryCache@WebCore@@QAEPAVCachedResource@2@ABVURL@2@@Z, ?resourceForURL@MemoryCache@WebCore@@QEAAPEAVCachedResource@2@AEBVURL@2@@Z)
</span><span class="cx">         symbolWithPointer(?nonFastScrollableRects@Page@WebCore@@QAE?AV?$PassRefPtr@VClientRectList@WebCore@@@WTF@@PBVFrame@2@@Z, ?nonFastScrollableRects@Page@WebCore@@QEAA?AV?$PassRefPtr@VClientRectList@WebCore@@@WTF@@PEBVFrame@2@@Z)
</span></span></pre>
</div>
</div>

</body>
</html>