<!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>[165152] 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/165152">165152</a></dd>
<dt>Author</dt> <dd>barraclough@apple.com</dd>
<dt>Date</dt> <dd>2014-03-05 17:46:21 -0800 (Wed, 05 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/JavaScriptCore: https://bugs.webkit.org/show_bug.cgi?id=128625
Add fast mapping from StringImpl to JSString

Unreviewed roll-out.

Reverting <a href="http://trac.webkit.org/projects/webkit/changeset/164347">r164347</a>, <a href="http://trac.webkit.org/projects/webkit/changeset/165054">r165054</a>, <a href="http://trac.webkit.org/projects/webkit/changeset/165066">r165066</a> - not clear the performance tradeoff was right.

* runtime/JSString.cpp:
* runtime/JSString.h:
* runtime/VM.cpp:
(JSC::VM::createLeaked):
* runtime/VM.h:

Source/WebCore: https://bugs.webkit.org/show_bug.cgi?id=128625
Add fast mapping from StringImpl to JSString

Unreviewed roll-out.

Reverting <a href="http://trac.webkit.org/projects/webkit/changeset/164347">r164347</a>, <a href="http://trac.webkit.org/projects/webkit/changeset/165054">r165054</a>, <a href="http://trac.webkit.org/projects/webkit/changeset/165066">r165066</a> - not clear the performance tradeoff was right.

* bindings/js/DOMWrapperWorld.cpp:
(WebCore::DOMWrapperWorld::clearWrappers):
* bindings/js/DOMWrapperWorld.h:
* bindings/js/JSDOMBinding.h:
(WebCore::jsStringWithCache):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::commonVM):
* bindings/scripts/StaticString.pm:
(GenerateStrings):

Source/WTF: [Win32][LLINT] Crash when running JSC stress tests.
https://bugs.webkit.org/show_bug.cgi?id=129429

Patch by peavo@outlook.com &lt;peavo@outlook.com&gt; on 2014-03-05
Reviewed by Geoffrey Garen.

* wtf/Platform.h: Enable LLINT on Win32.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSStringcpp">trunk/Source/JavaScriptCore/runtime/JSString.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSStringh">trunk/Source/JavaScriptCore/runtime/JSString.h</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="#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="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsDOMWrapperWorldcpp">trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsDOMWrapperWorldh">trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowBasecpp">trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsStaticStringpm">trunk/Source/WebCore/bindings/scripts/StaticString.pm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-03-05  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        https://bugs.webkit.org/show_bug.cgi?id=128625
+        Add fast mapping from StringImpl to JSString
+
+        Unreviewed roll-out.
+
+        Reverting r164347, r165054, r165066 - not clear the performance tradeoff was right.
+
+        * runtime/JSString.cpp:
+        * runtime/JSString.h:
+        * runtime/VM.cpp:
+        (JSC::VM::createLeaked):
+        * runtime/VM.h:
+
</ins><span class="cx"> 2014-03-03  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support caching of custom setters
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSStringcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSString.cpp (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSString.cpp        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/JavaScriptCore/runtime/JSString.cpp        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -298,11 +298,4 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JSString::WeakOwner::finalize(Handle&lt;Unknown&gt;, void* context)
-{
-    StringImpl* impl = static_cast&lt;StringImpl*&gt;(context);
-    WeakSet::deallocate(impl-&gt;weakJSString());
-    impl-&gt;setWeakJSString(nullptr);
-}
-
</del><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSString.h (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSString.h        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/JavaScriptCore/runtime/JSString.h        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -63,11 +63,6 @@
</span><span class="cx"> 
</span><span class="cx">     class JSString : public JSCell {
</span><span class="cx">     public:
</span><del>-        class WeakOwner final : public WeakHandleOwner {
-        public:
-            virtual void finalize(Handle&lt;Unknown&gt;, void* context) override;
-        };
-
</del><span class="cx">         friend class JIT;
</span><span class="cx">         friend class VM;
</span><span class="cx">         friend class SpecializedThunkJIT;
</span><span class="lines">@@ -412,28 +407,6 @@
</span><span class="cx">         return JSString::create(*vm, s.impl());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    inline JSString* jsStringWithWeakOwner(VM&amp; vm, StringImpl&amp; stringImpl)
-    {
-        WeakHandleOwner* jsStringWeakOwner = vm.jsStringWeakOwner.get();
-        ASSERT(stringImpl.length() &gt; 0);
-
-        // If this VM is not allowed to weakly own strings just make a new JSString.
-        if (!jsStringWeakOwner)
-            return JSString::create(vm, &amp;stringImpl);
-
-        // Check for an existing weakly owned JSString.
-        if (WeakImpl* weakImpl = stringImpl.weakJSString()) {
-            if (weakImpl-&gt;state() == WeakImpl::Live)
-                return asString(weakImpl-&gt;jsValue());
-            WeakSet::deallocate(weakImpl);
-            stringImpl.setWeakJSString(nullptr);
-        }
-
-        JSString* string = JSString::create(vm, &amp;stringImpl);
-        stringImpl.setWeakJSString(WeakSet::allocate(string, jsStringWeakOwner, &amp;stringImpl));
-        return string;
-    }
-
</del><span class="cx">     inline JSString* jsSubstring(ExecState* exec, JSString* s, unsigned offset, unsigned length)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(offset &lt;= static_cast&lt;unsigned&gt;(s-&gt;length()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.cpp (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/JavaScriptCore/runtime/VM.cpp        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -402,11 +402,9 @@
</span><span class="cx">     return adoptRef(new VM(Default, heapType));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;VM&gt; VM::createLeakedForMainThread(HeapType heapType)
</del><ins>+PassRefPtr&lt;VM&gt; VM::createLeaked(HeapType heapType)
</ins><span class="cx"> {
</span><del>-    VM* vm = new VM(Default, heapType);
-    vm-&gt;jsStringWeakOwner = adoptPtr(new JSString::WeakOwner);
-    return adoptRef(vm);
</del><ins>+    return create(heapType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool VM::sharedInstanceExists()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -184,8 +184,8 @@
</span><span class="cx">     class VM : public ThreadSafeRefCounted&lt;VM&gt; {
</span><span class="cx">     public:
</span><span class="cx">         // WebCore has a one-to-one mapping of threads to VMs;
</span><del>-        // either create() or createLeakedForMainThread() should only be
-        // called once on a thread, this is the 'default' VM (it uses the
</del><ins>+        // either create() or createLeaked() should only be called once
+        // on a thread, this is the 'default' VM (it uses the
</ins><span class="cx">         // thread's default string uniquing table from wtfThreadData).
</span><span class="cx">         // API contexts created using the new context group aware interface
</span><span class="cx">         // create APIContextGroup objects which require less locking of JSC
</span><span class="lines">@@ -203,7 +203,7 @@
</span><span class="cx">         JS_EXPORT_PRIVATE static VM&amp; sharedInstance();
</span><span class="cx"> 
</span><span class="cx">         JS_EXPORT_PRIVATE static PassRefPtr&lt;VM&gt; create(HeapType = SmallHeap);
</span><del>-        JS_EXPORT_PRIVATE static PassRefPtr&lt;VM&gt; createLeakedForMainThread(HeapType = SmallHeap);
</del><ins>+        JS_EXPORT_PRIVATE static PassRefPtr&lt;VM&gt; createLeaked(HeapType = SmallHeap);
</ins><span class="cx">         static PassRefPtr&lt;VM&gt; createContextGroup(HeapType = SmallHeap);
</span><span class="cx">         JS_EXPORT_PRIVATE ~VM();
</span><span class="cx"> 
</span><span class="lines">@@ -222,10 +222,7 @@
</span><span class="cx">         // The heap should be just after executableAllocator and before other members to ensure that it's
</span><span class="cx">         // destructed after all the objects that reference it.
</span><span class="cx">         Heap heap;
</span><del>-
-        // Used to manage weak references from StringImpls to JSStrings.
-        OwnPtr&lt;WeakHandleOwner&gt; jsStringWeakOwner;
-
</del><ins>+        
</ins><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx">         OwnPtr&lt;DFG::LongLivedState&gt; dfgState;
</span><span class="cx"> #endif // ENABLE(DFG_JIT)
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WTF/ChangeLog        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -289,25 +289,6 @@
</span><span class="cx">         * wtf/Platform.h: Changed to define WTF_PLATFORM_MAC only on when building for OS X (but
</span><span class="cx">         still not when WTF_PLATFORM_GTK or WTF_PLATFORM_EFL are defined).
</span><span class="cx"> 
</span><del>-2014-02-17  Gavin Barraclough  &lt;barraclough@apple.com&gt;
-
-        Add fast mapping from StringImpl to JSString
-        https://bugs.webkit.org/show_bug.cgi?id=128625
-
-        Reviewed by Geoff Garen &amp; Andreas Kling.
-
-        Add weak pointer from StringImpl to JSString.
-
-        * wtf/text/StringImpl.cpp:
-        (WTF::StringImpl::~StringImpl):
-            - ASSERT m_weakJSString is null.
-        * wtf/text/StringImpl.h:
-        (WTF::StringImpl::StringImpl):
-            - initialize m_weakJSString.
-        (WTF::StringImpl::weakJSString):
-        (WTF::StringImpl::setWeakJSString):
-            - added acessors for m_weakJSString.
-
</del><span class="cx"> 2014-02-18  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Web Inspector: JSContext inspection crashes in isMainThread, uninitialized WebCoreWebThreadIsLockedOrDisabled
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.cpp        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace Unicode;
</span><span class="cx"> 
</span><del>-COMPILE_ASSERT(sizeof(StringImpl) == 2 * sizeof(int) + 4 * sizeof(void*), StringImpl_should_stay_small);
</del><ins>+COMPILE_ASSERT(sizeof(StringImpl) == 2 * sizeof(int) + 3 * sizeof(void*), StringImpl_should_stay_small);
</ins><span class="cx"> 
</span><span class="cx"> #ifdef STRING_STATS
</span><span class="cx"> StringStats StringImpl::m_stringStats;
</span><span class="lines">@@ -110,7 +110,6 @@
</span><span class="cx"> StringImpl::~StringImpl()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isStatic());
</span><del>-    ASSERT(!m_weakJSString);
</del><span class="cx"> 
</span><span class="cx">     STRING_STATS_REMOVE_STRING(this);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringImpl.h (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringImpl.h        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WTF/wtf/text/StringImpl.h        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -54,10 +54,6 @@
</span><span class="cx"> struct IdentifierLCharFromUCharTranslator;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-namespace JSC {
-    class WeakImpl;
-}
-
</del><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><span class="cx"> struct CStringTranslator;
</span><span class="lines">@@ -166,7 +162,6 @@
</span><span class="cx">         : m_refCount(s_refCountFlagIsStaticString)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data16(characters)
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(s_hashFlagIsIdentifier | BufferOwned)
</span><span class="cx">     {
</span><span class="cx">         // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
</span><span class="lines">@@ -184,7 +179,6 @@
</span><span class="cx">         : m_refCount(s_refCountFlagIsStaticString)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data8(characters)
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(s_hashFlag8BitBuffer | s_hashFlagIsIdentifier | BufferOwned)
</span><span class="cx">     {
</span><span class="cx">         // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
</span><span class="lines">@@ -202,7 +196,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data8(tailPointer&lt;LChar&gt;())
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_data8);
</span><span class="lines">@@ -216,7 +209,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data16(tailPointer&lt;UChar&gt;())
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(BufferInternal)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_data16);
</span><span class="lines">@@ -230,7 +222,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data8(characters.leakPtr())
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(s_hashFlag8BitBuffer | BufferOwned)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_data8);
</span><span class="lines">@@ -244,7 +235,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data16(characters)
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(BufferInternal)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_data16);
</span><span class="lines">@@ -257,7 +247,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data8(characters)
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_data8);
</span><span class="lines">@@ -271,7 +260,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data16(characters.leakPtr())
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(BufferOwned)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(m_data16);
</span><span class="lines">@@ -285,7 +273,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data8(characters)
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(s_hashFlag8BitBuffer | BufferSubstring)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(is8Bit());
</span><span class="lines">@@ -303,7 +290,6 @@
</span><span class="cx">         : m_refCount(s_refCountIncrement)
</span><span class="cx">         , m_length(length)
</span><span class="cx">         , m_data16(characters)
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">         , m_hashAndFlags(BufferSubstring)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!is8Bit());
</span><span class="lines">@@ -323,7 +309,6 @@
</span><span class="cx">         // We expect m_length to be initialized to 0 as we use it
</span><span class="cx">         // to represent a null terminated buffer.
</span><span class="cx">         , m_data8(reinterpret_cast&lt;const LChar*&gt;(&amp;m_length))
</span><del>-        , m_weakJSString(nullptr)
</del><span class="cx">     {
</span><span class="cx">         ASSERT(m_data8);
</span><span class="cx">         // Set the hash early, so that all empty unique StringImpls have a hash,
</span><span class="lines">@@ -627,9 +612,6 @@
</span><span class="cx">         m_refCount = tempRefCount;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    JSC::WeakImpl* weakJSString() { return m_weakJSString; }
-    void setWeakJSString(JSC::WeakImpl* weakJSString) { m_weakJSString = weakJSString; }
-
</del><span class="cx">     WTF_EXPORT_PRIVATE static StringImpl* empty();
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Does this really belong in StringImpl?
</span><span class="lines">@@ -869,7 +851,6 @@
</span><span class="cx">         unsigned m_refCount;
</span><span class="cx">         unsigned m_length;
</span><span class="cx">         const LChar* m_data8;
</span><del>-        JSC::WeakImpl* m_weakJSString;
</del><span class="cx">         mutable UChar* m_copyData16;
</span><span class="cx">         unsigned m_hashAndFlags;
</span><span class="cx"> 
</span><span class="lines">@@ -895,7 +876,6 @@
</span><span class="cx">         const LChar* m_data8;
</span><span class="cx">         const UChar* m_data16;
</span><span class="cx">     };
</span><del>-    JSC::WeakImpl* m_weakJSString;
</del><span class="cx">     mutable UChar* m_copyData16;
</span><span class="cx">     mutable unsigned m_hashAndFlags;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WebCore/ChangeLog        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-03-05  Gavin Barraclough  &lt;barraclough@apple.com&gt;
+
+        https://bugs.webkit.org/show_bug.cgi?id=128625
+        Add fast mapping from StringImpl to JSString
+
+        Unreviewed roll-out.
+
+        Reverting r164347, r165054, r165066 - not clear the performance tradeoff was right.
+
+        * bindings/js/DOMWrapperWorld.cpp:
+        (WebCore::DOMWrapperWorld::clearWrappers):
+        * bindings/js/DOMWrapperWorld.h:
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::jsStringWithCache):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::commonVM):
+        * bindings/scripts/StaticString.pm:
+        (GenerateStrings):
+
</ins><span class="cx"> 2014-03-05  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx">             And Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsDOMWrapperWorldcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> void DOMWrapperWorld::clearWrappers()
</span><span class="cx"> {
</span><span class="cx">     m_wrappers.clear();
</span><ins>+    m_stringCache.clear();
</ins><span class="cx"> 
</span><span class="cx">     // These items are created lazily.
</span><span class="cx">     while (!m_scriptControllersWithWindowShells.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsDOMWrapperWorldh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> class ScriptController;
</span><span class="cx"> 
</span><span class="cx"> typedef HashMap&lt;void*, JSC::Weak&lt;JSC::JSObject&gt;&gt; DOMObjectWrapperMap;
</span><ins>+typedef JSC::WeakGCMap&lt;StringImpl*, JSC::JSString, PtrHash&lt;StringImpl*&gt;&gt; JSStringCache;
</ins><span class="cx"> 
</span><span class="cx"> class DOMWrapperWorld : public RefCounted&lt;DOMWrapperWorld&gt; {
</span><span class="cx"> public:
</span><span class="lines">@@ -50,6 +51,7 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: can we make this private?
</span><span class="cx">     DOMObjectWrapperMap m_wrappers;
</span><ins>+    JSStringCache m_stringCache;
</ins><span class="cx">     HashMap&lt;CSSValue*, void*&gt; m_cssValueRoots;
</span><span class="cx"> 
</span><span class="cx">     bool isNormal() const { return m_isNormal; }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -571,19 +571,23 @@
</span><span class="cx"> 
</span><span class="cx"> inline JSC::JSValue jsStringWithCache(JSC::ExecState* exec, const String&amp; s)
</span><span class="cx"> {
</span><del>-    JSC::VM&amp; vm = exec-&gt;vm();
-
</del><span class="cx">     StringImpl* stringImpl = s.impl();
</span><span class="cx">     if (!stringImpl || !stringImpl-&gt;length())
</span><del>-        return jsEmptyString(&amp;vm);
</del><ins>+        return jsEmptyString(exec);
</ins><span class="cx"> 
</span><span class="cx">     if (stringImpl-&gt;length() == 1) {
</span><span class="cx">         UChar singleCharacter = (*stringImpl)[0u];
</span><del>-        if (singleCharacter &lt;= JSC::maxSingleCharacterString)
-            return vm.smallStrings.singleCharacterString(static_cast&lt;unsigned char&gt;(singleCharacter));
</del><ins>+        if (singleCharacter &lt;= JSC::maxSingleCharacterString) {
+            JSC::VM* vm = &amp;exec-&gt;vm();
+            return vm-&gt;smallStrings.singleCharacterString(static_cast&lt;unsigned char&gt;(singleCharacter));
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return JSC::jsStringWithWeakOwner(vm, *stringImpl);
</del><ins>+    JSStringCache&amp; stringCache = currentWorld(exec).m_stringCache;
+    JSStringCache::AddResult addResult = stringCache.add(stringImpl, nullptr);
+    if (addResult.isNewEntry)
+        addResult.iterator-&gt;value = JSC::jsString(exec, String(stringImpl));
+    return JSC::JSValue(addResult.iterator-&gt;value.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline String propertyNameToString(JSC::PropertyName propertyName)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     if (!vm) {
</span><span class="cx">         ScriptController::initializeThreading();
</span><del>-        vm = VM::createLeakedForMainThread(LargeHeap).leakRef();
</del><ins>+        vm = VM::createLeaked(LargeHeap).leakRef();
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">         PassOwnPtr&lt;WebSafeGCActivityCallback&gt; activityCallback = WebSafeGCActivityCallback::create(&amp;vm-&gt;heap);
</span><span class="cx">         vm-&gt;heap.setActivityCallback(activityCallback);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsStaticStringpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/StaticString.pm (165151 => 165152)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/StaticString.pm        2014-03-06 01:37:15 UTC (rev 165151)
+++ trunk/Source/WebCore/bindings/scripts/StaticString.pm        2014-03-06 01:46:21 UTC (rev 165152)
</span><span class="lines">@@ -48,7 +48,6 @@
</span><span class="cx">     $length,
</span><span class="cx">     ${name}String8,
</span><span class="cx">     0,
</span><del>-    nullptr,
</del><span class="cx">     StringImpl::StaticASCIILiteral::s_initialFlags | (${hash} &lt;&lt; StringImpl::StaticASCIILiteral::s_hashShift)
</span><span class="cx"> };
</span><span class="cx"> END
</span></span></pre>
</div>
</div>

</body>
</html>