2011-04-15 Geoffrey Garen <ggaren@apple.com>
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Apr 2011 20:47:54 +0000 (20:47 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Apr 2011 20:47:54 +0000 (20:47 +0000)
        Reviewed by Oliver Hunt.

        Some mechanical DOM wrapper cleanup
        https://bugs.webkit.org/show_bug.cgi?id=58689

        * WebCore.exp.in: Export!

        * bindings/js/DOMWrapperWorld.cpp:
        (WebCore::isReachableFromDOM): Inverted the inDocument test to make the
        relationship of the special cases to the normal case clearer.

        * bindings/js/JSArrayBufferViewHelper.h:
        (WebCore::toJSArrayBufferView):
        * bindings/js/JSCSSRuleCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSCSSValueCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSDOMBinding.cpp:
        (WebCore::getCachedDOMObjectWrapper):
        (WebCore::cacheDOMObjectWrapper):
        * bindings/js/JSDOMBinding.h:
        (WebCore::createDOMObjectWrapper):
        (WebCore::getDOMObjectWrapper):
        (WebCore::createDOMNodeWrapper):
        (WebCore::getDOMNodeWrapper): Changed DOM wrapper functions to operate
        in terms of DOMWrapperWorlds instead of ExecStates. This is clearer,
        and ever-so-slightly faster.

        Removed hasCachedXXX functions, now that they're unused.

        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::JSDOMWindow::history):
        (WebCore::JSDOMWindow::location):
        * bindings/js/JSDocumentCustom.cpp:
        (WebCore::JSDocument::location):
        (WebCore::toJS):
        * bindings/js/JSElementCustom.cpp:
        (WebCore::toJSNewlyCreated):
        * bindings/js/JSEventCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSHTMLCollectionCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSImageDataCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSNodeCustom.cpp:
        (WebCore::createWrapperInline):
        * bindings/js/JSNodeCustom.h:
        (WebCore::getCachedDOMNodeWrapper):
        (WebCore::cacheDOMNodeWrapper):
        (WebCore::toJS):
        * bindings/js/JSSVGPathSegCustom.cpp:
        (WebCore::toJS):
        * bindings/js/JSStyleSheetCustom.cpp:
        (WebCore::toJS): Updated for changes above.

        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::dropProtection): Removed use of hasCachedDOMObjectWrapper
        because XHR is almost always created and used by JavaScript, so it's
        simpler to just always report extra cost.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84029 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/DOMWrapperWorld.cpp
Source/WebCore/bindings/js/JSArrayBufferViewHelper.h
Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
Source/WebCore/bindings/js/JSCSSValueCustom.cpp
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/bindings/js/JSDocumentCustom.cpp
Source/WebCore/bindings/js/JSElementCustom.cpp
Source/WebCore/bindings/js/JSEventCustom.cpp
Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
Source/WebCore/bindings/js/JSImageDataCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.h
Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp
Source/WebCore/bindings/js/JSStyleSheetCustom.cpp
Source/WebCore/xml/XMLHttpRequest.cpp

index 55cdd73..ff55dc1 100644 (file)
@@ -1,3 +1,65 @@
+2011-04-15  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        Some mechanical DOM wrapper cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=58689
+
+        * WebCore.exp.in: Export!
+
+        * bindings/js/DOMWrapperWorld.cpp:
+        (WebCore::isReachableFromDOM): Inverted the inDocument test to make the
+        relationship of the special cases to the normal case clearer.
+
+        * bindings/js/JSArrayBufferViewHelper.h:
+        (WebCore::toJSArrayBufferView):
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSCSSValueCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::getCachedDOMObjectWrapper):
+        (WebCore::cacheDOMObjectWrapper):
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::createDOMObjectWrapper):
+        (WebCore::getDOMObjectWrapper):
+        (WebCore::createDOMNodeWrapper):
+        (WebCore::getDOMNodeWrapper): Changed DOM wrapper functions to operate
+        in terms of DOMWrapperWorlds instead of ExecStates. This is clearer,
+        and ever-so-slightly faster.
+        
+        Removed hasCachedXXX functions, now that they're unused.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::history):
+        (WebCore::JSDOMWindow::location):
+        * bindings/js/JSDocumentCustom.cpp:
+        (WebCore::JSDocument::location):
+        (WebCore::toJS):
+        * bindings/js/JSElementCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSHTMLCollectionCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSImageDataCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSNodeCustom.cpp:
+        (WebCore::createWrapperInline):
+        * bindings/js/JSNodeCustom.h:
+        (WebCore::getCachedDOMNodeWrapper):
+        (WebCore::cacheDOMNodeWrapper):
+        (WebCore::toJS):
+        * bindings/js/JSSVGPathSegCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSStyleSheetCustom.cpp:
+        (WebCore::toJS): Updated for changes above.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::dropProtection): Removed use of hasCachedDOMObjectWrapper
+        because XHR is almost always created and used by JavaScript, so it's
+        simpler to just always report extra cost.
+
 2011-04-15  Andreas Kling  <kling@webkit.org>
 
         Rolling out accidental part of r84010.
index beaa399..149c166 100644 (file)
@@ -350,7 +350,6 @@ __ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestERKNS_14SubstituteDataE
 __ZN7WebCore14DocumentLoaderD2Ev
 __ZN7WebCore14DocumentWriter11setEncodingERKN3WTF6StringEb
 __ZN7WebCore14ResourceHandle12releaseProxyEv
-__ZN7WebCore25getCachedDOMObjectWrapperEPN3JSC9ExecStateEPv
 __ZN7WebCore14ResourceHandle20forceContentSniffingEv
 __ZN7WebCore14ResourceLoader14cancelledErrorEv
 __ZN7WebCore14ResourceLoader19setShouldBufferDataEb
@@ -595,6 +594,7 @@ __ZN7WebCore25PluginMainThreadScheduler16unregisterPluginEP4_NPP
 __ZN7WebCore25PluginMainThreadScheduler9schedulerEv
 __ZN7WebCore25addLanguageChangeObserverEPvPFvS0_E
 __ZN7WebCore25contextMenuItemTagOutlineEv
+__ZN7WebCore25getCachedDOMObjectWrapperEPNS_15DOMWrapperWorldEPv
 __ZN7WebCore26CSSMutableStyleDeclarationC1Ev
 __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv
 __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv
index b33443d..95030db 100644 (file)
@@ -120,27 +120,26 @@ static bool isObservable(JSNode* jsNode, Node* node, DOMWrapperWorld* world)
 
 static inline bool isReachableFromDOM(JSNode* jsNode, Node* node, DOMWrapperWorld* world, MarkStack& markStack)
 {
-    if (node->inDocument())
-        return isObservable(jsNode, node, world) && markStack.containsOpaqueRoot(root(node));
-
-    // If a wrapper is the last reference to an image or script element
-    // that is loading but not in the document, the wrapper is observable
-    // because it is the only thing keeping the image element alive, and if
-    // the image element is destroyed, its load event will not fire.
-    // FIXME: The DOM should manage this issue without the help of JavaScript wrappers.
-    if (node->hasTagName(imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent())
-        return true;
-    if (node->hasTagName(scriptTag) && !static_cast<HTMLScriptElement*>(node)->haveFiredLoadEvent())
-        return true;
-#if ENABLE(VIDEO)
-    if (node->hasTagName(audioTag) && !static_cast<HTMLAudioElement*>(node)->paused())
-        return true;
-#endif
-
-    // If a node is firing event listeners, its wrapper is observable because
-    // its wrapper is responsible for marking those event listeners.
-    if (node->isFiringEventListeners())
-        return true;
+    if (!node->inDocument()) {
+        // If a wrapper is the last reference to an image or script element
+        // that is loading but not in the document, the wrapper is observable
+        // because it is the only thing keeping the image element alive, and if
+        // the image element is destroyed, its load event will not fire.
+        // FIXME: The DOM should manage this issue without the help of JavaScript wrappers.
+        if (node->hasTagName(imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent())
+            return true;
+        if (node->hasTagName(scriptTag) && !static_cast<HTMLScriptElement*>(node)->haveFiredLoadEvent())
+            return true;
+    #if ENABLE(VIDEO)
+        if (node->hasTagName(audioTag) && !static_cast<HTMLAudioElement*>(node)->paused())
+            return true;
+    #endif
+
+        // If a node is firing event listeners, its wrapper is observable because
+        // its wrapper is responsible for marking those event listeners.
+        if (node->isFiringEventListeners())
+            return true;
+    }
 
     return isObservable(jsNode, node, world) && markStack.containsOpaqueRoot(root(node));
 }
index cb9981d..b20596b 100644 (file)
@@ -163,7 +163,7 @@ static JSC::JSValue toJSArrayBufferView(JSC::ExecState* exec, JSDOMGlobalObject*
     if (!object)
         return JSC::jsNull();
 
-    if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object))
+    if (DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), object))
         return wrapper;
 
     exec->heap()->reportExtraMemoryCost(object->byteLength());
index 4d226d0..a6d48f0 100644 (file)
@@ -63,7 +63,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule)
     if (!rule)
         return jsNull();
 
-    DOMObject* wrapper = getCachedDOMObjectWrapper(exec, rule);
+    DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), rule);
     if (wrapper)
         return wrapper;
 
index 83c1d3a..ea4a276 100644 (file)
@@ -49,7 +49,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSValue* value)
     if (!value)
         return jsNull();
 
-    DOMObject* wrapper = getCachedDOMObjectWrapper(exec, value);
+    DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), value);
 
     if (wrapper)
         return wrapper;
index 16ed277..c46d34c 100644 (file)
@@ -135,32 +135,13 @@ const JSC::HashTable* getHashTableForGlobalData(JSGlobalData& globalData, const
     return DOMObjectHashTableMap::mapFor(globalData).get(staticTable);
 }
 
-bool hasCachedDOMObjectWrapperUnchecked(JSGlobalData* globalData, void* objectHandle)
+DOMObject* getCachedDOMObjectWrapper(DOMWrapperWorld* world, void* objectHandle) 
 {
-    for (JSGlobalDataWorldIterator worldIter(globalData); worldIter; ++worldIter) {
-        if (worldIter->m_wrappers.get(objectHandle))
-            return true;
-    }
-    return false;
-}
-
-bool hasCachedDOMObjectWrapper(JSGlobalData* globalData, void* objectHandle)
-{
-    for (JSGlobalDataWorldIterator worldIter(globalData); worldIter; ++worldIter) {
-        if (worldIter->m_wrappers.get(objectHandle))
-            return true;
-    }
-    return false;
-}
-
-DOMObject* getCachedDOMObjectWrapper(JSC::ExecState* exec, void* objectHandle) 
-{
-    return domObjectWrapperMapFor(exec).get(objectHandle).get();
+    return world->m_wrappers.get(objectHandle).get();
 }
 
-void cacheDOMObjectWrapper(JSC::ExecState* exec, void* objectHandle, DOMObject* wrapper) 
+void cacheDOMObjectWrapper(DOMWrapperWorld* world, void* objectHandle, DOMObject* wrapper) 
 {
-    DOMWrapperWorld* world = currentWorld(exec);
     world->m_wrappers.set(objectHandle, Weak<DOMObject>(*world->globalData(), wrapper, world->domObjectHandleOwner()));
 }
 
index 9295aaa..fa8f7da 100644 (file)
@@ -113,18 +113,16 @@ namespace WebCore {
         }
     };
 
-    DOMObject* getCachedDOMObjectWrapper(JSC::ExecState*, void* objectHandle);
-    bool hasCachedDOMObjectWrapper(JSC::JSGlobalData*, void* objectHandle);
-    void cacheDOMObjectWrapper(JSC::ExecState*, void* objectHandle, DOMObject* wrapper);
+    DOMObject* getCachedDOMObjectWrapper(DOMWrapperWorld*, void* objectHandle);
+    void cacheDOMObjectWrapper(DOMWrapperWorld*, void* objectHandle, DOMObject* wrapper);
     void uncacheDOMObjectWrapper(DOMWrapperWorld*, void* objectHandle, DOMObject* wrapper);
 
-    JSNode* getCachedDOMNodeWrapper(JSC::ExecState*, Node*);
-    void cacheDOMNodeWrapper(JSC::ExecState*, Node*, JSNode* wrapper);
+    JSNode* getCachedDOMNodeWrapper(DOMWrapperWorld*, Node*);
+    void cacheDOMNodeWrapper(DOMWrapperWorld*, Node*, JSNode* wrapper);
     void uncacheDOMNodeWrapper(DOMWrapperWorld*, Node*, JSNode* wrapper);
     
     void markActiveObjectsForContext(JSC::MarkStack&, JSC::JSGlobalData&, ScriptExecutionContext*);
     void markDOMObjectWrapper(JSC::MarkStack&, JSC::JSGlobalData& globalData, void* object);
-    bool hasCachedDOMObjectWrapperUnchecked(JSC::JSGlobalData*, void* objectHandle);
 
     JSC::Structure* getCachedDOMStructure(JSDOMGlobalObject*, const JSC::ClassInfo*);
     JSC::Structure* cacheDOMStructure(JSDOMGlobalObject*, NonNullPassRefPtr<JSC::Structure>, const JSC::ClassInfo*);
@@ -156,17 +154,17 @@ namespace WebCore {
     template<class WrapperClass, class DOMClass> inline DOMObject* createDOMObjectWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* object)
     {
         ASSERT(object);
-        ASSERT(!getCachedDOMObjectWrapper(exec, object));
+        ASSERT(!getCachedDOMObjectWrapper(currentWorld(exec), object));
         // FIXME: new (exec) could use a different globalData than the globalData this wrapper is cached on.
         WrapperClass* wrapper = new (exec) WrapperClass(getDOMStructure<WrapperClass>(exec, globalObject), globalObject, object);
-        cacheDOMObjectWrapper(exec, object, wrapper);
+        cacheDOMObjectWrapper(currentWorld(exec), object, wrapper);
         return wrapper;
     }
     template<class WrapperClass, class DOMClass> inline JSC::JSValue getDOMObjectWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* object)
     {
         if (!object)
             return JSC::jsNull();
-        if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object))
+        if (DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), object))
             return wrapper;
         return createDOMObjectWrapper<WrapperClass>(exec, globalObject, object);
     }
@@ -175,18 +173,18 @@ namespace WebCore {
     template<class WrapperClass, class DOMClass> inline JSNode* createDOMNodeWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* node)
     {
         ASSERT(node);
-        ASSERT(!getCachedDOMNodeWrapper(exec, node));
+        ASSERT(!getCachedDOMNodeWrapper(currentWorld(exec), node));
         WrapperClass* wrapper = new (exec) WrapperClass(getDOMStructure<WrapperClass>(exec, globalObject), globalObject, node);
         // FIXME: The entire function can be removed, once we fix caching.
         // This function is a one-off hack to make Nodes cache in the right global object.
-        cacheDOMNodeWrapper(exec, node, wrapper);
+        cacheDOMNodeWrapper(currentWorld(exec), node, wrapper);
         return wrapper;
     }
     template<class WrapperClass, class DOMClass> inline JSC::JSValue getDOMNodeWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* node)
     {
         if (!node)
             return JSC::jsNull();
-        if (JSC::JSCell* wrapper = getCachedDOMNodeWrapper(exec, node))
+        if (JSC::JSCell* wrapper = getCachedDOMNodeWrapper(currentWorld(exec), node))
             return wrapper;
         return createDOMNodeWrapper<WrapperClass>(exec, globalObject, node);
     }
index 03f9d68..f1cc355 100644 (file)
@@ -441,24 +441,24 @@ JSValue JSDOMWindow::lookupSetter(ExecState* exec, const Identifier& propertyNam
 JSValue JSDOMWindow::history(ExecState* exec) const
 {
     History* history = impl()->history();
-    if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, history))
+    if (DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), history))
         return wrapper;
 
     JSDOMWindow* window = const_cast<JSDOMWindow*>(this);
     JSHistory* jsHistory = new (exec) JSHistory(getDOMStructure<JSHistory>(exec, window), window, history);
-    cacheDOMObjectWrapper(exec, history, jsHistory);
+    cacheDOMObjectWrapper(currentWorld(exec), history, jsHistory);
     return jsHistory;
 }
 
 JSValue JSDOMWindow::location(ExecState* exec) const
 {
     Location* location = impl()->location();
-    if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, location))
+    if (DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), location))
         return wrapper;
 
     JSDOMWindow* window = const_cast<JSDOMWindow*>(this);
     JSLocation* jsLocation = new (exec) JSLocation(getDOMStructure<JSLocation>(exec, window), window, location);
-    cacheDOMObjectWrapper(exec, location, jsLocation);
+    cacheDOMObjectWrapper(currentWorld(exec), location, jsLocation);
     return jsLocation;
 }
 
index 1316566..33e9802 100644 (file)
@@ -68,11 +68,11 @@ JSValue JSDocument::location(ExecState* exec) const
         return jsNull();
 
     Location* location = frame->domWindow()->location();
-    if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, location))
+    if (DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), location))
         return wrapper;
 
     JSLocation* jsLocation = new (exec) JSLocation(getDOMStructure<JSLocation>(exec, globalObject()), globalObject(), location);
-    cacheDOMObjectWrapper(exec, location, jsLocation);
+    cacheDOMObjectWrapper(currentWorld(exec), location, jsLocation);
     return jsLocation;
 }
 
@@ -100,7 +100,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Document* documen
     if (!document)
         return jsNull();
 
-    DOMObject* wrapper = getCachedDOMNodeWrapper(exec, document);
+    DOMObject* wrapper = getCachedDOMNodeWrapper(currentWorld(exec), document);
     if (wrapper)
         return wrapper;
 
index 62ca04d..545fb19 100644 (file)
@@ -71,7 +71,7 @@ JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, Eleme
     if (!element)
         return jsNull();
 
-    ASSERT(!getCachedDOMNodeWrapper(exec, element));
+    ASSERT(!getCachedDOMNodeWrapper(currentWorld(exec), element));
 
     JSNode* wrapper;        
     if (element->isHTMLElement())
index 9125ed2..64bbe74 100644 (file)
@@ -121,7 +121,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
     if (!event)
         return jsNull();
 
-    DOMObject* wrapper = getCachedDOMObjectWrapper(exec, event);
+    DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), event);
     if (wrapper)
         return wrapper;
 
index 6b2f350..65b4a42 100644 (file)
@@ -134,7 +134,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* c
     if (!collection)
         return jsNull();
 
-    DOMObject* wrapper = getCachedDOMObjectWrapper(exec, collection);
+    DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), collection);
 
     if (wrapper)
         return wrapper;
index a92ed47..9ff38c0 100644 (file)
@@ -41,7 +41,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD
     if (!imageData)
         return jsNull();
     
-    DOMObject* wrapper = getCachedDOMObjectWrapper(exec, imageData);
+    DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), imageData);
     if (wrapper)
         return wrapper;
     
index b54869c..268d5bf 100644 (file)
@@ -130,7 +130,7 @@ void JSNode::markChildren(MarkStack& markStack)
 static ALWAYS_INLINE JSValue createWrapperInline(ExecState* exec, JSDOMGlobalObject* globalObject, Node* node)
 {
     ASSERT(node);
-    ASSERT(!getCachedDOMNodeWrapper(exec, node));
+    ASSERT(!getCachedDOMNodeWrapper(currentWorld(exec), node));
     
     JSNode* wrapper;    
     switch (node->nodeType()) {
index c50716a..04d0492 100644 (file)
 
 namespace WebCore {
 
-inline JSNode* getCachedDOMNodeWrapper(JSC::ExecState* exec, Node* node)
+inline JSNode* getCachedDOMNodeWrapper(DOMWrapperWorld* world, Node* node)
 {
-    if (currentWorld(exec)->isNormal())
+    if (world->isNormal())
         return static_cast<JSNode*>(node->wrapper());
-    return static_cast<JSNode*>(getCachedDOMObjectWrapper(exec, node));
+    return static_cast<JSNode*>(getCachedDOMObjectWrapper(world, node));
 }
 
-inline void cacheDOMNodeWrapper(JSC::ExecState* exec, Node* node, JSNode* wrapper)
+inline void cacheDOMNodeWrapper(DOMWrapperWorld* world, Node* node, JSNode* wrapper)
 {
     ASSERT(wrapper);
-
-    DOMWrapperWorld* world = currentWorld(exec);
     if (world->isNormal()) {
         node->setWrapper(*world->globalData(), wrapper, world->jsNodeHandleOwner());
         return;
     }
-    cacheDOMObjectWrapper(exec, node, wrapper);
+    cacheDOMObjectWrapper(world, node, wrapper);
 }
 
 inline void uncacheDOMNodeWrapper(DOMWrapperWorld* world, Node* node, JSNode* jsNode)
@@ -66,7 +64,7 @@ inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject,
     if (!node)
         return JSC::jsNull();
 
-    JSNode* wrapper = getCachedDOMNodeWrapper(exec, node);
+    JSNode* wrapper = getCachedDOMNodeWrapper(currentWorld(exec), node);
     if (wrapper)
         return wrapper;
 
index f0aa86b..cb9040c 100644 (file)
@@ -63,7 +63,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* objec
     if (!object)
         return jsNull();
 
-    if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object))
+    if (DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), object))
         return wrapper;
 
     switch (object->pathSegType()) {
index 04c6561..298b69d 100644 (file)
@@ -40,7 +40,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, StyleSheet* style
     if (!styleSheet)
         return jsNull();
 
-    DOMObject* wrapper = getCachedDOMObjectWrapper(exec, styleSheet);
+    DOMObject* wrapper = getCachedDOMObjectWrapper(currentWorld(exec), styleSheet);
     if (wrapper)
         return wrapper;
 
index 3d3c12e..41d8afb 100644 (file)
@@ -784,11 +784,9 @@ void XMLHttpRequest::dropProtection()
     // out. But it is protected from GC while loading, so this
     // can't be recouped until the load is done, so only
     // report the extra cost at that point.
+    JSC::JSLock lock(JSC::SilenceAssertionsOnly);
     JSC::JSGlobalData* globalData = scriptExecutionContext()->globalData();
-    if (hasCachedDOMObjectWrapper(globalData, this)) {
-        JSC::JSLock lock(JSC::SilenceAssertionsOnly);
-        globalData->heap.reportExtraMemoryCost(m_responseBuilder.length() * 2);
-    }
+    globalData->heap.reportExtraMemoryCost(m_responseBuilder.length() * 2);
 #endif
 
     unsetPendingActivity(this);