changeset 42958:4975a3a0dac4

8170977: SparseArrayData should not grow its underlying dense array data Reviewed-by: jlaskey, attila
author hannesw
date Thu, 22 Dec 2016 16:51:07 +0100
parents 17469f16fbb4
children c2cff53239e0
files nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }