<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212344] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212344">212344</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-14 23:12:05 -0800 (Tue, 14 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebIDL] Improve serializer = { inherit }
https://bugs.webkit.org/show_bug.cgi?id=168293

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2017-02-14
Reviewed by Youenn Fablet.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
Expose a serialize() method on the interface.

(GenerateSerializerFunction):
(GenerateSerializerAttributesForInterface): Deleted.
Subclasses that have `serializer = { inherit }` can use
their parent's serialize() method to get the initial object.
We can now collapse everything back into a single function
because we only generate code for our own attributes.

* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::JSTestNode::serialize):
(WebCore::jsTestNodePrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestNode.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::serialize):
(WebCore::jsTestObjPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/JS/JSTestSerialization.cpp:
(WebCore::JSTestSerialization::serialize):
(WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestSerialization.h:
* bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
(WebCore::JSTestSerializationInherit::serialize):
(WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestSerializationInherit.h:
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
(WebCore::JSTestSerializationInheritFinal::serialize):
(WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
* bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
Updated results.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNodecpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestNodeh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInheritcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInherith">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInheritFinalcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInheritFinalh">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/ChangeLog        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2017-02-14  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        [WebIDL] Improve serializer = { inherit }
+        https://bugs.webkit.org/show_bug.cgi?id=168293
+
+        Reviewed by Youenn Fablet.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        Expose a serialize() method on the interface.
+
+        (GenerateSerializerFunction):
+        (GenerateSerializerAttributesForInterface): Deleted.
+        Subclasses that have `serializer = { inherit }` can use
+        their parent's serialize() method to get the initial object.
+        We can now collapse everything back into a single function
+        because we only generate code for our own attributes.
+
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        (WebCore::JSTestNode::serialize):
+        (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestNode.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::JSTestObj::serialize):
+        (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/JS/JSTestSerialization.cpp:
+        (WebCore::JSTestSerialization::serialize):
+        (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestSerialization.h:
+        * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
+        (WebCore::JSTestSerializationInherit::serialize):
+        (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestSerializationInherit.h:
+        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
+        (WebCore::JSTestSerializationInheritFinal::serialize):
+        (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
+        * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
+        Updated results.
+
</ins><span class="cx"> 2017-02-14  Aakash Jain  &lt;aakash_jain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -1934,6 +1934,9 @@
</span><span class="cx">         push(@headerContent, &quot;    static JSC::JSValue getNamedConstructor(JSC::VM&amp;, JSC::JSGlobalObject*);\n&quot;) if $interface-&gt;extendedAttributes-&gt;{NamedConstructor};
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    # Serializer function.
+    push(@headerContent, &quot;    static JSC::JSObject* serialize(JSC::ExecState*, JS${interfaceName}* thisObject, JSC::ThrowScope&amp;);\n&quot;) if $interface-&gt;serializable;
+
</ins><span class="cx">     my $numCustomFunctions = 0;
</span><span class="cx">     my $numCustomAttributes = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -4394,36 +4397,8 @@
</span><span class="cx"> 
</span><span class="cx">     my $interfaceName = $interface-&gt;type-&gt;name;
</span><span class="cx"> 
</span><del>-    my $serializerFunctionName = &quot;toJSON&quot;;
-    my $serializerNativeFunctionName = $codeGenerator-&gt;WK_lcfirst($className) . &quot;PrototypeFunction&quot; . $codeGenerator-&gt;WK_ucfirst($serializerFunctionName);
-
-    AddToImplIncludes(&quot;&lt;runtime/ObjectConstructor.h&gt;&quot;);
-    push(@implContent, &quot;static inline EncodedJSValue ${serializerNativeFunctionName}Caller(ExecState* state, JS$interfaceName* thisObject, JSC::ThrowScope&amp; throwScope)\n&quot;);
-    push(@implContent, &quot;{\n&quot;);
-    push(@implContent, &quot;    auto&amp; vm = state-&gt;vm();\n&quot;);
-    push(@implContent, &quot;    auto* result = constructEmptyObject(state);\n&quot;);
-    push(@implContent, &quot;\n&quot;);
-
-    GenerateSerializerAttributesForInterface($interface, $className);
-
-    push(@implContent, &quot;    return JSValue::encode(result);\n&quot;);
-    push(@implContent, &quot;}\n&quot;);
-    push(@implContent, &quot;\n&quot;);
-    push(@implContent, &quot;EncodedJSValue JSC_HOST_CALL ${serializerNativeFunctionName}(ExecState* state)\n&quot;);
-    push(@implContent, &quot;{\n&quot;);
-    push(@implContent, &quot;    return BindingCaller&lt;JS$interfaceName&gt;::callOperation&lt;${serializerNativeFunctionName}Caller&gt;(state, \&quot;$serializerFunctionName\&quot;);\n&quot;);
-    push(@implContent, &quot;}\n&quot;);
-    push(@implContent, &quot;\n&quot;);
-}
-
-sub GenerateSerializerAttributesForInterface
-{
-    my ($interface, $className) = @_;
-
-    my $interfaceName = $interface-&gt;type-&gt;name;
-
</del><ins>+    my $parentSerializerInterface = 0;
</ins><span class="cx">     if ($interface-&gt;serializable-&gt;hasInherit) {
</span><del>-        my $parentSerializerInterface = 0;
</del><span class="cx">         $codeGenerator-&gt;ForAllParents($interface, sub {
</span><span class="cx">             my $parentInterface = shift;
</span><span class="cx">             if ($parentInterface-&gt;serializable &amp;&amp; !$parentSerializerInterface) {
</span><span class="lines">@@ -4430,10 +4405,7 @@
</span><span class="cx">                 $parentSerializerInterface = $parentInterface;
</span><span class="cx">             }
</span><span class="cx">         }, 0);
</span><del>-
</del><span class="cx">         die &quot;Failed to find parent interface with \&quot;serializer\&quot; for \&quot;inherit\&quot; serializer in $interfaceName\n&quot; if !$parentSerializerInterface;
</span><del>-
-        GenerateSerializerAttributesForInterface($parentSerializerInterface, $className);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     my @serializedAttributes = ();
</span><span class="lines">@@ -4451,13 +4423,28 @@
</span><span class="cx">                 last;
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        
</del><span class="cx">         die &quot;Failed to find \&quot;serializer\&quot; attribute \&quot;$attributeName\&quot; in $interfaceName\n&quot; if !$foundAttribute;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    my $serializerFunctionName = &quot;toJSON&quot;;
+    my $serializerNativeFunctionName = $codeGenerator-&gt;WK_lcfirst($className) . &quot;PrototypeFunction&quot; . $codeGenerator-&gt;WK_ucfirst($serializerFunctionName);
+
+    AddToImplIncludes(&quot;&lt;runtime/ObjectConstructor.h&gt;&quot;);
+
+    push(@implContent, &quot;JSC::JSObject* JS${interfaceName}::serialize(ExecState* state, JS${interfaceName}* thisObject, ThrowScope&amp; throwScope)\n&quot;);
+    push(@implContent, &quot;{\n&quot;);
+    push(@implContent, &quot;    auto&amp; vm = state-&gt;vm();\n&quot;);
+
+    if ($interface-&gt;serializable-&gt;hasInherit) {
+        my $parentSerializerInterfaceName = $parentSerializerInterface-&gt;type-&gt;name;
+        push(@implContent, &quot;    auto* result = JS${parentSerializerInterfaceName}::serialize(state, thisObject, throwScope);\n&quot;);
+    } else {
+        push(@implContent, &quot;    auto* result = constructEmptyObject(state);\n&quot;);
+    }
+    push(@implContent, &quot;\n&quot;);
+
</ins><span class="cx">     foreach my $attribute (@serializedAttributes) {
</span><span class="cx">         my $name = $attribute-&gt;name;
</span><del>-
</del><span class="cx">         my $getFunctionName = GetAttributeGetterName($interface, $className, $attribute);
</span><span class="cx">         push(@implContent, &quot;    auto ${name}Value = ${getFunctionName}Getter(*state, *thisObject, throwScope);\n&quot;);
</span><span class="cx">         push(@implContent, &quot;    ASSERT(!throwScope.exception());\n&quot;);
</span><span class="lines">@@ -4464,6 +4451,21 @@
</span><span class="cx">         push(@implContent, &quot;    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, \&quot;${name}\&quot;), ${name}Value);\n&quot;);
</span><span class="cx">         push(@implContent, &quot;\n&quot;);
</span><span class="cx">     }
</span><ins>+
+    push(@implContent, &quot;    return result;\n&quot;);
+    push(@implContent, &quot;}\n&quot;);
+    push(@implContent, &quot;\n&quot;);
+
+    push(@implContent, &quot;static inline EncodedJSValue ${serializerNativeFunctionName}Caller(ExecState* state, JS${interfaceName}* thisObject, JSC::ThrowScope&amp; throwScope)\n&quot;);
+    push(@implContent, &quot;{\n&quot;);
+    push(@implContent, &quot;    return JSValue::encode(JS${interfaceName}::serialize(state, thisObject, throwScope));\n&quot;);
+    push(@implContent, &quot;}\n&quot;);
+    push(@implContent, &quot;\n&quot;);
+    push(@implContent, &quot;EncodedJSValue JSC_HOST_CALL ${serializerNativeFunctionName}(ExecState* state)\n&quot;);
+    push(@implContent, &quot;{\n&quot;);
+    push(@implContent, &quot;    return BindingCaller&lt;JS$interfaceName&gt;::callOperation&lt;${serializerNativeFunctionName}Caller&gt;(state, \&quot;$serializerFunctionName\&quot;);\n&quot;);
+    push(@implContent, &quot;}\n&quot;);
+    push(@implContent, &quot;\n&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub GenerateCallWithUsingReferences
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -337,7 +337,7 @@
</span><span class="cx">     return BindingCaller&lt;JSTestNode&gt;::callOperation&lt;jsTestNodePrototypeFunctionForEachCaller&gt;(state, &quot;forEach&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline EncodedJSValue jsTestNodePrototypeFunctionToJSONCaller(ExecState* state, JSTestNode* thisObject, JSC::ThrowScope&amp; throwScope)
</del><ins>+JSC::JSObject* JSTestNode::serialize(ExecState* state, JSTestNode* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     auto&amp; vm = state-&gt;vm();
</span><span class="cx">     auto* result = constructEmptyObject(state);
</span><span class="lines">@@ -346,9 +346,14 @@
</span><span class="cx">     ASSERT(!throwScope.exception());
</span><span class="cx">     result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;name&quot;), nameValue);
</span><span class="cx"> 
</span><del>-    return JSValue::encode(result);
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline EncodedJSValue jsTestNodePrototypeFunctionToJSONCaller(ExecState* state, JSTestNode* thisObject, JSC::ThrowScope&amp; throwScope)
+{
+    return JSValue::encode(JSTestNode::serialize(state, thisObject, throwScope));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionToJSON(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     return BindingCaller&lt;JSTestNode&gt;::callOperation&lt;jsTestNodePrototypeFunctionToJSONCaller&gt;(state, &quot;toJSON&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.h        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static JSC::JSValue getConstructor(JSC::VM&amp;, const JSC::JSGlobalObject*);
</span><ins>+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestNode* thisObject, JSC::ThrowScope&amp;);
</ins><span class="cx">     static void visitChildren(JSCell*, JSC::SlotVisitor&amp;);
</span><span class="cx"> 
</span><span class="cx">     TestNode&amp; wrapped() const
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -8578,7 +8578,7 @@
</span><span class="cx">     return JSValue::encode(toJS&lt;IDLUSVString&gt;(*state, impl.stringifierAttribute()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline EncodedJSValue jsTestObjPrototypeFunctionToJSONCaller(ExecState* state, JSTestObj* thisObject, JSC::ThrowScope&amp; throwScope)
</del><ins>+JSC::JSObject* JSTestObj::serialize(ExecState* state, JSTestObj* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     auto&amp; vm = state-&gt;vm();
</span><span class="cx">     auto* result = constructEmptyObject(state);
</span><span class="lines">@@ -8599,9 +8599,14 @@
</span><span class="cx">     ASSERT(!throwScope.exception());
</span><span class="cx">     result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;longAttr&quot;), longAttrValue);
</span><span class="cx"> 
</span><del>-    return JSValue::encode(result);
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline EncodedJSValue jsTestObjPrototypeFunctionToJSONCaller(ExecState* state, JSTestObj* thisObject, JSC::ThrowScope&amp; throwScope)
+{
+    return JSValue::encode(JSTestObj::serialize(state, thisObject, throwScope));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionToJSON(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     return BindingCaller&lt;JSTestObj&gt;::callOperation&lt;jsTestObjPrototypeFunctionToJSONCaller&gt;(state, &quot;toJSON&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> 
</span><span class="cx">     static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&amp;, JSC::EnumerationMode = JSC::EnumerationMode());
</span><span class="cx">     static JSC::JSValue getConstructor(JSC::VM&amp;, const JSC::JSGlobalObject*);
</span><ins>+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestObj* thisObject, JSC::ThrowScope&amp;);
</ins><span class="cx">     mutable JSC::WriteBarrier&lt;JSC::Unknown&gt; m_cachedAttribute1;
</span><span class="cx">     mutable JSC::WriteBarrier&lt;JSC::Unknown&gt; m_cachedAttribute2;
</span><span class="cx">     static void visitChildren(JSCell*, JSC::SlotVisitor&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.cpp        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -400,7 +400,7 @@
</span><span class="cx">     return getDOMConstructor&lt;JSTestSerializationConstructor&gt;(vm, *jsCast&lt;const JSDOMGlobalObject*&gt;(globalObject));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline EncodedJSValue jsTestSerializationPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerialization* thisObject, JSC::ThrowScope&amp; throwScope)
</del><ins>+JSC::JSObject* JSTestSerialization::serialize(ExecState* state, JSTestSerialization* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     auto&amp; vm = state-&gt;vm();
</span><span class="cx">     auto* result = constructEmptyObject(state);
</span><span class="lines">@@ -425,9 +425,14 @@
</span><span class="cx">     ASSERT(!throwScope.exception());
</span><span class="cx">     result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;sixthTypedefAttribute&quot;), sixthTypedefAttributeValue);
</span><span class="cx"> 
</span><del>-    return JSValue::encode(result);
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline EncodedJSValue jsTestSerializationPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerialization* thisObject, JSC::ThrowScope&amp; throwScope)
+{
+    return JSValue::encode(JSTestSerialization::serialize(state, thisObject, throwScope));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestSerializationPrototypeFunctionToJSON(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     return BindingCaller&lt;JSTestSerialization&gt;::callOperation&lt;jsTestSerializationPrototypeFunctionToJSONCaller&gt;(state, &quot;toJSON&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerialization.h        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static JSC::JSValue getConstructor(JSC::VM&amp;, const JSC::JSGlobalObject*);
</span><ins>+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerialization* thisObject, JSC::ThrowScope&amp;);
</ins><span class="cx"> protected:
</span><span class="cx">     JSTestSerialization(JSC::Structure*, JSDOMGlobalObject&amp;, Ref&lt;TestSerialization&gt;&amp;&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInheritcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.cpp        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -201,38 +201,23 @@
</span><span class="cx">     return getDOMConstructor&lt;JSTestSerializationInheritConstructor&gt;(vm, *jsCast&lt;const JSDOMGlobalObject*&gt;(globalObject));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline EncodedJSValue jsTestSerializationInheritPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInherit* thisObject, JSC::ThrowScope&amp; throwScope)
</del><ins>+JSC::JSObject* JSTestSerializationInherit::serialize(ExecState* state, JSTestSerializationInherit* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     auto&amp; vm = state-&gt;vm();
</span><del>-    auto* result = constructEmptyObject(state);
</del><ins>+    auto* result = JSTestSerialization::serialize(state, thisObject, throwScope);
</ins><span class="cx"> 
</span><del>-    auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;firstStringAttribute&quot;), firstStringAttributeValue);
-
-    auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;secondLongAttribute&quot;), secondLongAttributeValue);
-
-    auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;fourthUnrestrictedDoubleAttribute&quot;), fourthUnrestrictedDoubleAttributeValue);
-
-    auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;fifthLongAttribute&quot;), fifthLongAttributeValue);
-
-    auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;sixthTypedefAttribute&quot;), sixthTypedefAttributeValue);
-
</del><span class="cx">     auto inheritLongAttributeValue = jsTestSerializationInheritInheritLongAttributeGetter(*state, *thisObject, throwScope);
</span><span class="cx">     ASSERT(!throwScope.exception());
</span><span class="cx">     result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;inheritLongAttribute&quot;), inheritLongAttributeValue);
</span><span class="cx"> 
</span><del>-    return JSValue::encode(result);
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline EncodedJSValue jsTestSerializationInheritPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInherit* thisObject, JSC::ThrowScope&amp; throwScope)
+{
+    return JSValue::encode(JSTestSerializationInherit::serialize(state, thisObject, throwScope));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestSerializationInheritPrototypeFunctionToJSON(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     return BindingCaller&lt;JSTestSerializationInherit&gt;::callOperation&lt;jsTestSerializationInheritPrototypeFunctionToJSONCaller&gt;(state, &quot;toJSON&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInherith"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInherit.h        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static JSC::JSValue getConstructor(JSC::VM&amp;, const JSC::JSGlobalObject*);
</span><ins>+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerializationInherit* thisObject, JSC::ThrowScope&amp;);
</ins><span class="cx">     TestSerializationInherit&amp; wrapped() const
</span><span class="cx">     {
</span><span class="cx">         return static_cast&lt;TestSerializationInherit&amp;&gt;(Base::wrapped());
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInheritFinalcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -239,42 +239,23 @@
</span><span class="cx">     return getDOMConstructor&lt;JSTestSerializationInheritFinalConstructor&gt;(vm, *jsCast&lt;const JSDOMGlobalObject*&gt;(globalObject));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline EncodedJSValue jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInheritFinal* thisObject, JSC::ThrowScope&amp; throwScope)
</del><ins>+JSC::JSObject* JSTestSerializationInheritFinal::serialize(ExecState* state, JSTestSerializationInheritFinal* thisObject, ThrowScope&amp; throwScope)
</ins><span class="cx"> {
</span><span class="cx">     auto&amp; vm = state-&gt;vm();
</span><del>-    auto* result = constructEmptyObject(state);
</del><ins>+    auto* result = JSTestSerializationInherit::serialize(state, thisObject, throwScope);
</ins><span class="cx"> 
</span><del>-    auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;firstStringAttribute&quot;), firstStringAttributeValue);
-
-    auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;secondLongAttribute&quot;), secondLongAttributeValue);
-
-    auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;fourthUnrestrictedDoubleAttribute&quot;), fourthUnrestrictedDoubleAttributeValue);
-
-    auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;fifthLongAttribute&quot;), fifthLongAttributeValue);
-
-    auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;sixthTypedefAttribute&quot;), sixthTypedefAttributeValue);
-
-    auto inheritLongAttributeValue = jsTestSerializationInheritInheritLongAttributeGetter(*state, *thisObject, throwScope);
-    ASSERT(!throwScope.exception());
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;inheritLongAttribute&quot;), inheritLongAttributeValue);
-
</del><span class="cx">     auto finalLongAttributeBarValue = jsTestSerializationInheritFinalFinalLongAttributeBarGetter(*state, *thisObject, throwScope);
</span><span class="cx">     ASSERT(!throwScope.exception());
</span><span class="cx">     result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;finalLongAttributeBar&quot;), finalLongAttributeBarValue);
</span><span class="cx"> 
</span><del>-    return JSValue::encode(result);
</del><ins>+    return result;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline EncodedJSValue jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller(ExecState* state, JSTestSerializationInheritFinal* thisObject, JSC::ThrowScope&amp; throwScope)
+{
+    return JSValue::encode(JSTestSerializationInheritFinal::serialize(state, thisObject, throwScope));
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestSerializationInheritFinalPrototypeFunctionToJSON(ExecState* state)
</span><span class="cx"> {
</span><span class="cx">     return BindingCaller&lt;JSTestSerializationInheritFinal&gt;::callOperation&lt;jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller&gt;(state, &quot;toJSON&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestSerializationInheritFinalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h (212343 => 212344)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h        2017-02-15 05:19:57 UTC (rev 212343)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializationInheritFinal.h        2017-02-15 07:12:05 UTC (rev 212344)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static JSC::JSValue getConstructor(JSC::VM&amp;, const JSC::JSGlobalObject*);
</span><ins>+    static JSC::JSObject* serialize(JSC::ExecState*, JSTestSerializationInheritFinal* thisObject, JSC::ThrowScope&amp;);
</ins><span class="cx">     TestSerializationInheritFinal&amp; wrapped() const
</span><span class="cx">     {
</span><span class="cx">         return static_cast&lt;TestSerializationInheritFinal&amp;&gt;(Base::wrapped());
</span></span></pre>
</div>
</div>

</body>
</html>