<!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>[206710] trunk</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/206710">206710</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-10-01 16:35:17 -0700 (Sat, 01 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] GeneratorFunction constructor should instantiate generator function
https://bugs.webkit.org/show_bug.cgi?id=162838

Reviewed by Saam Barati.

JSTests:

* stress/generator-function-constructor-is-subclassible.js: Added.
(shouldBe):
(GeneratorFunction):
(prototype.hello):
* stress/generator-function-constructor.js:
* test262.yaml:

Source/JavaScriptCore:

GeneratorFunction's constructor should return an instance of JSGeneratorFunction
instead of JSFunction. In this patch, we fix the following 2 things.

1. GeneratorFunction constructor should use JSGeneratorFunction

    Previously, we used JSFunction to construct a result. It's wrong. We use JSGeneratorFunction.

2. Pass newTarget into GeneratorFunction constructor to make it subclassible

    We did not leverage newTarget when using GeneratorFunction constructor.
    Using it correctly to create the subclass Structure and making GeneratorFunction subclassible.

Test262 test covers (1), but (2) is not covered. We add tests that covers both to stress tests.

* runtime/FunctionConstructor.cpp:
(JSC::constructFunctionSkippingEvalEnabledCheck):
* runtime/GeneratorFunctionConstructor.cpp:
(JSC::constructGeneratorFunctionConstructor):
* runtime/JSGeneratorFunction.cpp:
(JSC::JSGeneratorFunction::JSGeneratorFunction):
(JSC::JSGeneratorFunction::createImpl):
(JSC::JSGeneratorFunction::create):
(JSC::JSGeneratorFunction::createWithInvalidatedReallocationWatchpoint):
* runtime/JSGeneratorFunction.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTestsstressgeneratorfunctionconstructorjs">trunk/JSTests/stress/generator-function-constructor.js</a></li>
<li><a href="#trunkJSTeststest262yaml">trunk/JSTests/test262.yaml</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeFunctionConstructorcpp">trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeGeneratorFunctionConstructorcpp">trunk/Source/JavaScriptCore/runtime/GeneratorFunctionConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGeneratorFunctioncpp">trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGeneratorFunctionh">trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestsstressgeneratorfunctionconstructorissubclassiblejs">trunk/JSTests/stress/generator-function-constructor-is-subclassible.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/JSTests/ChangeLog        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-10-01  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [ES6] GeneratorFunction constructor should instantiate generator function
+        https://bugs.webkit.org/show_bug.cgi?id=162838
+
+        Reviewed by Saam Barati.
+
+        * stress/generator-function-constructor-is-subclassible.js: Added.
+        (shouldBe):
+        (GeneratorFunction):
+        (prototype.hello):
+        * stress/generator-function-constructor.js:
+        * test262.yaml:
+
</ins><span class="cx"> 2016-09-30  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Arrow functions should not allow duplicate parameter names
</span></span></pre></div>
<a id="trunkJSTestsstressgeneratorfunctionconstructorissubclassiblejs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/generator-function-constructor-is-subclassible.js (0 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/generator-function-constructor-is-subclassible.js                                (rev 0)
+++ trunk/JSTests/stress/generator-function-constructor-is-subclassible.js        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+var GeneratorFunction = (function *() { }).constructor;
+
+class DerivedGeneratorFunction extends GeneratorFunction {
+    constructor()
+    {
+        super(&quot;yield 42&quot;);
+    }
+
+    hello()
+    {
+        return 50;
+    }
+}
+
+let DerivedGenerator = new DerivedGeneratorFunction();
+shouldBe(DerivedGenerator.__proto__, DerivedGeneratorFunction.prototype);
+shouldBe(DerivedGenerator.hello(), 50);
+let gen = DerivedGenerator();
+shouldBe(gen.next().value, 42);
</ins></span></pre></div>
<a id="trunkJSTestsstressgeneratorfunctionconstructorjs"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/stress/generator-function-constructor.js (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/generator-function-constructor.js        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/JSTests/stress/generator-function-constructor.js        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -7,3 +7,6 @@
</span><span class="cx"> var generatorFunctionConstructor = (function *() { }).constructor;
</span><span class="cx"> shouldBe(generatorFunctionConstructor.__proto__, Function);
</span><span class="cx"> shouldBe(generatorFunctionConstructor.prototype.constructor, generatorFunctionConstructor);
</span><ins>+shouldBe(generatorFunctionConstructor() instanceof generatorFunctionConstructor, true);
+shouldBe(generatorFunctionConstructor(&quot;a&quot;) instanceof generatorFunctionConstructor, true);
+shouldBe(generatorFunctionConstructor(&quot;a&quot;, &quot;b&quot;) instanceof generatorFunctionConstructor, true);
</ins></span></pre></div>
<a id="trunkJSTeststest262yaml"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/test262.yaml (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/test262.yaml        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/JSTests/test262.yaml        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -18664,9 +18664,9 @@
</span><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/extensibility.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;], [:strict]
</span><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/has-instance.js
</span><del>-  cmd: runTest262 :fail, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;], []
</del><ins>+  cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;], []
</ins><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/has-instance.js
</span><del>-  cmd: runTest262 :fail, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;], [:strict]
</del><ins>+  cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;], [:strict]
</ins><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-length.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;, &quot;../../../harness/propertyHelper.js&quot;], []
</span><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-length.js
</span><span class="lines">@@ -18676,9 +18676,9 @@
</span><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-name.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;, &quot;../../../harness/propertyHelper.js&quot;], [:strict]
</span><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-prototype.js
</span><del>-  cmd: runTest262 :fail, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;, &quot;../../../harness/propertyHelper.js&quot;], []
</del><ins>+  cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;, &quot;../../../harness/propertyHelper.js&quot;], []
</ins><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-prototype.js
</span><del>-  cmd: runTest262 :fail, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;, &quot;../../../harness/propertyHelper.js&quot;], [:strict]
</del><ins>+  cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;, &quot;../../../harness/propertyHelper.js&quot;], [:strict]
</ins><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-restricted-properties.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../harness/assert.js&quot;, &quot;../../../harness/sta.js&quot;], []
</span><span class="cx"> - path: test262/test/built-ins/GeneratorFunction/instance-restricted-properties.js
</span><span class="lines">@@ -76530,9 +76530,9 @@
</span><span class="cx"> - path: test262/test/language/statements/class/subclass/builtin-objects/GeneratorFunction/regular-subclassing.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../../../../../harness/assert.js&quot;, &quot;../../../../../../../harness/sta.js&quot;], [:strict]
</span><span class="cx"> - path: test262/test/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js
</span><del>-  cmd: runTest262 :fail, &quot;NoException&quot;, [&quot;../../../../../../../harness/assert.js&quot;, &quot;../../../../../../../harness/sta.js&quot;], []
</del><ins>+  cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../../../../../harness/assert.js&quot;, &quot;../../../../../../../harness/sta.js&quot;], []
</ins><span class="cx"> - path: test262/test/language/statements/class/subclass/builtin-objects/GeneratorFunction/super-must-be-called.js
</span><del>-  cmd: runTest262 :fail, &quot;NoException&quot;, [&quot;../../../../../../../harness/assert.js&quot;, &quot;../../../../../../../harness/sta.js&quot;], [:strict]
</del><ins>+  cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../../../../../harness/assert.js&quot;, &quot;../../../../../../../harness/sta.js&quot;], [:strict]
</ins><span class="cx"> - path: test262/test/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js
</span><span class="cx">   cmd: runTest262 :normal, &quot;NoException&quot;, [&quot;../../../../../../../harness/assert.js&quot;, &quot;../../../../../../../harness/sta.js&quot;], []
</span><span class="cx"> - path: test262/test/language/statements/class/subclass/builtin-objects/Map/regular-subclassing.js
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-10-01  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
+
+        [ES6] GeneratorFunction constructor should instantiate generator function
+        https://bugs.webkit.org/show_bug.cgi?id=162838
+
+        Reviewed by Saam Barati.
+
+        GeneratorFunction's constructor should return an instance of JSGeneratorFunction
+        instead of JSFunction. In this patch, we fix the following 2 things.
+
+        1. GeneratorFunction constructor should use JSGeneratorFunction
+
+            Previously, we used JSFunction to construct a result. It's wrong. We use JSGeneratorFunction.
+
+        2. Pass newTarget into GeneratorFunction constructor to make it subclassible
+
+            We did not leverage newTarget when using GeneratorFunction constructor.
+            Using it correctly to create the subclass Structure and making GeneratorFunction subclassible.
+
+        Test262 test covers (1), but (2) is not covered. We add tests that covers both to stress tests.
+
+        * runtime/FunctionConstructor.cpp:
+        (JSC::constructFunctionSkippingEvalEnabledCheck):
+        * runtime/GeneratorFunctionConstructor.cpp:
+        (JSC::constructGeneratorFunctionConstructor):
+        * runtime/JSGeneratorFunction.cpp:
+        (JSC::JSGeneratorFunction::JSGeneratorFunction):
+        (JSC::JSGeneratorFunction::createImpl):
+        (JSC::JSGeneratorFunction::create):
+        (JSC::JSGeneratorFunction::createWithInvalidatedReallocationWatchpoint):
+        * runtime/JSGeneratorFunction.h:
+
</ins><span class="cx"> 2016-10-01  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of isMarkedOrNewlyAllocated
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeFunctionConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx"> #include &quot;ExceptionHelpers.h&quot;
</span><span class="cx"> #include &quot;FunctionPrototype.h&quot;
</span><span class="cx"> #include &quot;JSFunction.h&quot;
</span><ins>+#include &quot;JSGeneratorFunction.h&quot;
</ins><span class="cx"> #include &quot;JSGlobalObject.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="lines">@@ -125,9 +126,11 @@
</span><span class="cx">         return throwException(exec, scope, exception);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Structure* subclassStructure = InternalFunction::createSubclassStructure(exec, newTarget, globalObject-&gt;functionStructure());
</del><ins>+    Structure* subclassStructure = InternalFunction::createSubclassStructure(exec, newTarget, functionConstructionMode == FunctionConstructionMode::Generator ? globalObject-&gt;generatorFunctionStructure() : globalObject-&gt;functionStructure());
</ins><span class="cx">     RETURN_IF_EXCEPTION(scope, nullptr);
</span><span class="cx"> 
</span><ins>+    if (functionConstructionMode == FunctionConstructionMode::Generator)
+        return JSGeneratorFunction::create(vm, function, globalObject-&gt;globalScope(), subclassStructure);
</ins><span class="cx">     return JSFunction::create(vm, function, globalObject-&gt;globalScope(), subclassStructure);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeGeneratorFunctionConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/GeneratorFunctionConstructor.cpp (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/GeneratorFunctionConstructor.cpp        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/Source/JavaScriptCore/runtime/GeneratorFunctionConstructor.cpp        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL constructGeneratorFunctionConstructor(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     ArgList args(exec);
</span><del>-    return JSValue::encode(constructFunction(exec, asInternalFunction(exec-&gt;callee())-&gt;globalObject(), args, FunctionConstructionMode::Generator));
</del><ins>+    return JSValue::encode(constructFunction(exec, asInternalFunction(exec-&gt;callee())-&gt;globalObject(), args, FunctionConstructionMode::Generator, exec-&gt;newTarget()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> CallType GeneratorFunctionConstructor::getCallData(JSCell*, CallData&amp; callData)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGeneratorFunctioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.cpp (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.cpp        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.cpp        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -39,14 +39,14 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo JSGeneratorFunction::s_info = { &quot;GeneratorFunction&quot;, &amp;Base::s_info, nullptr, CREATE_METHOD_TABLE(JSGeneratorFunction) };
</span><span class="cx"> 
</span><del>-JSGeneratorFunction::JSGeneratorFunction(VM&amp; vm, FunctionExecutable* executable, JSScope* scope)
-    : Base(vm, executable, scope, scope-&gt;globalObject()-&gt;generatorFunctionStructure())
</del><ins>+JSGeneratorFunction::JSGeneratorFunction(VM&amp; vm, FunctionExecutable* executable, JSScope* scope, Structure* structure)
+    : Base(vm, executable, scope, structure)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSGeneratorFunction* JSGeneratorFunction::createImpl(VM&amp; vm, FunctionExecutable* executable, JSScope* scope)
</del><ins>+JSGeneratorFunction* JSGeneratorFunction::createImpl(VM&amp; vm, FunctionExecutable* executable, JSScope* scope, Structure* structure)
</ins><span class="cx"> {
</span><del>-    JSGeneratorFunction* generatorFunction = new (NotNull, allocateCell&lt;JSGeneratorFunction&gt;(vm.heap)) JSGeneratorFunction(vm, executable, scope);
</del><ins>+    JSGeneratorFunction* generatorFunction = new (NotNull, allocateCell&lt;JSGeneratorFunction&gt;(vm.heap)) JSGeneratorFunction(vm, executable, scope, structure);
</ins><span class="cx">     ASSERT(generatorFunction-&gt;structure()-&gt;globalObject());
</span><span class="cx">     generatorFunction-&gt;finishCreation(vm);
</span><span class="cx">     return generatorFunction;
</span><span class="lines">@@ -54,7 +54,12 @@
</span><span class="cx"> 
</span><span class="cx"> JSGeneratorFunction* JSGeneratorFunction::create(VM&amp; vm, FunctionExecutable* executable, JSScope* scope)
</span><span class="cx"> {
</span><del>-    JSGeneratorFunction* generatorFunction = createImpl(vm, executable, scope);
</del><ins>+    return create(vm, executable, scope, scope-&gt;globalObject()-&gt;generatorFunctionStructure());
+}
+
+JSGeneratorFunction* JSGeneratorFunction::create(VM&amp; vm, FunctionExecutable* executable, JSScope* scope, Structure* structure)
+{
+    JSGeneratorFunction* generatorFunction = createImpl(vm, executable, scope, structure);
</ins><span class="cx">     executable-&gt;singletonFunction()-&gt;notifyWrite(vm, generatorFunction, &quot;Allocating a generator function&quot;);
</span><span class="cx">     return generatorFunction;
</span><span class="cx"> }
</span><span class="lines">@@ -61,7 +66,7 @@
</span><span class="cx"> 
</span><span class="cx"> JSGeneratorFunction* JSGeneratorFunction::createWithInvalidatedReallocationWatchpoint(VM&amp; vm, FunctionExecutable* executable, JSScope* scope)
</span><span class="cx"> {
</span><del>-    return createImpl(vm, executable, scope);
</del><ins>+    return createImpl(vm, executable, scope, scope-&gt;globalObject()-&gt;generatorFunctionStructure());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGeneratorFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.h (206709 => 206710)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.h        2016-10-01 21:14:19 UTC (rev 206709)
+++ trunk/Source/JavaScriptCore/runtime/JSGeneratorFunction.h        2016-10-01 23:35:17 UTC (rev 206710)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx">     DECLARE_EXPORT_INFO;
</span><span class="cx"> 
</span><span class="cx">     static JSGeneratorFunction* create(VM&amp;, FunctionExecutable*, JSScope*);
</span><ins>+    static JSGeneratorFunction* create(VM&amp;, FunctionExecutable*, JSScope*, Structure*);
</ins><span class="cx">     static JSGeneratorFunction* createWithInvalidatedReallocationWatchpoint(VM&amp;, FunctionExecutable*, JSScope*);
</span><span class="cx"> 
</span><span class="cx">     static size_t allocationSize(size_t inlineCapacity)
</span><span class="lines">@@ -84,9 +85,9 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    JSGeneratorFunction(VM&amp;, FunctionExecutable*, JSScope*);
</del><ins>+    JSGeneratorFunction(VM&amp;, FunctionExecutable*, JSScope*, Structure*);
</ins><span class="cx"> 
</span><del>-    static JSGeneratorFunction* createImpl(VM&amp;, FunctionExecutable*, JSScope*);
</del><ins>+    static JSGeneratorFunction* createImpl(VM&amp;, FunctionExecutable*, JSScope*, Structure*);
</ins><span class="cx"> 
</span><span class="cx">     friend class LLIntOffsetsExtractor;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>