Title: [228615] releases/WebKitGTK/webkit-2.20/Source/_javascript_Core
Revision
228615
Author
carlo...@webkit.org
Date
2018-02-19 00:51:14 -0800 (Mon, 19 Feb 2018)

Log Message

Merge r228102 - Unreviewed, rolling out r228012.
https://bugs.webkit.org/show_bug.cgi?id=182493

"It regressed ARES-6 by 2-4%" (Requested by saamyjoon on

Reverted changeset:

"[JSC] Clean up ArraySpeciesCreate"
https://bugs.webkit.org/show_bug.cgi?id=182434
https://trac.webkit.org/changeset/228012

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/ChangeLog (228614 => 228615)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/ChangeLog	2018-02-19 08:51:08 UTC (rev 228614)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/ChangeLog	2018-02-19 08:51:14 UTC (rev 228615)
@@ -1,3 +1,17 @@
+2018-02-05  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r228012.
+        https://bugs.webkit.org/show_bug.cgi?id=182493
+
+        "It regressed ARES-6 by 2-4%" (Requested by saamyjoon on
+        #webkit).
+
+        Reverted changeset:
+
+        "[JSC] Clean up ArraySpeciesCreate"
+        https://bugs.webkit.org/show_bug.cgi?id=182434
+        https://trac.webkit.org/changeset/228012
+
 2018-02-02  Ryan Haddad  <ryanhad...@apple.com>
 
         Rebaseline bindings generator tests after r228032.

Modified: releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/builtins/ArrayPrototype.js (228614 => 228615)


--- releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/builtins/ArrayPrototype.js	2018-02-19 08:51:08 UTC (rev 228614)
+++ releases/WebKitGTK/webkit-2.20/Source/_javascript_Core/builtins/ArrayPrototype.js	2018-02-19 08:51:14 UTC (rev 228615)
@@ -164,45 +164,39 @@
     }
 }
 
-@globalPrivate
-function arraySpeciesCreate(array, length)
+function filter(callback /*, thisArg */)
 {
     "use strict";
 
+    var array = @toObject(this, "Array.prototype.filter requires that |this| not be null or undefined");
+    var length = @toLength(array.length);
+
+    if (typeof callback !== "function")
+        @throwTypeError("Array.prototype.filter callback must be a function");
+    
+    var thisArg = @argument(1);
+
+    // Do 9.4.2.3 ArraySpeciesCreate
+    var result;
     var constructor;
-    var arrayConstructorInRealm = @Array;
     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) && arrayConstructorInRealm !== constructor)
+        if (@isArrayConstructor(constructor) && @Array !== constructor)
             constructor = @undefined;
-        else if (@isObject(constructor)) {
+        if (@isObject(constructor)) {
             constructor = constructor.@speciesSymbol;
             if (constructor === null)
                 constructor = @undefined;
         }
     }
-    if (constructor === arrayConstructorInRealm || constructor === @undefined)
-        return @newArrayWithSize(length);
-    return new constructor(length);
-}
+    if (constructor === @Array || constructor === @undefined)
+        result = @newArrayWithSize(0);
+    else
+        result = new constructor(0);
 
-function filter(callback /*, thisArg */)
-{
-    "use strict";
-
-    var array = @toObject(this, "Array.prototype.filter requires that |this| not be null or undefined");
-    var length = @toLength(array.length);
-
-    if (typeof callback !== "function")
-        @throwTypeError("Array.prototype.filter callback must be a function");
-    
-    var thisArg = @argument(1);
-
-    var result = @arraySpeciesCreate(array, 0);
-
     var nextIndex = 0;
     for (var i = 0; i < length; i++) {
         if (!(i in array))
@@ -228,7 +222,26 @@
     
     var thisArg = @argument(1);
 
-    var result = @arraySpeciesCreate(array, length);
+    // 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) && @Array !== constructor)
+            constructor = @undefined;
+        if (@isObject(constructor)) {
+            constructor = constructor.@speciesSymbol;
+            if (constructor === null)
+                constructor = @undefined;
+        }
+    }
+    if (constructor === @Array || constructor === @undefined)
+        result = @newArrayWithSize(length);
+    else
+        result = new constructor(length);
 
     for (var i = 0; i < length; i++) {
         if (!(i in array))
@@ -604,10 +617,28 @@
 
     var currentElement = @toObject(this, "Array.prototype.concat requires that |this| not be null or undefined");
 
-    var result = @arraySpeciesCreate(currentElement, 0);
-    var resultIsArray = @isJSArray(result);
+    var constructor;
+    if (@isArray(currentElement)) {
+        constructor = currentElement.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) && @Array !== constructor)
+            constructor = @undefined;
+        else if (@isObject(constructor)) {
+            constructor = constructor.@speciesSymbol;
+            if (constructor === null)
+                constructor = @Array;
+        }
+    }
 
     var argCount = arguments.length;
+    var result;
+    if (constructor === @Array || constructor === @undefined)
+        result = @newArrayWithSize(0);
+    else
+        result = new constructor(0);
+    var resultIsArray = @isJSArray(result);
 
     var resultIndex = 0;
     var argIndex = 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to