<!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>[197536] 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/197536">197536</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2016-03-03 17:56:39 -0800 (Thu, 03 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Array prototype JS builtins should support Symbol.species
https://bugs.webkit.org/show_bug.cgi?id=154710

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Add support for Symbol.species in the Array.prototype JS
builtin functions.

* builtins/ArrayPrototype.js:
(filter):
(map):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::finishCreation):
(JSC::arrayConstructorPrivateFuncIsArrayConstructor):
* runtime/ArrayConstructor.h:
(JSC::ArrayConstructor::create):
* runtime/CommonIdentifiers.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* tests/stress/array-species-functions.js:
(id):

LayoutTests:

Add test that checks the Array object created by a species
constructor in Array.prototype functions cannot come from a
different global object without subclassing.

* js/array-species-different-globalobjects-expected.txt: Added.
* js/array-species-different-globalobjects.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastprofilerbuiltinfunctioncallsanonymousexpectedtxt">trunk/LayoutTests/fast/profiler/built-in-function-calls-anonymous-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastprofilerbuiltinfunctioncallsuserdefinedfunctionexpectedtxt">trunk/LayoutTests/fast/profiler/built-in-function-calls-user-defined-function-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebuiltinsArrayPrototypejs">trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeArrayConstructorcpp">trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeArrayConstructorh">trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrayspeciesfunctionsjs">trunk/Source/JavaScriptCore/tests/stress/array-species-functions.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsarrayspeciesdifferentglobalobjectsexpectedtxt">trunk/LayoutTests/js/array-species-different-globalobjects-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrayspeciesdifferentglobalobjectshtml">trunk/LayoutTests/js/array-species-different-globalobjects.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/LayoutTests/ChangeLog        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-03-03  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        Array prototype JS builtins should support Symbol.species
+        https://bugs.webkit.org/show_bug.cgi?id=154710
+
+        Reviewed by Geoffrey Garen.
+
+        Add test that checks the Array object created by a species
+        constructor in Array.prototype functions cannot come from a
+        different global object without subclassing.
+
+        * js/array-species-different-globalobjects-expected.txt: Added.
+        * js/array-species-different-globalobjects.html: Added.
+
</ins><span class="cx"> 2016-03-03  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Make Unicode RegExp pattern parsing conform to the spec
</span></span></pre></div>
<a id="trunkLayoutTestsfastprofilerbuiltinfunctioncallsanonymousexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/profiler/built-in-function-calls-anonymous-expected.txt (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/profiler/built-in-function-calls-anonymous-expected.txt        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/LayoutTests/fast/profiler/built-in-function-calls-anonymous-expected.txt        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -12,6 +12,10 @@
</span><span class="cx">             toInteger (no file) (line 0:0)
</span><span class="cx">                Number (no file) (line 0:0)
</span><span class="cx">                (anonymous function) (no file) (line 0:0)
</span><ins>+         isArray (no file) (line 0:0)
+         (anonymous function) (no file) (line 0:0)
+         speciesGetter (no file) (line 0:0)
+         Array (no file) (line 0:0)
</ins><span class="cx">          myFunction built-in-function-calls-anonymous.html (line 14:30)
</span><span class="cx">             arrayOperatorFunction profiler-test-JS-resources.js (line 25:31)
</span><span class="cx">       endTest profiler-test-JS-resources.js (line 1:17)
</span></span></pre></div>
<a id="trunkLayoutTestsfastprofilerbuiltinfunctioncallsuserdefinedfunctionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/profiler/built-in-function-calls-user-defined-function-expected.txt (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/profiler/built-in-function-calls-user-defined-function-expected.txt        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/LayoutTests/fast/profiler/built-in-function-calls-user-defined-function-expected.txt        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -12,6 +12,10 @@
</span><span class="cx">             toInteger (no file) (line 0:0)
</span><span class="cx">                Number (no file) (line 0:0)
</span><span class="cx">                (anonymous function) (no file) (line 0:0)
</span><ins>+         isArray (no file) (line 0:0)
+         (anonymous function) (no file) (line 0:0)
+         speciesGetter (no file) (line 0:0)
+         Array (no file) (line 0:0)
</ins><span class="cx">          arrayOperatorFunction profiler-test-JS-resources.js (line 25:31)
</span><span class="cx">       endTest profiler-test-JS-resources.js (line 1:17)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrayspeciesdifferentglobalobjectsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/array-species-different-globalobjects-expected.txt (0 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/array-species-different-globalobjects-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/array-species-different-globalobjects-expected.txt        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+PASS result instanceof Array is true
+PASS result instanceof Array is true
+PASS result instanceof Array is true
+PASS result instanceof Array is true
+PASS result instanceof Array is true
+PASS result instanceof Array is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrayspeciesdifferentglobalobjectshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/array-species-different-globalobjects.html (0 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/array-species-different-globalobjects.html                                (rev 0)
+++ trunk/LayoutTests/js/array-species-different-globalobjects.html        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;iframe srcdoc=&quot;&lt;script&gt;&lt;/script&gt;&quot;&gt;
+&lt;/iframe&gt;
+&lt;script&gt;
+
+function id(x) { return x; }
+
+testFunctions = [
+    [Array.prototype.concat, []],
+    [Array.prototype.slice, [1,2]],
+    [Array.prototype.splice, []],
+    [Array.prototype.splice, [0,1]],
+    [Array.prototype.map, [id]],
+    [Array.prototype.filter, [id]]
+];
+
+let otherArray = frames[0].Array(10);
+
+var result;
+
+function testFunction(testArgs) {
+    let [func, args] = testArgs;
+
+    result = func.call(otherArray, ...args);
+
+    shouldBeTrue(&quot;result instanceof Array&quot;);
+}
+
+testFunctions.forEach(testFunction);
+
+
+&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-03-03  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        Array prototype JS builtins should support Symbol.species
+        https://bugs.webkit.org/show_bug.cgi?id=154710
+
+        Reviewed by Geoffrey Garen.
+
+        Add support for Symbol.species in the Array.prototype JS
+        builtin functions.
+
+        * builtins/ArrayPrototype.js:
+        (filter):
+        (map):
+        * runtime/ArrayConstructor.cpp:
+        (JSC::ArrayConstructor::finishCreation):
+        (JSC::arrayConstructorPrivateFuncIsArrayConstructor):
+        * runtime/ArrayConstructor.h:
+        (JSC::ArrayConstructor::create):
+        * runtime/CommonIdentifiers.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * tests/stress/array-species-functions.js:
+        (id):
+
</ins><span class="cx"> 2016-03-03  Michael Saboff  &lt;msaboff@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Make Unicode RegExp pattern parsing conform to the spec
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsArrayPrototypejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/builtins/ArrayPrototype.js        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -169,7 +169,28 @@
</span><span class="cx">         throw new @TypeError(&quot;Array.prototype.filter callback must be a function&quot;);
</span><span class="cx">     
</span><span class="cx">     var thisArg = arguments.length &gt; 1 ? arguments[1] : @undefined;
</span><del>-    var result = [];
</del><ins>+
+    // Do 9.4.2.3 ArraySpeciesCreate
+    var result;
+    var constructor;
+    if (@isArray(array)) {
+        constructor = array.constructor;
+        // We have this check so that if some array from a different global object
+        // calls this map they don't get an array with the Array.prototype of the
+        // other global object.
+        if (@isArrayConstructor(constructor) &amp;&amp; @Array !== constructor)
+            constructor = @undefined;
+        if (@isObject(constructor)) {
+            constructor = constructor[@symbolSpecies];
+            if (constructor === null)
+                constructor = @undefined;
+        }
+    }
+    if (constructor === @undefined) {
+        result = [];
+    } else
+        result = new constructor(0);
+
</ins><span class="cx">     var nextIndex = 0;
</span><span class="cx">     for (var i = 0; i &lt; length; i++) {
</span><span class="cx">         if (!(i in array))
</span><span class="lines">@@ -200,8 +221,28 @@
</span><span class="cx">         throw new @TypeError(&quot;Array.prototype.map callback must be a function&quot;);
</span><span class="cx">     
</span><span class="cx">     var thisArg = arguments.length &gt; 1 ? arguments[1] : @undefined;
</span><del>-    var result = [];
-    result.length = length;
</del><ins>+
+    // Do 9.4.2.3 ArraySpeciesCreate
+    var result;
+    var constructor;
+    if (@isArray(array)) {
+        constructor = array.constructor;
+        // We have this check so that if some array from a different global object
+        // calls this map they don't get an array with the Array.prototype of the
+        // other global object.
+        if (@isArrayConstructor(constructor) &amp;&amp; @Array !== constructor)
+            constructor = @undefined;
+        if (@isObject(constructor)) {
+            constructor = constructor[@symbolSpecies];
+            if (constructor === null)
+                constructor = @undefined;
+        }
+    }
+    if (constructor === @undefined) {
+        result = @Array(length);
+    } else
+        result = new constructor(length);
+
</ins><span class="cx">     var nextIndex = 0;
</span><span class="cx">     for (var i = 0; i &lt; length; i++) {
</span><span class="cx">         if (!(i in array))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeArrayConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -51,7 +51,6 @@
</span><span class="cx"> 
</span><span class="cx"> /* Source for ArrayConstructor.lut.h
</span><span class="cx"> @begin arrayConstructorTable
</span><del>-  isArray   arrayConstructorIsArray     DontEnum|Function 1
</del><span class="cx">   of        JSBuiltin                   DontEnum|Function 0
</span><span class="cx">   from      JSBuiltin                   DontEnum|Function 0
</span><span class="cx"> @end
</span><span class="lines">@@ -62,12 +61,13 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ArrayConstructor::finishCreation(VM&amp; vm, ArrayPrototype* arrayPrototype, GetterSetter* speciesSymbol)
</del><ins>+void ArrayConstructor::finishCreation(VM&amp; vm, JSGlobalObject* globalObject, ArrayPrototype* arrayPrototype, GetterSetter* speciesSymbol)
</ins><span class="cx"> {
</span><span class="cx">     Base::finishCreation(vm, arrayPrototype-&gt;classInfo()-&gt;className);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
</span><span class="cx">     putDirectWithoutTransition(vm, vm.propertyNames-&gt;length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
</span><span class="cx">     putDirectNonIndexAccessor(vm, vm.propertyNames-&gt;speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum);
</span><ins>+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames-&gt;isArray, arrayConstructorIsArray, DontEnum, 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &amp;slot)
</span><span class="lines">@@ -130,4 +130,9 @@
</span><span class="cx">     return JSValue::encode(jsBoolean(exec-&gt;argument(0).inherits(JSArray::info())));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL arrayConstructorPrivateFuncIsArrayConstructor(ExecState* exec)
+{
+    return JSValue::encode(jsBoolean(jsDynamicCast&lt;ArrayConstructor*&gt;(exec-&gt;uncheckedArgument(0))));
+}
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeArrayConstructorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/runtime/ArrayConstructor.h        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -35,10 +35,10 @@
</span><span class="cx">     typedef InternalFunction Base;
</span><span class="cx">     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
</span><span class="cx"> 
</span><del>-    static ArrayConstructor* create(VM&amp; vm, Structure* structure, ArrayPrototype* arrayPrototype, GetterSetter* speciesSymbol)
</del><ins>+    static ArrayConstructor* create(VM&amp; vm, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype, GetterSetter* speciesSymbol)
</ins><span class="cx">     {
</span><span class="cx">         ArrayConstructor* constructor = new (NotNull, allocateCell&lt;ArrayConstructor&gt;(vm.heap)) ArrayConstructor(vm, structure);
</span><del>-        constructor-&gt;finishCreation(vm, arrayPrototype, speciesSymbol);
</del><ins>+        constructor-&gt;finishCreation(vm, globalObject, arrayPrototype, speciesSymbol);
</ins><span class="cx">         return constructor;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    void finishCreation(VM&amp;, ArrayPrototype*, GetterSetter* speciesSymbol);
</del><ins>+    void finishCreation(VM&amp;, JSGlobalObject*, ArrayPrototype*, GetterSetter* speciesSymbol);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ArrayConstructor(VM&amp;, Structure*);
</span><span class="lines">@@ -62,6 +62,8 @@
</span><span class="cx"> 
</span><span class="cx"> JSObject* constructArrayWithSizeQuirk(ExecState*, ArrayAllocationProfile*, JSGlobalObject*, JSValue length, JSValue prototype = JSValue());
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL arrayConstructorPrivateFuncIsArrayConstructor(ExecState*);
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // ArrayConstructor_h
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -364,6 +364,8 @@
</span><span class="cx">     macro(isBoundFunction) \
</span><span class="cx">     macro(hasInstanceBoundFunction) \
</span><span class="cx">     macro(instanceOf) \
</span><ins>+    macro(isArray) \
+    macro(isArrayConstructor) \
</ins><span class="cx">     macro(isSet) \
</span><span class="cx">     macro(isMap) \
</span><span class="cx">     macro(SetIterator) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -409,7 +409,7 @@
</span><span class="cx">     m_definePropertyFunction.set(vm, this, definePropertyFunction);
</span><span class="cx"> 
</span><span class="cx">     JSCell* functionConstructor = FunctionConstructor::create(vm, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get());
</span><del>-    JSObject* arrayConstructor = ArrayConstructor::create(vm, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get(), speciesGetterSetter);
</del><ins>+    JSObject* arrayConstructor = ArrayConstructor::create(vm, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get(), speciesGetterSetter);
</ins><span class="cx">     
</span><span class="cx">     m_regExpConstructor.set(vm, this, RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get(), speciesGetterSetter));
</span><span class="cx">     
</span><span class="lines">@@ -530,6 +530,7 @@
</span><span class="cx">     JSFunction* privateFuncHasInstanceBoundFunction = JSFunction::create(vm, this, 0, String(), hasInstanceBoundFunction);
</span><span class="cx">     JSFunction* privateFuncInstanceOf = JSFunction::create(vm, this, 0, String(), objectPrivateFuncInstanceOf);
</span><span class="cx">     JSFunction* privateFuncThisTimeValue = JSFunction::create(vm, this, 0, String(), dateProtoFuncGetTime);
</span><ins>+    JSFunction* privateFuncIsArrayConstructor = JSFunction::create(vm, this, 0, String(), arrayConstructorPrivateFuncIsArrayConstructor);
</ins><span class="cx"> 
</span><span class="cx">     GlobalPropertyInfo staticGlobals[] = {
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;NaN, jsNaN(), DontEnum | DontDelete | ReadOnly),
</span><span class="lines">@@ -563,6 +564,8 @@
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;SetIteratorPrivateName, JSFunction::create(vm, this, 1, String(), privateFuncSetIterator), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;setIteratorNextPrivateName, JSFunction::create(vm, this, 0, String(), privateFuncSetIteratorNext), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;isMapPrivateName, JSFunction::create(vm, this, 1, String(), privateFuncIsMap), DontEnum | DontDelete | ReadOnly),
</span><ins>+        GlobalPropertyInfo(vm.propertyNames-&gt;isArrayPrivateName, arrayConstructor-&gt;getDirect(vm, vm.propertyNames-&gt;isArray), DontEnum | DontDelete | ReadOnly),
+        GlobalPropertyInfo(vm.propertyNames-&gt;isArrayConstructorPrivateName, privateFuncIsArrayConstructor, DontEnum | DontDelete | ReadOnly),
</ins><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;MapIteratorPrivateName, JSFunction::create(vm, this, 1, String(), privateFuncMapIterator), DontEnum | DontDelete | ReadOnly),
</span><span class="cx">         GlobalPropertyInfo(vm.propertyNames-&gt;mapIteratorNextPrivateName, JSFunction::create(vm, this, 0, String(), privateFuncMapIteratorNext), DontEnum | DontDelete | ReadOnly),
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrayspeciesfunctionsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/stress/array-species-functions.js (197535 => 197536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/array-species-functions.js        2016-03-04 01:56:05 UTC (rev 197535)
+++ trunk/Source/JavaScriptCore/tests/stress/array-species-functions.js        2016-03-04 01:56:39 UTC (rev 197536)
</span><span class="lines">@@ -2,11 +2,15 @@
</span><span class="cx"> N = class { }
</span><span class="cx"> N[Symbol.species] = function() { throw &quot;this should never be called&quot;; }
</span><span class="cx"> 
</span><ins>+function id(x) { return x; }
+
</ins><span class="cx"> testFunctions = [
</span><span class="cx">     [Array.prototype.concat, []],
</span><span class="cx">     [Array.prototype.slice, [1,2]],
</span><span class="cx">     [Array.prototype.splice, []],
</span><del>-    [Array.prototype.splice, [0,1]]
</del><ins>+    [Array.prototype.splice, [0,1]],
+    [Array.prototype.map, [id]],
+    [Array.prototype.filter, [id]]
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><span class="cx"> objProp = Object.defineProperty;
</span><span class="lines">@@ -28,7 +32,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Test non-array ignores constructor.
</span><span class="cx">     objProp(n, &quot;constructor&quot;, { value: C });
</span><del>-    let bar = protoFunction.call(...[n, ...args]);
</del><ins>+    let bar = protoFunction.call(n, ...args);
</ins><span class="cx">     if (!(bar instanceof Array) || bar instanceof N || bar instanceof C)
</span><span class="cx">         throw Error();
</span><span class="cx"> 
</span><span class="lines">@@ -40,12 +44,12 @@
</span><span class="cx">     foo = new C(10);
</span><span class="cx"> 
</span><span class="cx">     objProp(C, Symbol.species, { value: undefined, writable: true});
</span><del>-    bar = protoFunction.call(...[foo, ...args]);
</del><ins>+    bar = protoFunction.call(foo, ...args);
</ins><span class="cx">     if (!(bar instanceof Array) || bar instanceof C)
</span><span class="cx">         throw Error();
</span><span class="cx"> 
</span><span class="cx">     C[Symbol.species] = null;
</span><del>-    bar = protoFunction.call(...[foo, ...args]);
</del><ins>+    bar = protoFunction.call(foo, ...args);
</ins><span class="cx">     if (!(bar instanceof Array) || bar instanceof C)
</span><span class="cx">         throw Error();
</span><span class="cx"> 
</span><span class="lines">@@ -57,7 +61,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     C[Symbol.species] = species;
</span><del>-    bar = protoFunction.call(...[foo, ...args]);
</del><ins>+    bar = protoFunction.call(foo, ...args);
</ins><span class="cx"> 
</span><span class="cx">     if (!(bar instanceof Array) || !(bar instanceof C) || !called)
</span><span class="cx">         throw Error(&quot;failed on &quot; + protoFunction);
</span></span></pre>
</div>
</div>

</body>
</html>