Title: [231375] trunk
Revision
231375
Author
keith_mil...@apple.com
Date
2018-05-04 13:47:57 -0700 (Fri, 04 May 2018)

Log Message

isCacheableArrayLength should return true for undecided arrays
https://bugs.webkit.org/show_bug.cgi?id=185309

Reviewed by Michael Saboff.

JSTests:

* stress/get-array-length-undecided.js: Added.
(test):

Source/_javascript_Core:

Undecided arrays have butterflies so there is no reason why we
should not be able to cache their length.

* bytecode/InlineAccess.cpp:
(JSC::InlineAccess::isCacheableArrayLength):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (231374 => 231375)


--- trunk/JSTests/ChangeLog	2018-05-04 20:44:36 UTC (rev 231374)
+++ trunk/JSTests/ChangeLog	2018-05-04 20:47:57 UTC (rev 231375)
@@ -1,3 +1,13 @@
+2018-05-04  Keith Miller  <keith_mil...@apple.com>
+
+        isCacheableArrayLength should return true for undecided arrays
+        https://bugs.webkit.org/show_bug.cgi?id=185309
+
+        Reviewed by Michael Saboff.
+
+        * stress/get-array-length-undecided.js: Added.
+        (test):
+
 2018-05-04  Dominik Infuehr  <dinfu...@igalia.com>
 
         Disable tests on systems with limited memory

Added: trunk/JSTests/stress/get-array-length-undecided.js (0 => 231375)


--- trunk/JSTests/stress/get-array-length-undecided.js	                        (rev 0)
+++ trunk/JSTests/stress/get-array-length-undecided.js	2018-05-04 20:47:57 UTC (rev 231375)
@@ -0,0 +1,10 @@
+function test(array) {
+    return array.length;
+}
+noInline(test);
+
+let array = new Array(10);
+for (let i = 0; i < 10000; i++) {
+    if (test(array) !== 10)
+        throw new Error("bad result");
+}

Modified: trunk/Source/_javascript_Core/ChangeLog (231374 => 231375)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-04 20:44:36 UTC (rev 231374)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-04 20:47:57 UTC (rev 231375)
@@ -1,3 +1,16 @@
+2018-05-04  Keith Miller  <keith_mil...@apple.com>
+
+        isCacheableArrayLength should return true for undecided arrays
+        https://bugs.webkit.org/show_bug.cgi?id=185309
+
+        Reviewed by Michael Saboff.
+
+        Undecided arrays have butterflies so there is no reason why we
+        should not be able to cache their length.
+
+        * bytecode/InlineAccess.cpp:
+        (JSC::InlineAccess::isCacheableArrayLength):
+
 2018-05-03  Yusuke Suzuki  <utatane....@gmail.com>
 
         Remove std::random_shuffle

Modified: trunk/Source/_javascript_Core/bytecode/InlineAccess.cpp (231374 => 231375)


--- trunk/Source/_javascript_Core/bytecode/InlineAccess.cpp	2018-05-04 20:44:36 UTC (rev 231374)
+++ trunk/Source/_javascript_Core/bytecode/InlineAccess.cpp	2018-05-04 20:47:57 UTC (rev 231375)
@@ -249,9 +249,7 @@
     if (!hasFreeRegister(stubInfo))
         return false;
 
-    return array->indexingType() == ArrayWithInt32
-        || array->indexingType() == ArrayWithDouble
-        || array->indexingType() == ArrayWithContiguous;
+    return !hasAnyArrayStorage(array->indexingType()) && array->indexingType() != ArrayClass;
 }
 
 bool InlineAccess::generateArrayLength(StructureStubInfo& stubInfo, JSArray* array)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to