Java Code Examples for jdk.nashorn.internal.runtime.arrays.ContinuousArrayData#fastPush()

The following examples show how to use jdk.nashorn.internal.runtime.arrays.ContinuousArrayData#fastPush() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeArray.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final Object arg) {
    //arg is [NativeArray] of same type.
    final ContinuousArrayData selfData = getContinuousArrayDataCCE(self);
    final ContinuousArrayData newData;

    if (arg instanceof NativeArray) {
        final ContinuousArrayData argData = (ContinuousArrayData)((NativeArray)arg).getArray();
        if (argData.isEmpty()) {
            newData = selfData.copy();
        } else if (selfData.isEmpty()) {
            newData = argData.copy();
        } else {
            final Class<?> widestElementType = selfData.widest(argData).getBoxedElementType();
            newData = ((ContinuousArrayData)selfData.convert(widestElementType)).fastConcat((ContinuousArrayData)argData.convert(widestElementType));
        }
    } else {
        newData = getContinuousArrayDataCCE(self, Object.class).copy();
        newData.fastPush(arg);
    }

    return new NativeArray(newData);
}
 
Example 2
Source File: NativeArray.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final Object arg) {
    //arg is [NativeArray] of same type.
    final ContinuousArrayData selfData = getContinuousArrayDataCCE(self);
    final ContinuousArrayData newData;

    if (arg instanceof NativeArray) {
        final ContinuousArrayData argData = (ContinuousArrayData)((NativeArray)arg).getArray();
        if (argData.isEmpty()) {
            newData = selfData.copy();
        } else if (selfData.isEmpty()) {
            newData = argData.copy();
        } else {
            final Class<?> widestElementType = selfData.widest(argData).getBoxedElementType();
            newData = ((ContinuousArrayData)selfData.convert(widestElementType)).fastConcat((ContinuousArrayData)argData.convert(widestElementType));
        }
    } else {
        newData = getContinuousArrayDataCCE(self, Object.class).copy();
        newData.fastPush(arg);
    }

    return new NativeArray(newData);
}
 
Example 3
Source File: NativeArray.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final Object arg) {
    //arg is [NativeArray] of same type.
    final ContinuousArrayData selfData = getContinuousArrayDataCCE(self);
    final ContinuousArrayData newData;

    if (arg instanceof NativeArray) {
        final ContinuousArrayData argData = (ContinuousArrayData)((NativeArray)arg).getArray();
        if (argData.isEmpty()) {
            newData = selfData.copy();
        } else if (selfData.isEmpty()) {
            newData = argData.copy();
        } else {
            final Class<?> widestElementType = selfData.widest(argData).getBoxedElementType();
            newData = ((ContinuousArrayData)selfData.convert(widestElementType)).fastConcat((ContinuousArrayData)argData.convert(widestElementType));
        }
    } else {
        newData = getContinuousArrayDataCCE(self, Object.class).copy();
        newData.fastPush(arg);
    }

    return new NativeArray(newData);
}
 
Example 4
Source File: NativeArray.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final Object arg) {
    //arg is [NativeArray] of same type.
    final ContinuousArrayData selfData = getContinuousArrayDataCCE(self);
    final ContinuousArrayData newData;

    if (arg instanceof NativeArray) {
        final ContinuousArrayData argData = (ContinuousArrayData)((NativeArray)arg).getArray();
        if (argData.isEmpty()) {
            newData = selfData.copy();
        } else if (selfData.isEmpty()) {
            newData = argData.copy();
        } else {
            final Class<?> widestElementType = selfData.widest(argData).getBoxedElementType();
            newData = ((ContinuousArrayData)selfData.convert(widestElementType)).fastConcat((ContinuousArrayData)argData.convert(widestElementType));
        }
    } else {
        newData = getContinuousArrayDataCCE(self, Object.class).copy();
        newData.fastPush(arg);
    }

    return new NativeArray(newData);
}
 
Example 5
Source File: NativeArray.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final Object arg) {
    //arg is [NativeArray] of same type.
    final ContinuousArrayData selfData = getContinuousArrayDataCCE(self);
    final ContinuousArrayData newData;

    if (arg instanceof NativeArray) {
        final ContinuousArrayData argData = (ContinuousArrayData)((NativeArray)arg).getArray();
        if (argData.isEmpty()) {
            newData = selfData.copy();
        } else if (selfData.isEmpty()) {
            newData = argData.copy();
        } else {
            final Class<?> widestElementType = selfData.widest(argData).getBoxedElementType();
            newData = ((ContinuousArrayData)selfData.convert(widestElementType)).fastConcat((ContinuousArrayData)argData.convert(widestElementType));
        }
    } else {
        newData = getContinuousArrayDataCCE(self, Object.class).copy();
        newData.fastPush(arg);
    }

    return new NativeArray(newData);
}
 
Example 6
Source File: NativeArray.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 7
Source File: NativeArray.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final int arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Integer.class).copy(); //get at least an integer data copy of this data
    newData.fastPush(arg); //add an integer to its end
    return new NativeArray(newData);
}
 
Example 8
Source File: NativeArray.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class, convertsNumericArgs = false)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 9
Source File: NativeArray.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class, convertsNumericArgs = false)
public static NativeArray concat(final Object self, final int arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Integer.class).copy(); //get at least an integer data copy of this data
    newData.fastPush(arg); //add an integer to its end
    return new NativeArray(newData);
}
 
Example 10
Source File: NativeArray.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 11
Source File: NativeArray.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 12
Source File: NativeArray.java    From jdk8u_nashorn with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final int arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Integer.class).copy(); //get at least an integer data copy of this data
    newData.fastPush(arg); //add an integer to its end
    return new NativeArray(newData);
}
 
Example 13
Source File: NativeArray.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final int arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Integer.class).copy(); //get at least an integer data copy of this data
    newData.fastPush(arg); //add an integer to its end
    return new NativeArray(newData);
}
 
Example 14
Source File: NativeArray.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final long arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Long.class).copy(); //get at least a long array data copy of this data
    newData.fastPush(arg); //add a long at the end
    return new NativeArray(newData);
}
 
Example 15
Source File: NativeArray.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final int arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Integer.class).copy(); //get at least an integer data copy of this data
    newData.fastPush(arg); //add an integer to its end
    return new NativeArray(newData);
}
 
Example 16
Source File: NativeArray.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 17
Source File: NativeArray.java    From jdk8u_nashorn with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 18
Source File: NativeArray.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final int arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Integer.class).copy(); //get at least an integer data copy of this data
    newData.fastPush(arg); //add an integer to its end
    return new NativeArray(newData);
}
 
Example 19
Source File: NativeArray.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final double arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Double.class).copy(); //get at least a number array data copy of this data
    newData.fastPush(arg); //add a double at the end
    return new NativeArray(newData);
}
 
Example 20
Source File: NativeArray.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * ECMA 15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , ... ] ] ] )
 *
 * @param self self reference
 * @param arg argument
 * @return resulting NativeArray
 */
@SpecializedFunction(linkLogic=ConcatLinkLogic.class)
public static NativeArray concat(final Object self, final long arg) {
    final ContinuousArrayData newData = getContinuousArrayDataCCE(self, Long.class).copy(); //get at least a long array data copy of this data
    newData.fastPush(arg); //add a long at the end
    return new NativeArray(newData);
}