--- old/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java 2015-12-10 13:51:25.988614798 +0100 +++ new/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java 2015-12-10 13:51:25.888614798 +0100 @@ -52,9 +52,6 @@ /** Minimum chunk size for underlying arrays */ protected static final int CHUNK_SIZE = 32; - /** Mask for getting a chunk */ - protected static final int CHUNK_MASK = CHUNK_SIZE - 1; - /** Untouched data - still link callsites as IntArrayData, but expands to * a proper ArrayData when we try to write to it */ public static final ArrayData EMPTY_ARRAY = new UntouchedArrayData(); @@ -164,11 +161,6 @@ } @Override - public ArrayData set(final int index, final long value, final boolean strict) { - return toRealArrayData(index).set(index, value, strict); - } - - @Override public ArrayData set(final int index, final double value, final boolean strict) { return toRealArrayData(index).set(index, value, strict); } @@ -179,11 +171,6 @@ } @Override - public long getLong(final int index) { - throw new ArrayIndexOutOfBoundsException(index); //empty - } - - @Override public double getDouble(final int index) { throw new ArrayIndexOutOfBoundsException(index); //empty } @@ -288,13 +275,13 @@ * @param length the initial length * @return ArrayData */ - public static ArrayData allocate(final int length) { - if (length == 0) { + public static ArrayData allocate(final long length) { + if (length == 0L) { return new IntArrayData(); } else if (length >= SparseArrayData.MAX_DENSE_LENGTH) { return new SparseArrayData(EMPTY_ARRAY, length); } else { - return new DeletedRangeArrayFilter(new IntArrayData(length), 0, length - 1); + return new DeletedRangeArrayFilter(new IntArrayData((int) length), 0, length - 1); } } @@ -309,8 +296,6 @@ if (clazz == int[].class) { return new IntArrayData((int[])array, ((int[])array).length); - } else if (clazz == long[].class) { - return new LongArrayData((long[])array, ((long[])array).length); } else if (clazz == double[].class) { return new NumberArrayData((double[])array, ((double[])array).length); } else { @@ -334,16 +319,6 @@ * @param array the array to use for initial elements * @return the ArrayData */ - public static ArrayData allocate(final long[] array) { - return new LongArrayData(array, array.length); - } - - /** - * Allocate an ArrayData wrapping a given array - * - * @param array the array to use for initial elements - * @return the ArrayData - */ public static ArrayData allocate(final double[] array) { return new NumberArrayData(array, array.length); } @@ -537,16 +512,6 @@ public abstract ArrayData set(final int index, final int value, final boolean strict); /** - * Set a long value at a given index - * - * @param index the index - * @param value the value - * @param strict are we in strict mode - * @return new array data (or same) - */ - public abstract ArrayData set(final int index, final long value, final boolean strict); - - /** * Set an double value at a given index * * @param index the index @@ -609,26 +574,6 @@ } /** - * Get a long value from a given index - * - * @param index the index - * @return the value - */ - public abstract long getLong(final int index); - - /** - * Get optimistic long - default is that it's impossible. Overridden - * by arrays that actually represents longs or narrower - * - * @param index the index - * @param programPoint program point - * @return the value - */ - public long getLongOptimistic(final int index, final int programPoint) { - throw new UnwarrantedOptimismException(getObject(index), programPoint, getOptimisticType()); - } - - /** * Get a double value from a given index * * @param index the index @@ -821,12 +766,8 @@ return Object.class; } final Class itemClass = item.getClass(); - if (itemClass == Long.class) { + if (itemClass == Double.class || itemClass == Float.class || itemClass == Long.class) { if (widest == Integer.class) { - widest = Long.class; - } - } else if (itemClass == Double.class || itemClass == Float.class) { - if (widest == Integer.class || widest == Long.class) { widest = Double.class; } } else if (itemClass != Integer.class && itemClass != Short.class && itemClass != Byte.class) {