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

Reviewed by Geoff Garen & Andreas Kling.

Source/JavaScriptCore: 

* runtime/JSString.cpp:
(JSC::JSString::WeakOwner::finalize):
    - once the JSString weakly owned by a StringImpl becomed unreachable remove the WeakImpl.
* runtime/JSString.h:
(JSC::jsStringWithWeakOwner):
    - create a JSString wrapping a StringImpl, and weakly caches the JSString on the StringImpl.
* runtime/VM.cpp:
(JSC::VM::VM):
    - initialize jsStringWeakOwner.
(JSC::VM::createLeakedForMainThread):
    - initialize jsStringWeakOwner - the main thread gets to use the weak pointer
      on StringImpl to cache a JSString wrapper.
* runtime/VM.h:
    - renamed createLeaked -> createLeakedForMainThread to make it clear this
      should only be used to cretae the main thread VM.

Source/WebCore: 

Removed JSStringCache from WebCore; call JSC::jsStringWithWeakOwner instead.

* bindings/js/DOMWrapperWorld.cpp:
(WebCore::DOMWrapperWorld::clearWrappers):
    - removed JSStringCache.
* bindings/js/DOMWrapperWorld.h:
    - removed JSStringCache.
* bindings/js/JSDOMBinding.h:
(WebCore::jsStringWithCache):
    - call jsStringWithWeakOwner insead of using JSStringCache.
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::commonVM):
    - renamed createLeaked -> createLeakedForMainThread.
* bindings/scripts/StaticString.pm:
(GenerateStrings):
    - StringImpl has an additional field.

Source/WTF: 

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@164347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed