Title: [201129] trunk/Source/WebCore
Revision
201129
Author
[email protected]
Date
2016-05-19 00:32:48 -0700 (Thu, 19 May 2016)

Log Message

Refactor toJS functions to use toJSNewlyCreated
https://bugs.webkit.org/show_bug.cgi?id=157835

Reviewed by Chris Dumez.

Moving checks generated by binding generator from toJS to toJSNewlyCreated.
Changing wrap template function to use toJSNewlyCreated function.
This allows DOMClass toJS() to be equivalent to wrap template function.

Refactored custom binding code to take benefit of this.

Covered by existing tests.

* bindings/js/JSAnimationTimelineCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSBlobCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSCSSValueCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSCanvasRenderingContextCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSDOMBinding.h:
(WebCore::wrap):
(WebCore::toJS):
* bindings/js/JSDocumentCustom.cpp:
(WebCore::toJS):
(WebCore::cachedDocumentWrapper): Deleted.
* bindings/js/JSDocumentFragmentCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSEventCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSHTMLTemplateElementCustom.cpp:
(WebCore::JSHTMLTemplateElement::content):
* bindings/js/JSIDBCursorCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSMediaStreamCapabilitiesCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSNodeListCustom.h:
(WebCore::toJS):
* bindings/js/JSPerformanceEntryCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSSVGPathSegCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSStyleSheetCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSTextCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSTextTrackCueCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSTrackCustom.cpp:
(WebCore::toJS):
* bindings/js/JSXMLDocumentCustom.cpp:
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
* bindings/scripts/test/JS/JSTestException.cpp:
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
* bindings/scripts/test/JS/JSTestInterface.cpp:
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
* bindings/scripts/test/JS/JSattribute.cpp:
* bindings/scripts/test/JS/JSreadonly.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201128 => 201129)


--- trunk/Source/WebCore/ChangeLog	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/ChangeLog	2016-05-19 07:32:48 UTC (rev 201129)
@@ -1,5 +1,109 @@
 2016-05-19  Youenn Fablet  <[email protected]>
 
+        Refactor toJS functions to use toJSNewlyCreated
+        https://bugs.webkit.org/show_bug.cgi?id=157835
+
+        Reviewed by Chris Dumez.
+
+        Moving checks generated by binding generator from toJS to toJSNewlyCreated.
+        Changing wrap template function to use toJSNewlyCreated function.
+        This allows DOMClass toJS() to be equivalent to wrap template function.
+
+        Refactored custom binding code to take benefit of this.
+
+        Covered by existing tests.
+
+        * bindings/js/JSAnimationTimelineCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSBlobCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSCSSValueCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSCanvasRenderingContextCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::wrap):
+        (WebCore::toJS):
+        * bindings/js/JSDocumentCustom.cpp:
+        (WebCore::toJS):
+        (WebCore::cachedDocumentWrapper): Deleted.
+        * bindings/js/JSDocumentFragmentCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSHTMLCollectionCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSHTMLTemplateElementCustom.cpp:
+        (WebCore::JSHTMLTemplateElement::content):
+        * bindings/js/JSIDBCursorCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSImageDataCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSMediaStreamCapabilitiesCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSNodeListCustom.h:
+        (WebCore::toJS):
+        * bindings/js/JSPerformanceEntryCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSSVGPathSegCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSStyleSheetCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSTextCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSTextTrackCueCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/js/JSTrackCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSXMLDocumentCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
+        * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
+        * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
+        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+        * bindings/scripts/test/JS/JSTestException.cpp:
+        * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
+        * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
+        * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+        * bindings/scripts/test/JS/JSattribute.cpp:
+        * bindings/scripts/test/JS/JSreadonly.cpp:
+
+2016-05-19  Youenn Fablet  <[email protected]>
+
         Make binding DOM constructor use toJSNewlyCreated instead of toJS
         https://bugs.webkit.org/show_bug.cgi?id=157832
 

Modified: trunk/Source/WebCore/bindings/js/JSAnimationTimelineCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSAnimationTimelineCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSAnimationTimelineCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -39,14 +39,16 @@
 
 namespace WebCore {
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, AnimationTimeline& value)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<AnimationTimeline>&& value)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), value))
-        return wrapper;
+    if (value->isDocumentTimeline())
+        return CREATE_DOM_WRAPPER(globalObject, DocumentTimeline, WTFMove(value));
+    return CREATE_DOM_WRAPPER(globalObject, AnimationTimeline, WTFMove(value));
+}
 
-    if (value.isDocumentTimeline())
-        return CREATE_DOM_WRAPPER(globalObject, DocumentTimeline, value);
-    return CREATE_DOM_WRAPPER(globalObject, AnimationTimeline, value);
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, AnimationTimeline& value)
+{
+    return wrap(state, globalObject, value);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -48,12 +48,16 @@
 
 namespace WebCore {
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, Blob& blob)
+JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<Blob>&& blob)
 {
     if (is<File>(blob))
-        return wrap<JSFile>(globalObject, downcast<File>(blob));
+        return CREATE_DOM_WRAPPER(globalObject, File, WTFMove(blob));
+    return createWrapper<JSBlob>(globalObject, WTFMove(blob));
+}
 
-    return wrap<JSBlob>(globalObject, blob);
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, Blob& blob)
+{
+    return wrap(state, globalObject, blob);
 }
 
 EncodedJSValue JSC_HOST_CALL constructJSBlob(ExecState* exec)

Modified: trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -60,55 +60,43 @@
     visitor.addOpaqueRoot(root(&wrapped()));
 }
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, CSSRule& rule)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<CSSRule>&& rule)
 {
-    JSObject* wrapper = getCachedWrapper(globalObject->world(), rule);
-    if (wrapper)
-        return wrapper;
-
-    switch (rule.type()) {
-        case CSSRule::STYLE_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSStyleRule, rule);
-            break;
-        case CSSRule::MEDIA_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSMediaRule, rule);
-            break;
-        case CSSRule::FONT_FACE_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSFontFaceRule, rule);
-            break;
-        case CSSRule::PAGE_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSPageRule, rule);
-            break;
-        case CSSRule::IMPORT_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSImportRule, rule);
-            break;
-        case CSSRule::CHARSET_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSCharsetRule, rule);
-            break;
-        case CSSRule::KEYFRAME_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSKeyframeRule, rule);
-            break;
-        case CSSRule::KEYFRAMES_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSKeyframesRule, rule);
-            break;
-        case CSSRule::SUPPORTS_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSSupportsRule, rule);
-            break;
+    switch (rule->type()) {
+    case CSSRule::STYLE_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSStyleRule, WTFMove(rule));
+    case CSSRule::MEDIA_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSMediaRule, WTFMove(rule));
+    case CSSRule::FONT_FACE_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSFontFaceRule, WTFMove(rule));
+    case CSSRule::PAGE_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSPageRule, WTFMove(rule));
+    case CSSRule::IMPORT_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSImportRule, WTFMove(rule));
+    case CSSRule::CHARSET_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSCharsetRule, WTFMove(rule));
+    case CSSRule::KEYFRAME_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSKeyframeRule, WTFMove(rule));
+    case CSSRule::KEYFRAMES_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSKeyframesRule, WTFMove(rule));
+    case CSSRule::SUPPORTS_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, CSSSupportsRule, WTFMove(rule));
 #if ENABLE(CSS_DEVICE_ADAPTATION)
-        case CSSRule::WEBKIT_VIEWPORT_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, WebKitCSSViewportRule, rule);
-            break;
+    case CSSRule::WEBKIT_VIEWPORT_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, WebKitCSSViewportRule, WTFMove(rule));
 #endif
 #if ENABLE(CSS_REGIONS)
-        case CSSRule::WEBKIT_REGION_RULE:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, WebKitCSSRegionRule, rule);
-            break;
+    case CSSRule::WEBKIT_REGION_RULE:
+        return CREATE_DOM_WRAPPER(globalObject, WebKitCSSRegionRule, WTFMove(rule));
 #endif
-        default:
-            wrapper = CREATE_DOM_WRAPPER(globalObject, CSSRule, rule);
+    default:
+        return CREATE_DOM_WRAPPER(globalObject, CSSRule, WTFMove(rule));
     }
+}
 
-    return wrapper;
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CSSRule& object)
+{
+    return wrap(state, globalObject, object);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSCSSValueCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSCSSValueCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSCSSValueCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -64,8 +64,25 @@
     uncacheWrapper(world, &jsCSSValue->wrapped(), jsCSSValue);
 }
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, CSSValue& value)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<CSSValue>&& value)
 {
+    if (value->isWebKitCSSTransformValue())
+        return CREATE_DOM_WRAPPER(globalObject, WebKitCSSTransformValue, WTFMove(value));
+    if (value->isWebKitCSSFilterValue())
+        return CREATE_DOM_WRAPPER(globalObject, WebKitCSSFilterValue, WTFMove(value));
+    if (value->isValueList())
+        return CREATE_DOM_WRAPPER(globalObject, CSSValueList, WTFMove(value));
+    if (value->isSVGPaint())
+        return CREATE_DOM_WRAPPER(globalObject, SVGPaint, WTFMove(value));
+    if (value->isSVGColor())
+        return CREATE_DOM_WRAPPER(globalObject, SVGColor, WTFMove(value));
+    if (value->isPrimitiveValue())
+        return CREATE_DOM_WRAPPER(globalObject, CSSPrimitiveValue, WTFMove(value));
+    return CREATE_DOM_WRAPPER(globalObject, CSSValue, WTFMove(value));
+}
+
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CSSValue& value)
+{
     // Scripts should only ever see cloned CSSValues, never the internal ones.
     ASSERT(value.isCSSOMSafe());
 
@@ -73,27 +90,7 @@
     if (!value.isCSSOMSafe())
         return jsNull();
 
-    JSObject* wrapper = getCachedWrapper(globalObject->world(), value);
-
-    if (wrapper)
-        return wrapper;
-
-    if (value.isWebKitCSSTransformValue())
-        wrapper = CREATE_DOM_WRAPPER(globalObject, WebKitCSSTransformValue, value);
-    else if (value.isWebKitCSSFilterValue())
-        wrapper = CREATE_DOM_WRAPPER(globalObject, WebKitCSSFilterValue, value);
-    else if (value.isValueList())
-        wrapper = CREATE_DOM_WRAPPER(globalObject, CSSValueList, value);
-    else if (value.isSVGPaint())
-        wrapper = CREATE_DOM_WRAPPER(globalObject, SVGPaint, value);
-    else if (value.isSVGColor())
-        wrapper = CREATE_DOM_WRAPPER(globalObject, SVGColor, value);
-    else if (value.isPrimitiveValue())
-        wrapper = CREATE_DOM_WRAPPER(globalObject, CSSPrimitiveValue, value);
-    else
-        wrapper = CREATE_DOM_WRAPPER(globalObject, CSSValue, value);
-
-    return wrapper;
+    return wrap(state, globalObject, value);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSCanvasRenderingContextCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -47,17 +47,22 @@
     visitor.addOpaqueRoot(root(wrapped().canvas()));
 }
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, CanvasRenderingContext& object)
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<CanvasRenderingContext>&& object)
 {
 #if ENABLE(WEBGL)
     if (is<WebGLRenderingContext>(object))
-        return wrap<JSWebGLRenderingContext>(globalObject, downcast<WebGLRenderingContext>(object));
+        return CREATE_DOM_WRAPPER(globalObject, WebGLRenderingContext, WTFMove(object));
 #if ENABLE(WEBGL2)
     if (is<WebGL2RenderingContext>(object))
-        return wrap<JSWebGL2RenderingContext>(globalObject, downcast<WebGL2RenderingContext>(object));
+        return CREATE_DOM_WRAPPER(globalObject, WebGL2RenderingContext, WTFMove(object));
 #endif
 #endif
-    return wrap<JSCanvasRenderingContext2D>(globalObject, downcast<CanvasRenderingContext2D>(object));
+    return CREATE_DOM_WRAPPER(globalObject, CanvasRenderingContext2D, WTFMove(object));
 }
 
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, CanvasRenderingContext& object)
+{
+    return wrap(state, globalObject, object);
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2016-05-19 07:32:48 UTC (rev 201129)
@@ -165,8 +165,7 @@
 template<typename DOMClass, typename WrapperClass> void uncacheWrapper(DOMWrapperWorld&, DOMClass*, WrapperClass*);
 template<typename WrapperClass, typename DOMClass> WrapperClass* createWrapper(JSDOMGlobalObject*, Ref<DOMClass>&&);
 
-template<typename WrapperClass, typename DOMClass> JSC::JSValue wrap(JSDOMGlobalObject*, DOMClass&);
-template<typename WrapperClass, typename DOMClass> JSC::JSValue getExistingWrapper(JSDOMGlobalObject*, DOMClass&);
+template<typename DOMClass> JSC::JSValue wrap(JSC::ExecState*, JSDOMGlobalObject*, DOMClass&);
 template<typename WrapperClass, typename DOMClass> JSC::JSValue createNewWrapper(JSDOMGlobalObject*, Ref<DOMClass>&&);
 
 void addImpureProperty(const AtomicString&);
@@ -467,18 +466,13 @@
     return wrapper;
 }
 
-template<typename WrapperClass, typename DOMClass> inline JSC::JSValue wrap(JSDOMGlobalObject* globalObject, DOMClass& domObject)
+template<typename DOMClass> inline JSC::JSValue wrap(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DOMClass& domObject)
 {
     if (auto* wrapper = getCachedWrapper(globalObject->world(), domObject))
         return wrapper;
-    return createWrapper<WrapperClass, DOMClass>(globalObject, domObject);
+    return toJSNewlyCreated(state, globalObject, Ref<DOMClass>(domObject));
 }
 
-template<typename WrapperClass, typename DOMClass> inline JSC::JSValue getExistingWrapper(JSDOMGlobalObject* globalObject, DOMClass& domObject)
-{
-    return getCachedWrapper(globalObject->world(), domObject);
-}
-
 template<typename WrapperClass, typename DOMClass> inline JSC::JSValue createNewWrapper(JSDOMGlobalObject* globalObject, Ref<DOMClass>&& domObject)
 {
     ASSERT(!getCachedWrapper(globalObject->world(), domObject));
@@ -521,7 +515,7 @@
 {
     if (!buffer)
         return JSC::jsNull();
-    if (JSC::JSValue result = getExistingWrapper<JSC::JSArrayBuffer>(globalObject, *buffer))
+    if (JSC::JSValue result = getCachedWrapper(globalObject->world(), *buffer))
         return result;
 
     // The JSArrayBuffer::create function will register the wrapper in finishCreation.

Modified: trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -70,13 +70,6 @@
     return wrapper;
 }
 
-JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, Document& document)
-{
-    if (auto* wrapper = cachedDocumentWrapper(*state, *globalObject, document))
-        return wrapper;
-    return createNewDocumentWrapper(*state, *globalObject, document);
-}
-
 JSObject* cachedDocumentWrapper(ExecState& state, JSDOMGlobalObject& globalObject, Document& document)
 {
     if (auto* wrapper = getCachedWrapper(globalObject.world(), document))
@@ -110,6 +103,13 @@
     return createNewDocumentWrapper(*state, *globalObject, WTFMove(document));
 }
 
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, Document& document)
+{
+    if (auto* wrapper = cachedDocumentWrapper(*state, *globalObject, document))
+        return wrapper;
+    return toJSNewlyCreated(state, globalObject, Ref<Document>(document));
+}
+
 JSValue JSDocument::prepend(ExecState& state)
 {
     ExceptionCode ec = 0;

Modified: trunk/Source/WebCore/bindings/js/JSDocumentFragmentCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSDocumentFragmentCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSDocumentFragmentCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -52,26 +52,18 @@
     return jsUndefined();
 }
 
-static inline JSValue createNewDocumentFragmentWrapper(JSDOMGlobalObject& globalObject, Ref<DocumentFragment>&& impl)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<DocumentFragment>&& impl)
 {
 #if ENABLE(SHADOW_DOM)
     if (impl->isShadowRoot())
-        return CREATE_DOM_WRAPPER(&globalObject, ShadowRoot, WTFMove(impl));
+        return CREATE_DOM_WRAPPER(globalObject, ShadowRoot, WTFMove(impl));
 #endif
-    return createNewWrapper<JSDocumentFragment>(&globalObject, WTFMove(impl));
+    return createNewWrapper<JSDocumentFragment>(globalObject, WTFMove(impl));
 }
 
-JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<DocumentFragment>&& impl)
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, DocumentFragment& impl)
 {
-    return createNewDocumentFragmentWrapper(*globalObject, WTFMove(impl));
+    return wrap(state, globalObject, impl);
 }
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, DocumentFragment& impl)
-{
-    if (JSValue result = getExistingWrapper<JSDocumentFragment>(globalObject, impl))
-        return result;
-
-    return createNewDocumentFragmentWrapper(*globalObject, impl);
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSEventCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSEventCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSEventCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -51,33 +51,22 @@
 
 #define TRY_TO_WRAP_WITH_INTERFACE(interfaceName) \
     case interfaceName##InterfaceType: \
-        return CREATE_DOM_WRAPPER(&globalObject, interfaceName, WTFMove(event));
+        return CREATE_DOM_WRAPPER(globalObject, interfaceName, WTFMove(event));
 
-static inline JSValue createNewEventWrapper(JSDOMGlobalObject& globalObject, Ref<Event>&& event)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<Event>&& event)
 {
     switch (event->eventInterface()) {
         DOM_EVENT_INTERFACES_FOR_EACH(TRY_TO_WRAP_WITH_INTERFACE)
     }
 
-    return CREATE_DOM_WRAPPER(&globalObject, Event, WTFMove(event));
+    return CREATE_DOM_WRAPPER(globalObject, Event, WTFMove(event));
 }
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, Event& event)
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, Event& event)
 {
-    JSLockHolder lock(globalObject->vm());
-
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), event))
-        return wrapper;
-
-    return createNewEventWrapper(*globalObject, event);
+    return wrap(state, globalObject, event);
 }
 
-
-JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<Event>&& event)
-{
-    return createNewEventWrapper(*globalObject, WTFMove(event));
-}
-
 #undef TRY_TO_WRAP_WITH_INTERFACE
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -53,23 +53,25 @@
     return true;
 }
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, HTMLCollection& collection)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<HTMLCollection>&& collection)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), collection))
-        return wrapper;
-
-    switch (collection.type()) {
+    switch (collection->type()) {
     case FormControls:
-        return CREATE_DOM_WRAPPER(globalObject, HTMLFormControlsCollection, collection);
+        return CREATE_DOM_WRAPPER(globalObject, HTMLFormControlsCollection, WTFMove(collection));
     case SelectOptions:
-        return CREATE_DOM_WRAPPER(globalObject, HTMLOptionsCollection, collection);
+        return CREATE_DOM_WRAPPER(globalObject, HTMLOptionsCollection, WTFMove(collection));
     case DocAll:
-        return CREATE_DOM_WRAPPER(globalObject, HTMLAllCollection, collection);
+        return CREATE_DOM_WRAPPER(globalObject, HTMLAllCollection, WTFMove(collection));
     default:
         break;
     }
 
-    return CREATE_DOM_WRAPPER(globalObject, HTMLCollection, collection);
+    return CREATE_DOM_WRAPPER(globalObject, HTMLCollection, WTFMove(collection));
 }
 
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, HTMLCollection& collection)
+{
+    return wrap(state, globalObject, collection);
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -53,12 +53,12 @@
 
 using namespace HTMLNames;
 
-static inline JSValue createNewHTMLDocumentWrapper(ExecState& state, JSDOMGlobalObject& globalObject, Ref<HTMLDocument>&& passedDocument)
+JSValue toJSNewlyCreated(ExecState* state, JSDOMGlobalObject* globalObject, Ref<HTMLDocument>&& passedDocument)
 {
     auto& document = passedDocument.get();
-    JSObject* wrapper = CREATE_DOM_WRAPPER(&globalObject, HTMLDocument, WTFMove(passedDocument));
+    JSObject* wrapper = createWrapper<JSHTMLDocument>(globalObject, WTFMove(passedDocument));
 
-    reportMemoryForDocumentIfFrameless(state, document);
+    reportMemoryForDocumentIfFrameless(*state, document);
 
     return wrapper;
 }
@@ -67,14 +67,9 @@
 {
     if (auto* wrapper = cachedDocumentWrapper(*state, *globalObject, document))
         return wrapper;
-    return createNewHTMLDocumentWrapper(*state, *globalObject, document);
+    return toJSNewlyCreated(state, globalObject, Ref<HTMLDocument>(document));
 }
 
-JSValue toJSNewlyCreated(ExecState* state, JSDOMGlobalObject* globalObject, Ref<HTMLDocument>&& document)
-{
-    return createNewHTMLDocumentWrapper(*state, *globalObject, WTFMove(document));
-}
-
 bool JSHTMLDocument::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
     JSHTMLDocument* thisObject = jsCast<JSHTMLDocument*>(object);

Modified: trunk/Source/WebCore/bindings/js/JSHTMLTemplateElementCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSHTMLTemplateElementCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSHTMLTemplateElementCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -45,12 +45,8 @@
 {
     JSLockHolder lock(&state);
 
-    auto& content = wrapped().content();
+    auto wrapper = wrap(&state, globalObject(), wrapped().content());
 
-    if (auto* wrapper = getCachedWrapper(globalObject()->world(), content))
-        return wrapper;
-
-    auto* wrapper = CREATE_DOM_WRAPPER(globalObject(), DocumentFragment, content);
     PrivateName propertyName;
     const_cast<JSHTMLTemplateElement*>(this)->putDirect(globalObject()->vm(), propertyName, wrapper);
     return wrapper;

Modified: trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSIDBCursorCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -52,12 +52,16 @@
     return toJS(&state, globalObject(), cursor.objectStore());
 }
 
-JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, IDBCursor& cursor)
+JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<IDBCursor>&& cursor)
 {
     if (is<IDBCursorWithValue>(cursor))
-        return wrap<JSIDBCursorWithValue>(globalObject, downcast<IDBCursorWithValue>(cursor));
+        return CREATE_DOM_WRAPPER(globalObject, IDBCursorWithValue, WTFMove(cursor));
+    return createWrapper<JSIDBCursor>(globalObject, WTFMove(cursor));
+}
 
-    return wrap<JSIDBCursor>(globalObject, cursor);
+JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, IDBCursor& cursor)
+{
+    return wrap(state, globalObject, cursor);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSImageDataCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSImageDataCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSImageDataCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -50,9 +50,7 @@
 
 JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, ImageData& imageData)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), imageData))
-        return wrapper;
-    return toJSNewlyCreated(state, globalObject, Ref<ImageData>(imageData));
+    return wrap(state, globalObject, imageData);
 }
 
 }

Modified: trunk/Source/WebCore/bindings/js/JSMediaStreamCapabilitiesCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSMediaStreamCapabilitiesCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSMediaStreamCapabilitiesCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -37,12 +37,16 @@
 
 namespace WebCore {
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, MediaStreamCapabilities& object)
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MediaStreamCapabilities>&& object)
 {
     if (object.hasVideoSource())
-        return wrap<JSAllVideoCapabilities>(globalObject, static_cast<AllVideoCapabilities&>(object));
+        return CREATE_DOM_WRAPPER(globalObject, AllVideoCapabilities, WTFMove(object));
+    return CREATE_DOM_WRAPPER(globalObject, AllAudioCapabilities, WTFMove(object));
+}
 
-    return wrap<JSAllAudioCapabilities>(globalObject, static_cast<AllAudioCapabilities&>(object));
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, MediaStreamCapabilities& object)
+{
+    return wrap(state, globalObject, object);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSNodeListCustom.h (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSNodeListCustom.h	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSNodeListCustom.h	2016-05-19 07:32:48 UTC (rev 201129)
@@ -35,8 +35,8 @@
 
 ALWAYS_INLINE JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, NodeList& nodeList)
 {
-    if (JSC::JSValue existingWrapper = getExistingWrapper<JSNodeList>(globalObject, nodeList))
-        return existingWrapper;
+    if (auto wrapper = getCachedWrapper(globalObject->world(), nodeList))
+        return wrapper;
     return createWrapper(*globalObject, nodeList);
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSPerformanceEntryCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSPerformanceEntryCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSPerformanceEntryCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -47,21 +47,26 @@
 
 namespace WebCore {
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, PerformanceEntry& entry)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<PerformanceEntry>&& entry)
 {
     if (is<PerformanceResourceTiming>(entry))
-        return wrap<JSPerformanceResourceTiming>(globalObject, downcast<PerformanceResourceTiming>(entry));
+        return CREATE_DOM_WRAPPER(globalObject, PerformanceResourceTiming, WTFMove(entry));
 
 #if ENABLE(USER_TIMING)
     if (is<PerformanceMark>(entry))
-        return wrap<JSPerformanceMark>(globalObject, downcast<PerformanceMark>(entry));
+        return CREATE_DOM_WRAPPER(globalObject, PerformanceMark, WTFMove(entry));
 
     if (is<PerformanceMeasure>(entry))
-        return wrap<JSPerformanceMeasure>(globalObject, downcast<PerformanceMeasure>(entry));
+        return CREATE_DOM_WRAPPER(globalObject, PerformanceMeasure, WTFMove(entry));
 #endif
 
-    return wrap<JSPerformanceEntry>(globalObject, entry);
+    return createWrapper<JSPerformanceEntry>(globalObject, WTFMove(entry));
 }
 
+JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PerformanceEntry& entry)
+{
+    return wrap(state, globalObject, entry);
+}
+
 } // namespace WebCore
 #endif // ENABLE(WEB_TIMING)

Modified: trunk/Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSSVGPathSegCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -59,54 +59,56 @@
 
 namespace WebCore {
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, SVGPathSeg& object)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGPathSeg>&& object)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), object))
-        return wrapper;
-
-    switch (object.pathSegType()) {
+    switch (object->pathSegType()) {
     case SVGPathSeg::PATHSEG_CLOSEPATH:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegClosePath, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegClosePath, WTFMove(object));
     case SVGPathSeg::PATHSEG_MOVETO_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegMovetoAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegMovetoAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_MOVETO_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegMovetoRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegMovetoRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_LINETO_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_LINETO_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_ARC_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegArcAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegArcAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_ARC_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegArcRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegArcRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoHorizontalAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoHorizontalAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoHorizontalRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoHorizontalRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoVerticalAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoVerticalAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoVerticalRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegLinetoVerticalRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicSmoothAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicSmoothAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicSmoothRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoCubicSmoothRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticSmoothAbs, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticSmoothAbs, WTFMove(object));
     case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticSmoothRel, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSegCurvetoQuadraticSmoothRel, WTFMove(object));
     case SVGPathSeg::PATHSEG_UNKNOWN:
     default:
-        return CREATE_DOM_WRAPPER(globalObject, SVGPathSeg, object);
+        return CREATE_DOM_WRAPPER(globalObject, SVGPathSeg, WTFMove(object));
     }
 }
 
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, SVGPathSeg& object)
+{
+    return wrap(state, globalObject, object);
 }
+
+}

Modified: trunk/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSStyleSheetCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -35,13 +35,16 @@
     visitor.addOpaqueRoot(root(&wrapped()));
 }
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, StyleSheet& styleSheet)
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<StyleSheet>&& styleSheet)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), styleSheet))
-        return wrapper;
-    if (styleSheet.isCSSStyleSheet())
-        return CREATE_DOM_WRAPPER(globalObject, CSSStyleSheet, styleSheet);
-    return CREATE_DOM_WRAPPER(globalObject, StyleSheet, styleSheet);
+    if (styleSheet->isCSSStyleSheet())
+        return CREATE_DOM_WRAPPER(globalObject, CSSStyleSheet, WTFMove(styleSheet));
+    return CREATE_DOM_WRAPPER(globalObject, StyleSheet, WTFMove(styleSheet));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, StyleSheet& stylesheet)
+{
+    return wrap(state, globalObject, stylesheet);
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSTextCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSTextCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSTextCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -32,23 +32,16 @@
 
 using namespace JSC;
 
-static inline JSValue createNewTextWrapper(JSDOMGlobalObject& globalObject, Ref<Text>&& text)
+JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<Text>&& text)
 {
     if (is<CDATASection>(text.get()))
-        return CREATE_DOM_WRAPPER(&globalObject, CDATASection, WTFMove(text));
-    return CREATE_DOM_WRAPPER(&globalObject, Text, WTFMove(text));
+        return CREATE_DOM_WRAPPER(globalObject, CDATASection, WTFMove(text));
+    return CREATE_DOM_WRAPPER(globalObject, Text, WTFMove(text));
 }
 
-JSValue toJS(ExecState*, JSDOMGlobalObject* globalObject, Text& text)
+JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, Text& text)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), text))
-        return wrapper;
-    return createNewTextWrapper(*globalObject, text);
+    return wrap(state, globalObject, text);
 }
 
-JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<Text>&& text)
-{
-    return createNewTextWrapper(*globalObject, WTFMove(text));
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -76,10 +76,7 @@
 
 JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, TextTrackCue& cue)
 {
-    if (auto* wrapper = getCachedWrapper(globalObject->world(), cue))
-        return wrapper;
-
-    return toJSNewlyCreated(state, globalObject, Ref<TextTrackCue>(cue));
+    return wrap(state, globalObject, cue);
 }
 
 void JSTextTrackCue::visitAdditionalChildren(SlotVisitor& visitor)

Modified: trunk/Source/WebCore/bindings/js/JSTrackCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSTrackCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSTrackCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -53,30 +53,22 @@
     return nullptr;
 }
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TrackBase& track)
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TrackBase& track)
 {
     switch (track.type()) {
     case TrackBase::BaseTrack:
         // This should never happen.
         ASSERT_NOT_REACHED();
         break;
-        
-    case TrackBase::AudioTrack:
-        if (auto* wrapper = getCachedWrapper(globalObject->world(), downcast<AudioTrack>(track)))
-            return wrapper;
-        return CREATE_DOM_WRAPPER(globalObject, AudioTrack, track);
 
+    case TrackBase::AudioTrack:
+        return wrap(state, globalObject, downcast<AudioTrack>(track));
     case TrackBase::VideoTrack:
-        if (auto* wrapper = getCachedWrapper(globalObject->world(), downcast<VideoTrack>(track)))
-            return wrapper;
-        return CREATE_DOM_WRAPPER(globalObject, VideoTrack, track);
-
+        return wrap(state, globalObject, downcast<VideoTrack>(track));
     case TrackBase::TextTrack:
-        if (auto* wrapper = getCachedWrapper(globalObject->world(), downcast<TextTrack>(track)))
-            return wrapper;
-        return CREATE_DOM_WRAPPER(globalObject, TextTrack, track);
+        return wrap(state, globalObject, downcast<TextTrack>(track));
     }
-    
+
     return jsNull();
 }
 

Modified: trunk/Source/WebCore/bindings/js/JSXMLDocumentCustom.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/js/JSXMLDocumentCustom.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/js/JSXMLDocumentCustom.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -35,16 +35,16 @@
 
 using namespace JSC;
 
-static inline JSValue createNewXMLDocumentWrapper(ExecState& state, JSDOMGlobalObject& globalObject, Ref<XMLDocument>&& passedDocument)
+JSValue toJSNewlyCreated(ExecState* state, JSDOMGlobalObject* globalObject, Ref<XMLDocument>&& passedDocument)
 {
     auto& document = passedDocument.get();
     JSObject* wrapper;
     if (document.isSVGDocument())
-        wrapper = CREATE_DOM_WRAPPER(&globalObject, SVGDocument, WTFMove(passedDocument));
+        wrapper = CREATE_DOM_WRAPPER(globalObject, SVGDocument, WTFMove(passedDocument));
     else
-        wrapper = CREATE_DOM_WRAPPER(&globalObject, XMLDocument, WTFMove(passedDocument));
+        wrapper = CREATE_DOM_WRAPPER(globalObject, XMLDocument, WTFMove(passedDocument));
 
-    reportMemoryForDocumentIfFrameless(state, document);
+    reportMemoryForDocumentIfFrameless(*state, document);
 
     return wrapper;
 }
@@ -53,12 +53,7 @@
 {
     if (auto* wrapper = cachedDocumentWrapper(*state, *globalObject, document))
         return wrapper;
-    return createNewXMLDocumentWrapper(*state, *globalObject, document);
+    return toJSNewlyCreated(state, globalObject, Ref<XMLDocument>(document));
 }
 
-JSValue toJSNewlyCreated(ExecState* state, JSDOMGlobalObject* globalObject, Ref<XMLDocument>&& document)
-{
-    return createNewXMLDocumentWrapper(*state, *globalObject, WTFMove(document));
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-05-19 07:32:48 UTC (rev 201129)
@@ -3412,26 +3412,10 @@
 
         push(@implContent, "JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<$implType>&& impl)\n");
         push(@implContent, "{\n");
-        if ($svgPropertyType) {
-            push(@implContent, "    return createNewWrapper<$className, $implType>(globalObject, WTFMove(impl));\n");
-        } else {
-            push(@implContent, "    return createNewWrapper<$className>(globalObject, WTFMove(impl));\n");
-        }
-        push(@implContent, "}\n\n");
-
-        push(@implContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, $implType& impl)\n");
-        push(@implContent, "{\n");
-        if ($svgPropertyType) {
-            push(@implContent, "    if (JSValue result = getExistingWrapper<$className, $implType>(globalObject, impl))\n");
-            push(@implContent, "        return result;\n");
-        } else {
-            push(@implContent, "    if (JSValue result = getExistingWrapper<$className>(globalObject, impl))\n");
-            push(@implContent, "        return result;\n");
-        }
         push(@implContent, <<END) if $vtableNameGnu;
 
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(${vtableRefWin});
 #else
@@ -3459,11 +3443,15 @@
 #endif
 END
         push(@implContent, <<END) if $interface->extendedAttributes->{"ReportExtraMemoryCost"};
-    globalObject->vm().heap.reportExtraMemoryAllocated(impl.memoryCost());
+    globalObject->vm().heap.reportExtraMemoryAllocated(impl->memoryCost());
 END
 
-        push(@implContent, "    return createNewWrapper<$className, $implType>(globalObject, impl);\n");
+        push(@implContent, "    return createNewWrapper<$className, $implType>(globalObject, WTFMove(impl));\n");
+        push(@implContent, "}\n\n");
 
+        push(@implContent, "JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, $implType& impl)\n");
+        push(@implContent, "{\n");
+        push(@implContent, "    return wrap(state, globalObject, impl);\n");
         push(@implContent, "}\n\n");
     }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -252,16 +252,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestActiveDOMObject>&& impl)
 {
-    return createNewWrapper<JSTestActiveDOMObject>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestActiveDOMObject& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestActiveDOMObject>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestActiveDOMObject@WebCore@@6B@"));
 #else
@@ -278,9 +271,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestActiveDOMObject, TestActiveDOMObject>(globalObject, impl);
+    return createNewWrapper<JSTestActiveDOMObject, TestActiveDOMObject>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestActiveDOMObject& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestActiveDOMObject* JSTestActiveDOMObject::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestActiveDOMObject*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -178,16 +178,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestClassWithJSBuiltinConstructor>&& impl)
 {
-    return createNewWrapper<JSTestClassWithJSBuiltinConstructor>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestClassWithJSBuiltinConstructor& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestClassWithJSBuiltinConstructor>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestClassWithJSBuiltinConstructor@WebCore@@6B@"));
 #else
@@ -204,9 +197,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestClassWithJSBuiltinConstructor, TestClassWithJSBuiltinConstructor>(globalObject, impl);
+    return createNewWrapper<JSTestClassWithJSBuiltinConstructor, TestClassWithJSBuiltinConstructor>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestClassWithJSBuiltinConstructor& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestClassWithJSBuiltinConstructor* JSTestClassWithJSBuiltinConstructor::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestClassWithJSBuiltinConstructor*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -168,16 +168,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestCustomConstructorWithNoInterfaceObject>&& impl)
 {
-    return createNewWrapper<JSTestCustomConstructorWithNoInterfaceObject>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestCustomConstructorWithNoInterfaceObject& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestCustomConstructorWithNoInterfaceObject>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCustomConstructorWithNoInterfaceObject@WebCore@@6B@"));
 #else
@@ -194,9 +187,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestCustomConstructorWithNoInterfaceObject, TestCustomConstructorWithNoInterfaceObject>(globalObject, impl);
+    return createNewWrapper<JSTestCustomConstructorWithNoInterfaceObject, TestCustomConstructorWithNoInterfaceObject>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCustomConstructorWithNoInterfaceObject& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestCustomConstructorWithNoInterfaceObject* JSTestCustomConstructorWithNoInterfaceObject::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestCustomConstructorWithNoInterfaceObject*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -225,16 +225,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestCustomNamedGetter>&& impl)
 {
-    return createNewWrapper<JSTestCustomNamedGetter>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestCustomNamedGetter& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestCustomNamedGetter>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCustomNamedGetter@WebCore@@6B@"));
 #else
@@ -251,9 +244,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestCustomNamedGetter, TestCustomNamedGetter>(globalObject, impl);
+    return createNewWrapper<JSTestCustomNamedGetter, TestCustomNamedGetter>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCustomNamedGetter& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestCustomNamedGetter* JSTestCustomNamedGetter::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestCustomNamedGetter*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -273,16 +273,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestEventConstructor>&& impl)
 {
-    return createNewWrapper<JSTestEventConstructor>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestEventConstructor& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestEventConstructor>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestEventConstructor@WebCore@@6B@"));
 #else
@@ -299,9 +292,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestEventConstructor, TestEventConstructor>(globalObject, impl);
+    return createNewWrapper<JSTestEventConstructor, TestEventConstructor>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestEventConstructor& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestEventConstructor* JSTestEventConstructor::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestEventConstructor*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -232,16 +232,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestEventTarget>&& impl)
 {
-    return createNewWrapper<JSTestEventTarget>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestEventTarget& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestEventTarget>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestEventTarget@WebCore@@6B@"));
 #else
@@ -258,9 +251,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestEventTarget, TestEventTarget>(globalObject, impl);
+    return createNewWrapper<JSTestEventTarget, TestEventTarget>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestEventTarget& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestEventTarget* JSTestEventTarget::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestEventTarget*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -206,16 +206,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestException>&& impl)
 {
-    return createNewWrapper<JSTestException>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestException& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestException>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestException@WebCore@@6B@"));
 #else
@@ -232,9 +225,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestException, TestException>(globalObject, impl);
+    return createNewWrapper<JSTestException, TestException>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestException& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestException* JSTestException::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestException*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -165,16 +165,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestGenerateIsReachable>&& impl)
 {
-    return createNewWrapper<JSTestGenerateIsReachable>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestGenerateIsReachable& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestGenerateIsReachable>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestGenerateIsReachable@WebCore@@6B@"));
 #else
@@ -191,9 +184,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestGenerateIsReachable, TestGenerateIsReachable>(globalObject, impl);
+    return createNewWrapper<JSTestGenerateIsReachable, TestGenerateIsReachable>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestGenerateIsReachable& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestGenerateIsReachable* JSTestGenerateIsReachable::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestGenerateIsReachable*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -347,16 +347,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestGlobalObject>&& impl)
 {
-    return createNewWrapper<JSTestGlobalObject>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestGlobalObject& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestGlobalObject>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestGlobalObject@WebCore@@6B@"));
 #else
@@ -373,9 +366,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestGlobalObject, TestGlobalObject>(globalObject, impl);
+    return createNewWrapper<JSTestGlobalObject, TestGlobalObject>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestGlobalObject& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestGlobalObject* JSTestGlobalObject::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestGlobalObject*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -917,13 +917,6 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestInterface>&& impl)
 {
-    return createNewWrapper<JSTestInterface>(globalObject, WTFMove(impl));
-}
-
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestInterface& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestInterface>(globalObject, impl))
-        return result;
 #if COMPILER(CLANG)
     // If you hit this failure the interface definition has the ImplementationLacksVTable
     // attribute. You should remove that attribute. If the class has subclasses
@@ -931,9 +924,14 @@
     // attribute to TestInterface.
     static_assert(!__is_polymorphic(TestInterface), "TestInterface is polymorphic but the IDL claims it is not");
 #endif
-    return createNewWrapper<JSTestInterface, TestInterface>(globalObject, impl);
+    return createNewWrapper<JSTestInterface, TestInterface>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestInterface& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestInterface* JSTestInterface::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestInterface*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -190,16 +190,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestMediaQueryListListener>&& impl)
 {
-    return createNewWrapper<JSTestMediaQueryListListener>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestMediaQueryListListener& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestMediaQueryListListener>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestMediaQueryListListener@WebCore@@6B@"));
 #else
@@ -216,9 +209,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestMediaQueryListListener, TestMediaQueryListListener>(globalObject, impl);
+    return createNewWrapper<JSTestMediaQueryListListener, TestMediaQueryListListener>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestMediaQueryListListener& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestMediaQueryListListener* JSTestMediaQueryListListener::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestMediaQueryListListener*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -213,16 +213,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedConstructor>&& impl)
 {
-    return createNewWrapper<JSTestNamedConstructor>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestNamedConstructor& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestNamedConstructor>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNamedConstructor@WebCore@@6B@"));
 #else
@@ -239,9 +232,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestNamedConstructor, TestNamedConstructor>(globalObject, impl);
+    return createNewWrapper<JSTestNamedConstructor, TestNamedConstructor>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedConstructor& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestNamedConstructor* JSTestNamedConstructor::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestNamedConstructor*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -245,16 +245,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNode>&& impl)
 {
-    return createNewWrapper<JSTestNode>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestNode& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestNode>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNode@WebCore@@6B@"));
 #else
@@ -271,8 +264,13 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestNode, TestNode>(globalObject, impl);
+    return createNewWrapper<JSTestNode, TestNode>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNode& impl)
+{
+    return wrap(state, globalObject, impl);
+}
 
+
 }

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -474,16 +474,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNondeterministic>&& impl)
 {
-    return createNewWrapper<JSTestNondeterministic>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestNondeterministic& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestNondeterministic>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestNondeterministic@WebCore@@6B@"));
 #else
@@ -500,9 +493,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestNondeterministic, TestNondeterministic>(globalObject, impl);
+    return createNewWrapper<JSTestNondeterministic, TestNondeterministic>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNondeterministic& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestNondeterministic* JSTestNondeterministic::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestNondeterministic*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -6269,16 +6269,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestObj>&& impl)
 {
-    return createNewWrapper<JSTestObj>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestObj& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestObj>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestObj@WebCore@@6B@"));
 #else
@@ -6295,9 +6288,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestObj, TestObj>(globalObject, impl);
+    return createNewWrapper<JSTestObj, TestObj>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestObj& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestObj* JSTestObj::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestObj*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -249,16 +249,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestOverloadedConstructors>&& impl)
 {
-    return createNewWrapper<JSTestOverloadedConstructors>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestOverloadedConstructors& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestOverloadedConstructors>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestOverloadedConstructors@WebCore@@6B@"));
 #else
@@ -275,9 +268,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestOverloadedConstructors, TestOverloadedConstructors>(globalObject, impl);
+    return createNewWrapper<JSTestOverloadedConstructors, TestOverloadedConstructors>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestOverloadedConstructors& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestOverloadedConstructors* JSTestOverloadedConstructors::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestOverloadedConstructors*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -232,16 +232,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestOverrideBuiltins>&& impl)
 {
-    return createNewWrapper<JSTestOverrideBuiltins>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestOverrideBuiltins& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestOverrideBuiltins>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestOverrideBuiltins@WebCore@@6B@"));
 #else
@@ -258,9 +251,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestOverrideBuiltins, TestOverrideBuiltins>(globalObject, impl);
+    return createNewWrapper<JSTestOverrideBuiltins, TestOverrideBuiltins>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestOverrideBuiltins& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestOverrideBuiltins* JSTestOverrideBuiltins::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestOverrideBuiltins*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -307,16 +307,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestSerializedScriptValueInterface>&& impl)
 {
-    return createNewWrapper<JSTestSerializedScriptValueInterface>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestSerializedScriptValueInterface& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestSerializedScriptValueInterface>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestSerializedScriptValueInterface@WebCore@@6B@"));
 #else
@@ -333,9 +326,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestSerializedScriptValueInterface, TestSerializedScriptValueInterface>(globalObject, impl);
+    return createNewWrapper<JSTestSerializedScriptValueInterface, TestSerializedScriptValueInterface>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestSerializedScriptValueInterface& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestSerializedScriptValueInterface* JSTestSerializedScriptValueInterface::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestSerializedScriptValueInterface*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -662,16 +662,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestTypedefs>&& impl)
 {
-    return createNewWrapper<JSTestTypedefs>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestTypedefs& impl)
-{
-    if (JSValue result = getExistingWrapper<JSTestTypedefs>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestTypedefs@WebCore@@6B@"));
 #else
@@ -688,9 +681,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSTestTypedefs, TestTypedefs>(globalObject, impl);
+    return createNewWrapper<JSTestTypedefs, TestTypedefs>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestTypedefs& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 TestTypedefs* JSTestTypedefs::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSTestTypedefs*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -206,16 +206,9 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<attribute>&& impl)
 {
-    return createNewWrapper<JSattribute>(globalObject, WTFMove(impl));
-}
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, attribute& impl)
-{
-    if (JSValue result = getExistingWrapper<JSattribute>(globalObject, impl))
-        return result;
-
 #if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(&impl));
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 #if PLATFORM(WIN)
     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7attribute@WebCore@@6B@"));
 #else
@@ -232,9 +225,14 @@
     // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
-    return createNewWrapper<JSattribute, attribute>(globalObject, impl);
+    return createNewWrapper<JSattribute, attribute>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, attribute& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 attribute* JSattribute::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSattribute*>(value))

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp (201128 => 201129)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp	2016-05-19 07:14:45 UTC (rev 201128)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp	2016-05-19 07:32:48 UTC (rev 201129)
@@ -156,13 +156,6 @@
 
 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<readonly>&& impl)
 {
-    return createNewWrapper<JSreadonly>(globalObject, WTFMove(impl));
-}
-
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, readonly& impl)
-{
-    if (JSValue result = getExistingWrapper<JSreadonly>(globalObject, impl))
-        return result;
 #if COMPILER(CLANG)
     // If you hit this failure the interface definition has the ImplementationLacksVTable
     // attribute. You should remove that attribute. If the class has subclasses
@@ -170,9 +163,14 @@
     // attribute to readonly.
     static_assert(!__is_polymorphic(readonly), "readonly is polymorphic but the IDL claims it is not");
 #endif
-    return createNewWrapper<JSreadonly, readonly>(globalObject, impl);
+    return createNewWrapper<JSreadonly, readonly>(globalObject, WTFMove(impl));
 }
 
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, readonly& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
 readonly* JSreadonly::toWrapped(JSC::JSValue value)
 {
     if (auto* wrapper = jsDynamicCast<JSreadonly*>(value))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to