< prev index next >

src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java

Print this page

        

*** 154,179 **** } return darray; } - private long[] toLongArray() { - assert length() <= array.length : "length exceeds internal array size"; - final int len = (int)length(); - final long[] larray = new long[array.length]; - - for (int index = 0; index < len; index++) { - larray[index] = array[index]; - } - - return larray; - } - - private LongArrayData convertToLong() { - return new LongArrayData(toLongArray(), (int)length()); - } - private NumberArrayData convertToDouble() { return new NumberArrayData(toDoubleArray(), (int)length()); } private ObjectArrayData convertToObject() { --- 154,163 ----
*** 182,193 **** @Override public ArrayData convert(final Class<?> type) { if (type == Integer.class || type == Byte.class || type == Short.class) { return this; - } else if (type == Long.class) { - return convertToLong(); } else if (type == Double.class || type == Float.class) { return convertToDouble(); } else { return convertToObject(); } --- 166,175 ----
*** 251,271 **** return this; } @Override - public ArrayData set(final int index, final long value, final boolean strict) { - if (JSType.isRepresentableAsInt(value)) { - array[index] = JSType.toInt32(value); - setLength(Math.max(index + 1, length())); - return this; - } - - return convert(Long.class).set(index, value, strict); - } - - @Override public ArrayData set(final int index, final double value, final boolean strict) { if (JSType.isRepresentableAsInt(value)) { array[index] = (int)(long)value; setLength(Math.max(index + 1, length())); return this; --- 233,242 ----
*** 283,302 **** public int getIntOptimistic(final int index, final int programPoint) { return array[index]; } @Override - public long getLong(final int index) { - return array[index]; - } - - @Override - public long getLongOptimistic(final int index, final int programPoint) { - return array[index]; - } - - @Override public double getDouble(final int index) { return array[index]; } @Override --- 254,263 ----
< prev index next >