8170977: SparseArrayData should not grow its underlying dense array data
authorhannesw
Thu, 22 Dec 2016 16:51:07 +0100
changeset 42958 4975a3a0dac4
parent 42845 17469f16fbb4
child 42959 c2cff53239e0
8170977: SparseArrayData should not grow its underlying dense array data Reviewed-by: jlaskey, attila
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Wed Jul 05 22:37:14 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Thu Dec 22 16:51:07 2016 +0100
@@ -37,7 +37,7 @@
  */
 class SparseArrayData extends ArrayData {
     /** Maximum size for dense arrays */
-    static final int MAX_DENSE_LENGTH = 1024 * 1024;
+    static final int MAX_DENSE_LENGTH = 128 * 1024;
 
     /** Underlying array. */
     private ArrayData underlying;
@@ -56,7 +56,7 @@
         super(length);
         assert underlying.length() <= length;
         this.underlying = underlying;
-        this.maxDenseLength = Math.max(MAX_DENSE_LENGTH, underlying.length());
+        this.maxDenseLength = underlying.length();
         this.sparseMap = sparseMap;
     }