Changeset 53514 in webkit


Ignore:
Timestamp:
Jan 19, 2010 6:25:21 PM (14 years ago)
Author:
mjs@apple.com
Message:

2010-01-18 Maciej Stachowiak <mjs@apple.com>

Reviewed by Adam Barth.

Inline functions that are hot in DOM manipulation
https://bugs.webkit.org/show_bug.cgi?id=33820


(3% speedup on Dromaeo DOM Core tests)

  • runtime/WeakGCMap.h: (JSC::::get): inline

2010-01-18 Maciej Stachowiak <mjs@apple.com>

Reviewed by Adam Barth.

Inline functions that are hot in DOM manipulation
https://bugs.webkit.org/show_bug.cgi?id=33820

(3% speedup on Dromaeo DOM Core tests)

  • bindings/js/JSDOMBinding.h: (WebCore::currentWorld): Inlined. (WebCore::jsString): Inlined String& overload and split off slow case.
  • bindings/js/JSDOMBinding.cpp: (WebCore::jsStringSlowCase): Slow case for the above.
  • dom/Document.h: (WebCore::Document::isHTMLDocument): Use a bit and an inline method instead of a virtual method, since this is so hot and size of Document is not a prime concern. (WebCore::Document::create): Adapt for above. (WebCore::Document::createXHTML): ditto
  • dom/Document.cpp: (WebCore::Document::Document): ditto
  • html/HTMLDocument.cpp: (WebCore::HTMLDocument::HTMLDocument): ditto
  • html/HTMLDocument.h: ditto
  • loader/PlaceholderDocument.h: (WebCore::PlaceholderDocument::PlaceholderDocument): ditto
  • svg/SVGDocument.cpp: (WebCore::SVGDocument::SVGDocument): ditto
  • dom/Element.h: (WebCore::Element::attributes): Inlined. (WebCore::Element::updateId): Inlined.
  • dom/Element.cpp: (Remove inlined methods.)
  • dom/NamedAttrMap.h: (WebCore::NamedNodeMap::getAttributeItem): Inlined and split off slow case.
  • dom/NamedAttrMap.cpp: (WebCore::NamedNodeMap::getAttributeItemSlowCase): Slow case for the above.
  • inspector/InspectorController.cpp:
  • inspector/InspectorController.h: (WebCore::InspectorController::didInsertDOMNode): Inlined so the fast case early exit doesn't incur a function call. (WebCore::InspectorController::didRemoveDOMNode): ditto (WebCore::InspectorController::didModifyDOMAttr): ditto
  • platform/ThreadGlobalData.h: (WebCore::threadGlobalData): Inlined.
  • platform/ThreadGlobalData.cpp: (Removed inline methods).
  • platform/Timer.h: (WebCore::TimerBase::isActive): Inlined.
  • platform/Timer.cpp: (Removed inline methods).
  • WebCore.xcodeproj/project.pbxproj: Install new heares.
  • WebCore.base.exp: Add appropriate exports.
Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r53479 r53514  
     12010-01-18  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Inline functions that are hot in DOM manipulation
     6        https://bugs.webkit.org/show_bug.cgi?id=33820
     7       
     8        (3% speedup on Dromaeo DOM Core tests)
     9
     10        * runtime/WeakGCMap.h:
     11        (JSC::::get): inline
     12
    1132010-01-19  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    214
  • trunk/JavaScriptCore/runtime/WeakGCMap.h

    r53371 r53514  
    7373
    7474template<typename KeyType, typename MappedType>
    75 MappedType WeakGCMap<KeyType, MappedType>::get(const KeyType& key) const
     75inline MappedType WeakGCMap<KeyType, MappedType>::get(const KeyType& key) const
    7676{
    7777    MappedType result = m_map.get(key);
  • trunk/WebCore/ChangeLog

    r53513 r53514  
     12010-01-18  Maciej Stachowiak  <mjs@apple.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Inline functions that are hot in DOM manipulation
     6        https://bugs.webkit.org/show_bug.cgi?id=33820
     7
     8        (3% speedup on Dromaeo DOM Core tests)
     9
     10        * bindings/js/JSDOMBinding.h:
     11        (WebCore::currentWorld): Inlined.
     12        (WebCore::jsString): Inlined String& overload and split off slow case.
     13        * bindings/js/JSDOMBinding.cpp:
     14        (WebCore::jsStringSlowCase): Slow case for the above.
     15        * dom/Document.h:
     16        (WebCore::Document::isHTMLDocument): Use a bit and an inline method
     17        instead of a virtual method, since this is so hot and size of Document
     18        is not a prime concern.
     19        (WebCore::Document::create): Adapt for above.
     20        (WebCore::Document::createXHTML): ditto
     21        * dom/Document.cpp:
     22        (WebCore::Document::Document): ditto
     23        * html/HTMLDocument.cpp:
     24        (WebCore::HTMLDocument::HTMLDocument): ditto
     25        * html/HTMLDocument.h: ditto
     26        * loader/PlaceholderDocument.h:
     27        (WebCore::PlaceholderDocument::PlaceholderDocument): ditto
     28        * svg/SVGDocument.cpp:
     29        (WebCore::SVGDocument::SVGDocument): ditto
     30        * dom/Element.h:
     31        (WebCore::Element::attributes): Inlined.
     32        (WebCore::Element::updateId): Inlined.
     33        * dom/Element.cpp: (Remove inlined methods.)
     34        * dom/NamedAttrMap.h:
     35        (WebCore::NamedNodeMap::getAttributeItem): Inlined and split off slow case.
     36        * dom/NamedAttrMap.cpp:
     37        (WebCore::NamedNodeMap::getAttributeItemSlowCase): Slow case for the above.
     38        * inspector/InspectorController.cpp:
     39        * inspector/InspectorController.h:
     40        (WebCore::InspectorController::didInsertDOMNode): Inlined so the fast case
     41        early exit doesn't incur a function call.
     42        (WebCore::InspectorController::didRemoveDOMNode): ditto
     43        (WebCore::InspectorController::didModifyDOMAttr): ditto
     44        * platform/ThreadGlobalData.h:
     45        (WebCore::threadGlobalData): Inlined.
     46        * platform/ThreadGlobalData.cpp: (Removed inline methods).
     47        * platform/Timer.h:
     48        (WebCore::TimerBase::isActive): Inlined.
     49        * platform/Timer.cpp: (Removed inline methods).
     50        * WebCore.xcodeproj/project.pbxproj: Install new heares.
     51        * WebCore.base.exp: Add appropriate exports.
     52
    1532010-01-19  Jon Honeycutt  <jhoneycutt@apple.com>
    254
  • trunk/WebCore/WebCore.base.exp

    r53500 r53514  
    140140__ZN7WebCore10StringImpl11reverseFindEPS0_ib
    141141__ZN7WebCore10StringImpl7replaceEtt
     142__ZN7WebCore10StringImpl7ustringEv
    142143__ZN7WebCore10StringImpl8endsWithEPS0_b
    143144__ZN7WebCore10StringImplD1Ev
     
    379380__ZN7WebCore16ScriptController18windowScriptObjectEv
    380381__ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKNS_6StringEb
     382__ZN7WebCore16ThreadGlobalData10staticDataE
     383__ZN7WebCore16ThreadGlobalDataC1Ev
     384__ZN7WebCore16ThreadGlobalDataD1Ev
    381385__ZN7WebCore16VisibleSelectionC1EPKNS_5RangeENS_9EAffinityE
    382386__ZN7WebCore16VisibleSelectionC1ERKNS_15VisiblePositionES3_
     
    386390__ZN7WebCore16enclosingIntRectERK7_NSRect
    387391__ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE
     392__ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPNS_10StringImplEPNS0_8JSStringEEES5_
    388393__ZN7WebCore16threadGlobalDataEv
    389394__ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
     
    986991__ZNK7WebCore9PageCache10frameCountEv
    987992__ZNK7WebCore9PageCache21autoreleasedPageCountEv
    988 __ZNK7WebCore9TimerBase8isActiveEv
    989993__ZTVN7WebCore12ChromeClientE
    990994__ZTVN7WebCore12PluginWidgetE
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r53512 r53514  
    12751275                7A1E88F6101CC384000C4DF5 /* ScriptArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1E88F4101CC384000C4DF5 /* ScriptArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12761276                7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */; };
    1277                 7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */; };
     1277                7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */; settings = {ATTRIBUTES = (Private, ); }; };
    12781278                7A674BDB0F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */; };
    12791279                7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */; };
  • trunk/WebCore/bindings/js/JSDOMBinding.cpp

    r53371 r53514  
    220220    HashSet<DOMWrapperWorld*>::iterator m_end;
    221221};
    222 
    223 DOMWrapperWorld* currentWorld(JSC::ExecState* exec)
    224 {
    225     return static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->world();
    226 }
    227222
    228223DOMWrapperWorld* normalWorld(JSC::JSGlobalData& globalData)
     
    557552}
    558553
    559 static inline JSStringCache& jsStringCache(ExecState* exec)
    560 {
    561     return currentWorld(exec)->m_stringCache;
    562 }
    563 
    564554static void stringWrapperDestroyed(JSString* str, void* context)
    565555{
     
    584574}
    585575
    586 JSValue jsString(ExecState* exec, const String& s)
    587 {
    588     StringImpl* stringImpl = s.impl();
    589     if (!stringImpl || !stringImpl->length())
    590         return jsEmptyString(exec);
    591 
    592     if (stringImpl->length() == 1 && stringImpl->characters()[0] <= 0xFF)
    593         return jsString(exec, stringImpl->ustring());
    594 
    595     JSStringCache& stringCache = jsStringCache(exec);
    596     if (JSString* wrapper = stringCache.get(stringImpl))
    597         return wrapper;
    598 
     576JSValue jsStringSlowCase(ExecState* exec, JSStringCache& stringCache, StringImpl* stringImpl)
     577{
    599578    // If there is a stale entry, we have to explicitly remove it to avoid
    600579    // problems down the line.
  • trunk/WebCore/bindings/js/JSDOMBinding.h

    r53371 r53514  
    347347
    348348    JSC::JSValue jsString(JSC::ExecState*, const String&); // empty if the string is null
     349    JSC::JSValue jsStringSlowCase(JSC::ExecState*, JSStringCache&, StringImpl*);
    349350    JSC::JSValue jsString(JSC::ExecState*, const KURL&); // empty if the URL is null
    350351    inline JSC::JSValue jsString(JSC::ExecState* exec, const AtomicString& s)
     
    416417    KURL completeURL(JSC::ExecState*, const String& relativeURL);
    417418
     419    inline DOMWrapperWorld* currentWorld(JSC::ExecState* exec)
     420    {
     421        return static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->world();
     422    }
     423   
     424    inline JSC::JSValue jsString(JSC::ExecState* exec, const String& s)
     425    {
     426        StringImpl* stringImpl = s.impl();
     427        if (!stringImpl || !stringImpl->length())
     428            return jsEmptyString(exec);
     429
     430        if (stringImpl->length() == 1 && stringImpl->characters()[0] <= 0xFF)
     431            return jsString(exec, stringImpl->ustring());
     432
     433        JSStringCache& stringCache = currentWorld(exec)->m_stringCache;
     434        if (JSC::JSString* wrapper = stringCache.get(stringImpl))
     435            return wrapper;
     436
     437        return jsStringSlowCase(exec, stringCache, stringImpl);
     438    }
     439
    418440} // namespace WebCore
    419441
  • trunk/WebCore/dom/Document.cpp

    r53429 r53514  
    323323static HashSet<Document*>* documentsThatNeedStyleRecalc = 0;
    324324
    325 Document::Document(Frame* frame, bool isXHTML)
     325Document::Document(Frame* frame, bool isXHTML, bool isHTML)
    326326    : ContainerNode(0)
    327327    , m_domtree_version(0)
     
    358358    , m_useSecureKeyboardEntryWhenActive(false)
    359359    , m_isXHTML(isXHTML)
     360    , m_isHTML(isHTML)
    360361    , m_numNodeListCaches(0)
    361362#if USE(JSC)
  • trunk/WebCore/dom/Document.h

    r53345 r53514  
    3333#include "CollectionType.h"
    3434#include "Color.h"
     35#include "Document.h"
    3536#include "DocumentMarker.h"
    3637#include "ScriptExecutionContext.h"
     
    191192    static PassRefPtr<Document> create(Frame* frame)
    192193    {
    193         return adoptRef(new Document(frame, false));
     194        return adoptRef(new Document(frame, false, false));
    194195    }
    195196    static PassRefPtr<Document> createXHTML(Frame* frame)
    196197    {
    197         return adoptRef(new Document(frame, true));
     198        return adoptRef(new Document(frame, true, false));
    198199    }
    199200    virtual ~Document();
     
    366367
    367368    // Other methods (not part of DOM)
    368     virtual bool isHTMLDocument() const { return false; }
     369    bool isHTMLDocument() const { return m_isHTML; }
    369370    virtual bool isImageDocument() const { return false; }
    370371#if ENABLE(SVG)
     
    943944
    944945protected:
    945     Document(Frame*, bool isXHTML);
     946    Document(Frame*, bool isXHTML, bool isHTML);
    946947
    947948    void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; }
     
    11851186
    11861187    bool m_isXHTML;
     1188    bool m_isHTML;
    11871189
    11881190    unsigned m_numNodeListCaches;
  • trunk/WebCore/dom/Element.cpp

    r53442 r53514  
    161161}
    162162
    163 NamedNodeMap* Element::attributes(bool readonly) const
    164 {
    165     if (!m_isStyleAttributeValid)
    166         updateStyleAttribute();
    167 
    168 #if ENABLE(SVG)
    169     if (!m_areSVGAttributesValid)
    170         updateAnimatedSVGAttribute(String());
    171 #endif
    172 
    173     if (!readonly && !namedAttrMap)
    174         createAttributeMap();
    175     return namedAttrMap.get();
    176 }
    177 
    178163Node::NodeType Element::nodeType() const
    179164{
     
    10931078}
    10941079
    1095 void Element::updateId(const AtomicString& oldId, const AtomicString& newId)
    1096 {
    1097     if (!inDocument())
    1098         return;
    1099 
    1100     if (oldId == newId)
    1101         return;
    1102 
    1103     Document* doc = document();
    1104     if (!oldId.isEmpty())
    1105         doc->removeElementById(oldId, this);
    1106     if (!newId.isEmpty())
    1107         doc->addElementById(newId, this);
    1108 }
    1109 
    11101080#ifndef NDEBUG
    11111081void Element::formatForDebugger(char* buffer, unsigned length) const
  • trunk/WebCore/dom/Element.h

    r53442 r53514  
    2727
    2828#include "ContainerNode.h"
     29#include "Document.h"
    2930#include "HTMLNames.h"
    3031#include "MappedAttributeEntry.h"
     
    350351}
    351352
     353inline NamedNodeMap* Element::attributes(bool readonly) const
     354{
     355    if (!m_isStyleAttributeValid)
     356        updateStyleAttribute();
     357
     358#if ENABLE(SVG)
     359    if (!m_areSVGAttributesValid)
     360        updateAnimatedSVGAttribute(String());
     361#endif
     362
     363    if (!readonly && !namedAttrMap)
     364        createAttributeMap();
     365    return namedAttrMap.get();
     366}
     367
     368inline void Element::updateId(const AtomicString& oldId, const AtomicString& newId)
     369{
     370    if (!inDocument())
     371        return;
     372
     373    if (oldId == newId)
     374        return;
     375
     376    Document* doc = document();
     377    if (!oldId.isEmpty())
     378        doc->removeElementById(oldId, this);
     379    if (!newId.isEmpty())
     380        doc->addElementById(newId, this);
     381}
     382
    352383} //namespace
    353384
  • trunk/WebCore/dom/NamedAttrMap.cpp

    r52312 r53514  
    173173}
    174174
    175 // We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller
    176 // can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not).
    177 Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const
     175Attribute* NamedNodeMap::getAttributeItemSlowCase(const String& name, bool shouldIgnoreAttributeCase) const
    178176{
    179177    unsigned len = length();
    180     bool doSlowCheck = shouldIgnoreAttributeCase;
    181    
    182     // Optimize for the case where the attribute exists and its name exactly matches.
     178
     179    // Continue to checking case-insensitively and/or full namespaced names if necessary:
    183180    for (unsigned i = 0; i < len; ++i) {
    184181        const QualifiedName& attrName = m_attributes[i]->name();
    185182        if (!attrName.hasPrefix()) {
    186             if (name == attrName.localName())
     183            if (shouldIgnoreAttributeCase && equalIgnoringCase(name, attrName.localName()))
    187184                return m_attributes[i].get();
    188         } else
    189             doSlowCheck = true;
    190     }
    191    
    192     // Continue to checking case-insensitively and/or full namespaced names if necessary:
    193     if (doSlowCheck) {
    194         for (unsigned i = 0; i < len; ++i) {
    195             const QualifiedName& attrName = m_attributes[i]->name();
    196             if (!attrName.hasPrefix()) {
    197                 if (shouldIgnoreAttributeCase && equalIgnoringCase(name, attrName.localName()))
    198                     return m_attributes[i].get();
    199             } else {
    200                 // FIXME: Would be faster to do this comparison without calling toString, which
    201                 // generates a temporary string by concatenation. But this branch is only reached
    202                 // if the attribute name has a prefix, which is rare in HTML.
    203                 if (equalPossiblyIgnoringCase(name, attrName.toString(), shouldIgnoreAttributeCase))
    204                     return m_attributes[i].get();
    205             }
     185        } else {
     186            // FIXME: Would be faster to do this comparison without calling toString, which
     187            // generates a temporary string by concatenation. But this branch is only reached
     188            // if the attribute name has a prefix, which is rare in HTML.
     189            if (equalPossiblyIgnoringCase(name, attrName.toString(), shouldIgnoreAttributeCase))
     190                return m_attributes[i].get();
    206191        }
    207     }
    208     return 0;
    209 }
    210 
    211 Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const
    212 {
    213     unsigned len = length();
    214     for (unsigned i = 0; i < len; ++i) {
    215         if (m_attributes[i]->name().matches(name))
    216             return m_attributes[i].get();
    217192    }
    218193    return 0;
  • trunk/WebCore/dom/NamedAttrMap.h

    r48769 r53514  
    104104    void detachFromElement();
    105105    Attribute* getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const;
     106    Attribute* getAttributeItemSlowCase(const String& name, bool shouldIgnoreAttributeCase) const;
    106107
    107108    Element* m_element;
     
    110111};
    111112
     113inline Attribute* NamedNodeMap::getAttributeItem(const QualifiedName& name) const
     114{
     115    unsigned len = length();
     116    for (unsigned i = 0; i < len; ++i) {
     117        if (m_attributes[i]->name().matches(name))
     118            return m_attributes[i].get();
     119    }
     120    return 0;
     121}
     122
     123// We use a boolean parameter instead of calling shouldIgnoreAttributeCase so that the caller
     124// can tune the behaviour (hasAttribute is case sensitive whereas getAttribute is not).
     125inline Attribute* NamedNodeMap::getAttributeItem(const String& name, bool shouldIgnoreAttributeCase) const
     126{
     127    unsigned len = length();
     128    bool doSlowCheck = shouldIgnoreAttributeCase;
     129   
     130    // Optimize for the case where the attribute exists and its name exactly matches.
     131    for (unsigned i = 0; i < len; ++i) {
     132        const QualifiedName& attrName = m_attributes[i]->name();
     133        if (!attrName.hasPrefix()) {
     134            if (name == attrName.localName())
     135                return m_attributes[i].get();
     136        } else
     137            doSlowCheck = true;
     138    }
     139
     140    if (doSlowCheck)
     141        return getAttributeItemSlowCase(name, shouldIgnoreAttributeCase);
     142    return 0;
     143}
     144
    112145} //namespace
    113146
  • trunk/WebCore/html/HTMLDocument.cpp

    r49798 r53514  
    8181
    8282HTMLDocument::HTMLDocument(Frame* frame)
    83     : Document(frame, false)
     83    : Document(frame, false, true)
    8484{
    8585    clearXMLVersion();
  • trunk/WebCore/html/HTMLDocument.h

    r47313 r53514  
    8888    virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
    8989
    90     virtual bool isHTMLDocument() const { return true; }
    9190    virtual bool isFrameSet() const;
    9291    virtual Tokenizer* createTokenizer();
  • trunk/WebCore/inspector/InspectorController.cpp

    r53469 r53514  
    18751875}
    18761876
    1877 void InspectorController::didInsertDOMNode(Node* node)
    1878 {
    1879     if (m_domAgent)
    1880         m_domAgent->didInsertDOMNode(node);
    1881 }
    1882 
    1883 void InspectorController::didRemoveDOMNode(Node* node)
    1884 {
    1885     if (m_domAgent)
    1886         m_domAgent->didRemoveDOMNode(node);
    1887 }
    1888 
    1889 void InspectorController::didModifyDOMAttr(Element* element)
    1890 {
    1891     if (m_domAgent)
    1892         m_domAgent->didModifyDOMAttr(element);
    1893 }
    1894 
    18951877}  // namespace WebCore
    18961878   
  • trunk/WebCore/inspector/InspectorController.h

    r53469 r53514  
    3232#include "Console.h"
    3333#include "Cookie.h"
     34#include "InspectorDOMAgent.h"
    3435#include "PlatformString.h"
    3536#include "ScriptArray.h"
     
    6768class InspectorBackend;
    6869class InspectorClient;
    69 class InspectorDOMAgent;
    7070class InspectorFrontend;
    7171class InspectorFrontendHost;
     
    371371};
    372372
     373inline void InspectorController::didInsertDOMNode(Node* node)
     374{
     375    if (m_domAgent)
     376        m_domAgent->didInsertDOMNode(node);
     377}
     378
     379inline void InspectorController::didRemoveDOMNode(Node* node)
     380{
     381    if (m_domAgent)
     382        m_domAgent->didRemoveDOMNode(node);
     383}
     384
     385inline void InspectorController::didModifyDOMAttr(Element* element)
     386{
     387    if (m_domAgent)
     388        m_domAgent->didModifyDOMAttr(element);
     389}
     390
    373391} // namespace WebCore
    374392
  • trunk/WebCore/loader/PlaceholderDocument.h

    r47313 r53514  
    4141
    4242private:
    43     PlaceholderDocument(Frame* frame) : Document(frame, false) { }
     43    PlaceholderDocument(Frame* frame) : Document(frame, false, false) { }
    4444};
    4545
  • trunk/WebCore/platform/ThreadGlobalData.cpp

    r50508 r53514  
    4949namespace WebCore {
    5050
    51 ThreadGlobalData& threadGlobalData()
    52 {
    53     // FIXME: Workers are not necessarily the only feature that make per-thread global data necessary.
    54     // We need to check for e.g. database objects manipulating strings on secondary threads.
    5551#if ENABLE(WORKERS)
    56     // ThreadGlobalData is used on main thread before it could possibly be used on secondary ones, so there is no need for synchronization here.
    57     static ThreadSpecific<ThreadGlobalData>* threadGlobalData = new ThreadSpecific<ThreadGlobalData>;
    58     return **threadGlobalData;
     52ThreadSpecific<ThreadGlobalData>* ThreadGlobalData::staticData;
    5953#else
    60     static ThreadGlobalData* staticData;
    61     if (!staticData) {
    62         staticData = static_cast<ThreadGlobalData*>(fastMalloc(sizeof(ThreadGlobalData)));
    63         // ThreadGlobalData constructor indirectly uses staticData, so we need to set up the memory before invoking it.
    64         new (staticData) ThreadGlobalData;
    65     }
    66     return *staticData;
     54ThreadGlobalData* ThreadGlobalData::staticData;
    6755#endif
    68 }
    6956
    7057ThreadGlobalData::ThreadGlobalData()
     
    9380    delete m_cachedConverterICU;
    9481#endif
    95 
    9682    delete m_eventNames;
    9783    delete m_atomicStringTable;
  • trunk/WebCore/platform/ThreadGlobalData.h

    r45891 r53514  
    2929
    3030#include "StringHash.h"
     31#include <wtf/HashMap.h>
    3132#include <wtf/HashSet.h>
    3233#include <wtf/Noncopyable.h>
     34
     35#if ENABLE(WORKERS)
     36#include <wtf/ThreadSpecific.h>
     37#include <wtf/Threading.h>
     38using WTF::ThreadSpecific;
     39#endif
    3340
    3441namespace WebCore {
     
    7481        TECConverterWrapper* m_cachedConverterTEC;
    7582#endif
     83
     84#if ENABLE(WORKERS)
     85        static ThreadSpecific<ThreadGlobalData>* staticData;
     86#else
     87        static ThreadGlobalData* staticData;
     88#endif
     89        friend ThreadGlobalData& threadGlobalData();
    7690    };
    7791
    78     ThreadGlobalData& threadGlobalData();
     92inline ThreadGlobalData& threadGlobalData()
     93{
     94    // FIXME: Workers are not necessarily the only feature that make per-thread global data necessary.
     95    // We need to check for e.g. database objects manipulating strings on secondary threads.
    7996
     97#if ENABLE(WORKERS)
     98    // ThreadGlobalData is used on main thread before it could possibly be used on secondary ones, so there is no need for synchronization here.
     99    if (!ThreadGlobalData::staticData)
     100        ThreadGlobalData::staticData = new ThreadSpecific<ThreadGlobalData>;
     101    return **ThreadGlobalData::staticData;
     102#else
     103    if (!ThreadGlobalData::staticData) {
     104        ThreadGlobalData::staticData = static_cast<ThreadGlobalData*>(fastMalloc(sizeof(ThreadGlobalData)));
     105        // ThreadGlobalData constructor indirectly uses staticData, so we need to set up the memory before invoking it.
     106        new (ThreadGlobalData::staticData) ThreadGlobalData;
     107    }
     108    return *ThreadGlobalData::staticData;
     109#endif
     110}
     111   
    80112} // namespace WebCore
    81113
  • trunk/WebCore/platform/Timer.cpp

    r48086 r53514  
    197197}
    198198
    199 bool TimerBase::isActive() const
    200 {
    201     ASSERT(m_thread == currentThread());
    202 
    203     return m_nextFireTime;
    204 }
    205 
    206199double TimerBase::nextFireInterval() const
    207200{
  • trunk/WebCore/platform/Timer.h

    r45891 r53514  
    102102};
    103103
     104inline bool TimerBase::isActive() const
     105{
     106    ASSERT(m_thread == currentThread());
     107    return m_nextFireTime;
     108}
     109
    104110}
    105111
  • trunk/WebCore/svg/SVGDocument.cpp

    r44808 r53514  
    3737
    3838SVGDocument::SVGDocument(Frame* frame)
    39     : Document(frame, false)
     39    : Document(frame, false, false)
    4040{
    4141}
Note: See TracChangeset for help on using the changeset viewer.