+2014-10-17 Andreas Kling <akling@apple.com>
+
+ Get rid of wrapperContext() in DOM bindings.
+ <https://webkit.org/b/137834>
+
+ Reviewed by Chris Dumez.
+
+ The "wrapper context" is always the DOMWrapperWorld, and since we're passing that around
+ already, we don't need a separate mechanism to get at the context.
+
+ The context is extra data stored in the DOM object's JSC::Weak (the wrapper GC object.)
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::setInlineCachedWrapper):
+ (WebCore::cacheWrapper):
+ (WebCore::wrapperContext): Deleted.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateHeader):
+
2014-10-17 Benjamin Poulain <benjamin@webkit.org>
Make a better use of the available registers when compiling nested selector lists
return static_cast<WebCoreTypedArrayController*>(world.vm().m_typedArrayController.get())->wrapperOwner();
}
-inline void* wrapperContext(DOMWrapperWorld& world, JSC::ArrayBuffer*)
-{
- return &world;
-}
-
inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld&, void*) { return nullptr; }
-inline bool setInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMWrapper*, JSC::WeakHandleOwner*, void*) { return false; }
+inline bool setInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMWrapper*, JSC::WeakHandleOwner*) { return false; }
inline bool clearInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMWrapper*) { return false; }
inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject)
return buffer->m_wrapper.get();
}
-inline bool setInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject, JSDOMWrapper* wrapper, JSC::WeakHandleOwner* wrapperOwner, void* context)
+inline bool setInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject, JSDOMWrapper* wrapper, JSC::WeakHandleOwner* wrapperOwner)
{
if (!world.isNormal())
return false;
- domObject->setWrapper(wrapper, wrapperOwner, context);
+ domObject->setWrapper(wrapper, wrapperOwner, &world);
return true;
}
-inline bool setInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* domObject, JSC::JSArrayBuffer* wrapper, JSC::WeakHandleOwner* wrapperOwner, void* context)
+inline bool setInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* domObject, JSC::JSArrayBuffer* wrapper, JSC::WeakHandleOwner* wrapperOwner)
{
if (!world.isNormal())
return false;
- domObject->m_wrapper = JSC::Weak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, context);
+ domObject->m_wrapper = JSC::Weak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, &world);
return true;
}
template<typename DOMClass, typename WrapperClass> inline void cacheWrapper(DOMWrapperWorld& world, DOMClass* domObject, WrapperClass* wrapper)
{
JSC::WeakHandleOwner* owner = wrapperOwner(world, domObject);
- void* context = wrapperContext(world, domObject);
- if (setInlineCachedWrapper(world, domObject, wrapper, owner, context))
+ if (setInlineCachedWrapper(world, domObject, wrapper, owner))
return;
- weakAdd(world.m_wrappers, (void*)domObject, JSC::Weak<JSC::JSObject>(wrapper, owner, context));
+ weakAdd(world.m_wrappers, (void*)domObject, JSC::Weak<JSC::JSObject>(wrapper, owner, &world));
}
template<typename DOMClass, typename WrapperClass> inline void uncacheWrapper(DOMWrapperWorld& world, DOMClass* domObject, WrapperClass* wrapper)
push(@headerContent, " return &js${interfaceName}Owner;\n");
push(@headerContent, "}\n");
push(@headerContent, "\n");
- push(@headerContent, "inline void* wrapperContext(DOMWrapperWorld& world, $implType*)\n");
- push(@headerContent, "{\n");
- push(@headerContent, " return &world;\n");
- push(@headerContent, "}\n");
- push(@headerContent, "\n");
}
if (ShouldGenerateToJSDeclaration($hasParent, $interface)) {
push(@headerContent, "WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n");
return &jsTestActiveDOMObjectOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestActiveDOMObject*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestActiveDOMObject*);
return &jsTestCustomNamedGetterOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestCustomNamedGetter*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCustomNamedGetter*);
return &jsTestEventConstructorOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestEventConstructor*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventConstructor*);
bool fillTestEventConstructorInit(TestEventConstructorInit&, JSDictionary&);
return &jsTestEventTargetOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestEventTarget*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventTarget*);
return &jsTestExceptionOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestException*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestException*);
return &jsTestGenerateIsReachableOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestGenerateIsReachable*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestGenerateIsReachable*);
return &jsTestInterfaceOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestInterface*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestInterface*);
return &jsTestMediaQueryListListenerOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestMediaQueryListListener*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestMediaQueryListListener*);
return &jsTestNamedConstructorOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestNamedConstructor*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedConstructor*);
return &jsTestNondeterministicOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestNondeterministic*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNondeterministic*);
return &jsTestObjOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestObj*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*);
return &jsTestOverloadedConstructorsOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestOverloadedConstructors*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestOverloadedConstructors*);
return &jsTestSerializedScriptValueInterfaceOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestSerializedScriptValueInterface*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestSerializedScriptValueInterface*);
return &jsTestTypedefsOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, TestTypedefs*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestTypedefs*);
return &jsattributeOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, attribute*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, attribute*);
return &jsreadonlyOwner;
}
-inline void* wrapperContext(DOMWrapperWorld& world, readonly*)
-{
- return &world;
-}
-
WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, readonly*);