Ignore:
Timestamp:
Jan 16, 2010, 11:18:38 PM (15 years ago)
Author:
[email protected]
Message:

2010-01-16 Maciej Stachowiak <[email protected]>

Reviewed by Oliver Hunt.

Cache JS string values made from DOM strings (Dromaeo speedup)
https://bugs.webkit.org/show_bug.cgi?id=33768
<rdar://problem/7353576>

  • runtime/JSString.h: (JSC::jsStringWithFinalizer): Added new mechanism for a string to have an optional finalizer callback, for the benefit of weak-referencing caches. (JSC::): (JSC::Fiber::JSString): (JSC::Fiber::~JSString):
  • runtime/JSString.cpp: (JSC::JSString::resolveRope): Clear fibers so this doesn't look like a string with a finalizer.
  • runtime/WeakGCMap.h: Include "Collector.h" to make this header includable by itself.

2010-01-16 Maciej Stachowiak <[email protected]>

Reviewed by Oliver Hunt.

Cache JS string values made from DOM strings (Dromaeo speedup)
https://bugs.webkit.org/show_bug.cgi?id=33768
<rdar://problem/7353576>


  • Plugins/Hosted/ProxyInstance.mm: (WebKit::ProxyInstance::stringValue): Explicitly make a String, since char* is now ambiguous.

2010-01-16 Maciej Stachowiak <[email protected]>

Reviewed by Oliver Hunt.

Cache JS string values made from DOM strings (Dromaeo speedup)
https://bugs.webkit.org/show_bug.cgi?id=33768
<rdar://problem/7353576>

Added a new cache for JSString values that are created from Strings or AtomicStrings
in the DOM. It's common for the same string to be retrieved from the DOM repeatedly,
and it is wasteful to make a new JS-level string value every time.


The string cache is per-world, and thus thread-safe and not a
vector for accidental information exchange.


~30% speedup on Dromaeo Attributes test, also substantially helps other Dromaeo DOM tests.

  • bindings/js/JSDOMBinding.cpp: (WebCore::jsStringCache): Helper function to get the string cache for the current world. (WebCore::jsString): Some new overloads including the caching version. (WebCore::stringWrapperDestroyed): Finalizer callback - remove from relevant caches.
  • bindings/js/JSDOMBinding.h: (WebCore::jsString): Prototype new overloads (and define a few inline).
  • bindings/js/JSJavaScriptCallFrameCustom.cpp: (WebCore::JSJavaScriptCallFrame::type): Explicitly make a UString.
  • bindings/js/ScriptFunctionCall.cpp: (WebCore::ScriptFunctionCall::appendArgument): Ditto.
  • WebCore.base.exp: Add new JSString overloads that WebCore gets to see.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSString.cpp

    r53323 r53371  
    8686        m_value = newImpl;
    8787    else {
    88         for (unsigned i = 0; i < m_ropeLength; ++i)
     88        for (unsigned i = 0; i < m_ropeLength; ++i) {
    8989            m_fibers[i].deref();
     90            m_fibers[i] = static_cast<void*>(0);
     91        }
    9092        m_ropeLength = 0;
    9193        ASSERT(!isRope());
     
    121123                // Create a string from the UChar buffer, clear the rope RefPtr.
    122124                ASSERT(buffer == position);
    123                 for (unsigned i = 0; i < m_ropeLength; ++i)
     125                for (unsigned i = 0; i < m_ropeLength; ++i) {
    124126                    m_fibers[i].deref();
     127                    m_fibers[i] = static_cast<void*>(0);
     128                }
    125129                m_ropeLength = 0;
    126130
Note: See TracChangeset for help on using the changeset viewer.