8170977: SparseArrayData should not grow its underlying dense array data
Reviewed-by: jlaskey, attila
--- 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;
}