JSC bindings should use the passed-in global object for wrapper caching.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Mar 2014 20:42:55 +0000 (20:42 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Mar 2014 20:42:55 +0000 (20:42 +0000)
<https://webkit.org/b/130458>

Take a shorter path to the DOMWrapperWorld by using the passed-in
global object instead of getting the lexical global from ExecState.
Removed an old FIXME that no longer applies since JSObjects can
always find the right global object these days.

Reviewed by Geoff Garen.

* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJS):
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
* bindings/js/JSCSSValueCustom.cpp:
(WebCore::toJS):
* bindings/js/JSDOMBinding.h:
(WebCore::createWrapper):
(WebCore::wrap):
(WebCore::getExistingWrapper):
(WebCore::createNewWrapper):
(WebCore::toJS):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setTimeout):
(WebCore::JSDOMWindow::setInterval):
(WebCore::JSDOMWindow::addEventListener):
(WebCore::JSDOMWindow::removeEventListener):
* 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/JSHTMLTemplateElementCustom.cpp:
(WebCore::JSHTMLTemplateElement::content):
* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJS):
* bindings/js/JSNodeCustom.cpp:
(WebCore::createWrapperInline):
* bindings/js/JSNodeCustom.h:
(WebCore::toJS):
* bindings/js/JSSVGPathSegCustom.cpp:
(WebCore::toJS):
* bindings/js/JSStyleSheetCustom.cpp:
(WebCore::toJS):
* bindings/js/JSTextTrackCueCustom.cpp:
(WebCore::toJS):
* bindings/js/JSTrackCustom.cpp:
(WebCore::toJS):
* bindings/js/JSWorkerGlobalScopeCustom.cpp:
(WebCore::JSWorkerGlobalScope::setTimeout):
(WebCore::JSWorkerGlobalScope::setInterval):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):

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

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCSSRuleCustom.cpp
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
Source/WebCore/bindings/js/JSCSSValueCustom.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/JSHTMLTemplateElementCustom.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/bindings/js/JSTextTrackCueCustom.cpp
Source/WebCore/bindings/js/JSTrackCustom.cpp
Source/WebCore/bindings/js/JSWorkerGlobalScopeCustom.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

index 142d8aebe2201019880fbb3dec3bd73b7b2a2822..77e77606541d302b9d307acde9d91b25e4503b42 100644 (file)
@@ -1,3 +1,63 @@
+2014-03-19  Andreas Kling  <akling@apple.com>
+
+        JSC bindings should use the passed-in global object for wrapper caching.
+        <https://webkit.org/b/130458>
+
+        Take a shorter path to the DOMWrapperWorld by using the passed-in
+        global object instead of getting the lexical global from ExecState.
+        Removed an old FIXME that no longer applies since JSObjects can
+        always find the right global object these days.
+
+        Reviewed by Geoff Garen.
+
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
+        * bindings/js/JSCSSValueCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::createWrapper):
+        (WebCore::wrap):
+        (WebCore::getExistingWrapper):
+        (WebCore::createNewWrapper):
+        (WebCore::toJS):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::setTimeout):
+        (WebCore::JSDOMWindow::setInterval):
+        (WebCore::JSDOMWindow::addEventListener):
+        (WebCore::JSDOMWindow::removeEventListener):
+        * 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/JSHTMLTemplateElementCustom.cpp:
+        (WebCore::JSHTMLTemplateElement::content):
+        * bindings/js/JSImageDataCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSNodeCustom.cpp:
+        (WebCore::createWrapperInline):
+        * bindings/js/JSNodeCustom.h:
+        (WebCore::toJS):
+        * bindings/js/JSSVGPathSegCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSStyleSheetCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSTextTrackCueCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSTrackCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSWorkerGlobalScopeCustom.cpp:
+        (WebCore::JSWorkerGlobalScope::setTimeout):
+        (WebCore::JSWorkerGlobalScope::setInterval):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+
 2014-03-19  Benjamin Poulain  <bpoulain@apple.com>
 
         Page::setPageScaleFactor should not force the scroll view position when using delegatesScrolling()
index 17aedd39054a713222cb640b42cbc8a1d1918a74..5c20082add67a29db2988fa7ba2964c95a86ac78 100644 (file)
@@ -70,7 +70,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSRule* rule)
     if (!rule)
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), rule);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), rule);
     if (wrapper)
         return wrapper;
 
index e75a2d18b3267e3f46aeac19b1c74fdef3f2c9a9..80f72ec06dc2744bdd83cabe01bb0325d39b3c2c 100644 (file)
@@ -376,7 +376,7 @@ JSValue JSCSSStyleDeclaration::getPropertyCSSValue(ExecState* exec)
     if (!cssValue)
         return jsNull();
 
-    currentWorld(exec).m_cssValueRoots.add(cssValue.get(), root(&impl())); // Balanced by JSCSSValueOwner::finalize().
+    globalObject()->world().m_cssValueRoots.add(cssValue.get(), root(&impl())); // Balanced by JSCSSValueOwner::finalize().
     return toJS(exec, globalObject(), WTF::getPtr(cssValue));
 }
 
index e614d4341521493d94942fd61a85516c55451174..0b2daaa87b8090dba0d3f0635a10fd2b929fe5ba 100644 (file)
@@ -80,7 +80,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, CSSValue* value)
     if (!value->isCSSOMSafe())
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), value);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), value);
 
     if (wrapper)
         return wrapper;
index eea97721848e59124ac2dc62a5198fe3f45e119b..dc1f862b4c8a2146384fc3d1ed94b38159d7facd 100644 (file)
@@ -199,11 +199,9 @@ template <typename DOMClass, typename WrapperClass> inline void uncacheWrapper(D
 template<class WrapperClass, class DOMClass> inline JSDOMWrapper* createWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* node)
 {
     ASSERT(node);
-    ASSERT(!getCachedWrapper(currentWorld(exec), node));
+    ASSERT(!getCachedWrapper(globalObject->world(), node));
     WrapperClass* wrapper = WrapperClass::create(getDOMStructure<WrapperClass>(exec->vm(), 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.
-    cacheWrapper(currentWorld(exec), node, wrapper);
+    cacheWrapper(globalObject->world(), node, wrapper);
     return wrapper;
 }
 
@@ -211,21 +209,21 @@ template<class WrapperClass, class DOMClass> inline JSC::JSValue wrap(JSC::ExecS
 {
     if (!domObject)
         return JSC::jsNull();
-    if (JSC::JSObject* wrapper = getCachedWrapper(currentWorld(exec), domObject))
+    if (JSC::JSObject* wrapper = getCachedWrapper(globalObject->world(), domObject))
         return wrapper;
     return createWrapper<WrapperClass>(exec, globalObject, domObject);
 }
 
-template<class WrapperClass, class DOMClass> inline JSC::JSValue getExistingWrapper(JSC::ExecState* exec, DOMClass* domObject)
+template<class WrapperClass, class DOMClass> inline JSC::JSValue getExistingWrapper(JSDOMGlobalObject* globalObject, DOMClass* domObject)
 {
     ASSERT(domObject);
-    return getCachedWrapper(currentWorld(exec), domObject);
+    return getCachedWrapper(globalObject->world(), domObject);
 }
 
 template<class WrapperClass, class DOMClass> inline JSC::JSValue createNewWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* domObject)
 {
     ASSERT(domObject);
-    ASSERT(!getCachedWrapper(currentWorld(exec), domObject));
+    ASSERT(!getCachedWrapper(globalObject->world(), domObject));
     return createWrapper<WrapperClass>(exec, globalObject, domObject);
 }
 
@@ -348,11 +346,11 @@ inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject,
 {
     if (!buffer)
         return JSC::jsNull();
-    if (JSC::JSValue result = getExistingWrapper<JSC::JSArrayBuffer>(exec, buffer))
+    if (JSC::JSValue result = getExistingWrapper<JSC::JSArrayBuffer>(globalObject, buffer))
         return result;
     buffer->ref();
     JSC::JSArrayBuffer* wrapper = JSC::JSArrayBuffer::create(exec->vm(), globalObject->arrayBufferStructure(), buffer);
-    cacheWrapper(currentWorld(exec), buffer, wrapper);
+    cacheWrapper(globalObject->world(), buffer, wrapper);
     return wrapper;
 }
 
index e92631909a1513ff76027851933291e86363685d..94b75e145458f68a75091f47ebd2aac5f95bc35e 100644 (file)
@@ -594,7 +594,7 @@ JSValue JSDOMWindow::postMessage(ExecState* exec)
 JSValue JSDOMWindow::setTimeout(ExecState* exec)
 {
     ContentSecurityPolicy* contentSecurityPolicy = impl().document() ? impl().document()->contentSecurityPolicy() : 0;
-    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec), contentSecurityPolicy);
+    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, globalObject()->world(), contentSecurityPolicy);
     if (exec->hadException())
         return jsUndefined();
 
@@ -613,7 +613,7 @@ JSValue JSDOMWindow::setTimeout(ExecState* exec)
 JSValue JSDOMWindow::setInterval(ExecState* exec)
 {
     ContentSecurityPolicy* contentSecurityPolicy = impl().document() ? impl().document()->contentSecurityPolicy() : 0;
-    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec), contentSecurityPolicy);
+    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, globalObject()->world(), contentSecurityPolicy);
     if (exec->hadException())
         return jsUndefined();
     int delay = exec->argument(1).toInt32(exec);
@@ -638,7 +638,7 @@ JSValue JSDOMWindow::addEventListener(ExecState* exec)
     if (!listener.isObject())
         return jsUndefined();
 
-    impl().addEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)), exec->argument(2).toBoolean(exec));
+    impl().addEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), this, false, globalObject()->world()), exec->argument(2).toBoolean(exec));
     return jsUndefined();
 }
 
@@ -652,7 +652,7 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec)
     if (!listener.isObject())
         return jsUndefined();
 
-    impl().removeEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), this, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec));
+    impl().removeEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), this, false, globalObject()->world()).get(), exec->argument(2).toBoolean(exec));
     return jsUndefined();
 }
 
index 8f69eb84346180637ff0f715fc4b21846838c58d..1cc585bd3e56cb8bdab43afcd294e9295440682a 100644 (file)
@@ -53,11 +53,11 @@ JSValue JSDocument::location(ExecState* exec) const
         return jsNull();
 
     Location* location = frame->document()->domWindow()->location();
-    if (JSObject* wrapper = getCachedWrapper(currentWorld(exec), location))
+    if (JSObject* wrapper = getCachedWrapper(globalObject()->world(), location))
         return wrapper;
 
     JSLocation* jsLocation = JSLocation::create(getDOMStructure<JSLocation>(exec->vm(), globalObject()), globalObject(), location);
-    cacheWrapper(currentWorld(exec), location, jsLocation);
+    cacheWrapper(globalObject()->world(), location, jsLocation);
     return jsLocation;
 }
 
@@ -80,14 +80,14 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Document* documen
     if (!document)
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), document);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), document);
     if (wrapper)
         return wrapper;
 
     if (DOMWindow* domWindow = document->domWindow()) {
         globalObject = toJSDOMWindow(toJS(exec, domWindow));
         // Creating a wrapper for domWindow might have created a wrapper for document as well.
-        wrapper = getCachedWrapper(currentWorld(exec), document);
+        wrapper = getCachedWrapper(globalObject->world(), document);
         if (wrapper)
             return wrapper;
     }
index bf7150e94d3cd722b3969e0293f041af2ce17793..ca526f25fa9a66d7b2f45add26d68df49cb3a6ef 100644 (file)
@@ -53,7 +53,7 @@ JSValue toJSNewlyCreated(ExecState* exec, JSDOMGlobalObject* globalObject, Eleme
     if (!element)
         return jsNull();
 
-    ASSERT(!getCachedWrapper(currentWorld(exec), element));
+    ASSERT(!getCachedWrapper(globalObject->world(), element));
 
     JSDOMWrapper* wrapper;        
     if (element->isHTMLElement())
index ea561d092187b807c6c5c7a96c94c90596e96b07..bea9bbf539aa63d274767440dee7d828162540f9 100644 (file)
@@ -59,7 +59,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
     if (!event)
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), event);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), event);
     if (wrapper)
         return wrapper;
 
index 1b02cb2a6bfba36f94a7fccad954845fe0142f6d..b36b54df15717a3a5591ff5591f0b75f01321ccf 100644 (file)
@@ -57,7 +57,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, HTMLCollection* c
     if (!collection)
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), collection);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), collection);
 
     if (wrapper)
         return wrapper;
index e4cda2baf34fd36666c404f94b6e1b0359894aac..2d7f5c4c884f5b24b000ecb1e37603773386c2c7 100644 (file)
@@ -49,7 +49,7 @@ JSValue JSHTMLTemplateElement::content(ExecState* exec) const
 
     DocumentFragment* content = impl().content();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), content);
+    JSObject* wrapper = getCachedWrapper(globalObject()->world(), content);
     if (wrapper)
         return wrapper;
 
index 1576d5e58285b031eda3f07f48fe5e05c8ede1d4..b0d1d61601c42266f9640c894457b0ad81b59ca7 100644 (file)
@@ -39,7 +39,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD
     if (!imageData)
         return jsNull();
     
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), imageData);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), imageData);
     if (wrapper)
         return wrapper;
     
index 51529085f9dfe0ec74fa6004a91a9326a3291c7e..b9c66294852f7f44a6e8bbbe89ae4cec31298acb 100644 (file)
@@ -196,7 +196,7 @@ void JSNode::visitChildren(JSCell* cell, SlotVisitor& visitor)
 static ALWAYS_INLINE JSValue createWrapperInline(ExecState* exec, JSDOMGlobalObject* globalObject, Node* node)
 {
     ASSERT(node);
-    ASSERT(!getCachedWrapper(currentWorld(exec), node));
+    ASSERT(!getCachedWrapper(globalObject->world(), node));
     
     JSDOMWrapper* wrapper;    
     switch (node->nodeType()) {
index 85caa4030bc3201847357bd98b5ab3e6196909a5..bf7c9a1a070e84d6ef11ff4abc143971bb7cc017 100644 (file)
@@ -40,7 +40,7 @@ inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject,
     if (!node)
         return JSC::jsNull();
 
-    JSNode* wrapper = JSC::jsCast<JSNode*>(getCachedWrapper(currentWorld(exec), node));
+    JSNode* wrapper = JSC::jsCast<JSNode*>(getCachedWrapper(globalObject->world(), node));
     if (wrapper)
         return wrapper;
 
index 779fedc1eefc2a480a0f116a34e7bbc25bc2a3be..dbae457659ad39c4649793ae624cdc2a60ba9853 100644 (file)
@@ -64,7 +64,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, SVGPathSeg* objec
     if (!object)
         return jsNull();
 
-    if (JSObject* wrapper = getCachedWrapper(currentWorld(exec), object))
+    if (JSObject* wrapper = getCachedWrapper(globalObject->world(), object))
         return wrapper;
 
     switch (object->pathSegType()) {
index e7d05b1341c8795388b8421fcb1033672c0e21b1..9c0b6b3d3507ab193aa013ade52854a92c28cf68 100644 (file)
@@ -50,7 +50,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, StyleSheet* style
     if (!styleSheet)
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), styleSheet);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), styleSheet);
     if (wrapper)
         return wrapper;
 
index 3dce677b6790e73cac2e041d2ad26fcb14b59f14..578542b07ccdab550adf2cd296a3a950fe27f55e 100644 (file)
@@ -63,7 +63,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, TextTrackCue* cue
     if (!cue)
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), cue);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), cue);
 
     if (wrapper)
         return wrapper;
index f55a60e8d372a4c5fddd9e44b681f1f029a600a1..b65c025f23cf7437d8d2be17887193d2a5d16997 100644 (file)
@@ -57,7 +57,7 @@ JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TrackBa
     if (!track)
         return jsNull();
     
-    JSObject* wrapper = getCachedWrapper(currentWorld(exec), track);
+    JSObject* wrapper = getCachedWrapper(globalObject->world(), track);
     if (wrapper)
         return wrapper;
     
index d12d98e848c7f6992c3f1854c9c2b50dc6b48dd6..6977196c06ada74fc7813ae0d736d6369dcdeb2e 100644 (file)
@@ -95,7 +95,7 @@ JSValue JSWorkerGlobalScope::importScripts(ExecState* exec)
 
 JSValue JSWorkerGlobalScope::setTimeout(ExecState* exec)
 {
-    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec), impl().contentSecurityPolicy());
+    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, globalObject()->world(), impl().contentSecurityPolicy());
     if (exec->hadException())
         return jsUndefined();
     if (!action)
@@ -106,7 +106,7 @@ JSValue JSWorkerGlobalScope::setTimeout(ExecState* exec)
 
 JSValue JSWorkerGlobalScope::setInterval(ExecState* exec)
 {
-    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, currentWorld(exec), impl().contentSecurityPolicy());
+    OwnPtr<ScheduledAction> action = ScheduledAction::create(exec, globalObject()->world(), impl().contentSecurityPolicy());
     if (exec->hadException())
         return jsUndefined();
     if (!action)
index 02c834eb49f215f9ba24d905f5ae355c4826ad14..6e5184f6338c899f6cc0733a99ee265bbdce70f5 100644 (file)
@@ -3032,10 +3032,10 @@ END
 END
 
         if ($svgPropertyType) {
-            push(@implContent, "    if (JSValue result = getExistingWrapper<$className, $implType>(exec, impl))\n");
+            push(@implContent, "    if (JSValue result = getExistingWrapper<$className, $implType>(globalObject, impl))\n");
             push(@implContent, "        return result;\n");
         } else {
-            push(@implContent, "    if (JSValue result = getExistingWrapper<$className>(exec, impl))\n");
+            push(@implContent, "    if (JSValue result = getExistingWrapper<$className>(globalObject, impl))\n");
             push(@implContent, "        return result;\n");
         }
         push(@implContent, <<END) if $vtableNameGnu;