jdk.nashorn.internal.scripts.JO Java Examples

The following examples show how to use jdk.nashorn.internal.scripts.JO. 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: JSONParser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #2
Source File: JSONParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #3
Source File: JSONParser.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #4
Source File: JSONParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #5
Source File: JSONParser.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #6
Source File: JSONParser.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #7
Source File: JSONParser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private Object createObject(final PropertyMap propertyMap, final List<Object> values, final ArrayData arrayData) {
    final long[] primitiveSpill = dualFields ? new long[values.size()] : null;
    final Object[] objectSpill = new Object[values.size()];

    for (final Property property : propertyMap.getProperties()) {
        if (!dualFields || property.getType() == Object.class) {
            objectSpill[property.getSlot()] = values.get(property.getSlot());
        } else {
            primitiveSpill[property.getSlot()] = ObjectClassGenerator.pack((Number) values.get(property.getSlot()));
        }
    }

    final ScriptObject object = dualFields ?
            new JD(propertyMap, primitiveSpill, objectSpill) : new JO(propertyMap, null, objectSpill);
    object.setInitialProto(global.getObjectPrototype());
    object.setArray(arrayData);
    return object;
}
 
Example #8
Source File: Global.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void copyInitialMaps(final ScriptEnvironment env) {
    this.accessorPropertyDescriptorMap = AccessorPropertyDescriptor.getInitialMap().duplicate();
    this.dataPropertyDescriptorMap = DataPropertyDescriptor.getInitialMap().duplicate();
    this.genericPropertyDescriptorMap = GenericPropertyDescriptor.getInitialMap().duplicate();
    this.nativeArgumentsMap = NativeArguments.getInitialMap().duplicate();
    this.nativeArrayMap = NativeArray.getInitialMap().duplicate();
    this.nativeBooleanMap = NativeBoolean.getInitialMap().duplicate();
    this.nativeDateMap = NativeDate.getInitialMap().duplicate();
    this.nativeErrorMap = NativeError.getInitialMap().duplicate();
    this.nativeEvalErrorMap = NativeEvalError.getInitialMap().duplicate();
    this.nativeJSAdapterMap = NativeJSAdapter.getInitialMap().duplicate();
    this.nativeNumberMap = NativeNumber.getInitialMap().duplicate();
    this.nativeRangeErrorMap = NativeRangeError.getInitialMap().duplicate();
    this.nativeReferenceErrorMap = NativeReferenceError.getInitialMap().duplicate();
    this.nativeRegExpMap = NativeRegExp.getInitialMap().duplicate();
    this.nativeRegExpExecResultMap = NativeRegExpExecResult.getInitialMap().duplicate();
    this.nativeStrictArgumentsMap = NativeStrictArguments.getInitialMap().duplicate();
    this.nativeStringMap = NativeString.getInitialMap().duplicate();
    this.nativeSyntaxErrorMap = NativeSyntaxError.getInitialMap().duplicate();
    this.nativeTypeErrorMap = NativeTypeError.getInitialMap().duplicate();
    this.nativeURIErrorMap = NativeURIError.getInitialMap().duplicate();
    this.prototypeObjectMap = PrototypeObject.getInitialMap().duplicate();
    this.objectMap = JO.getInitialMap().duplicate();
    this.functionMap = ScriptFunctionImpl.getInitialMap().duplicate();
    this.anonymousFunctionMap = ScriptFunctionImpl.getInitialAnonymousMap().duplicate();
    this.strictFunctionMap = ScriptFunctionImpl.getInitialStrictMap().duplicate();
    this.boundFunctionMap = ScriptFunctionImpl.getInitialBoundMap().duplicate();

    // java
    if (! env._no_java) {
        this.nativeJavaImporterMap = NativeJavaImporter.getInitialMap().duplicate();
    }

    // typed arrays
    if (! env._no_typed_arrays) {
        this.arrayBufferViewMap = ArrayBufferView.getInitialMap().duplicate();
        this.nativeArrayBufferMap = NativeArrayBuffer.getInitialMap().duplicate();
    }
}
 
Example #9
Source File: Global.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
private void copyInitialMaps(final ScriptEnvironment env) {
    this.accessorPropertyDescriptorMap = AccessorPropertyDescriptor.getInitialMap().duplicate();
    this.dataPropertyDescriptorMap = DataPropertyDescriptor.getInitialMap().duplicate();
    this.genericPropertyDescriptorMap = GenericPropertyDescriptor.getInitialMap().duplicate();
    this.nativeArgumentsMap = NativeArguments.getInitialMap().duplicate();
    this.nativeArrayMap = NativeArray.getInitialMap().duplicate();
    this.nativeBooleanMap = NativeBoolean.getInitialMap().duplicate();
    this.nativeDateMap = NativeDate.getInitialMap().duplicate();
    this.nativeErrorMap = NativeError.getInitialMap().duplicate();
    this.nativeEvalErrorMap = NativeEvalError.getInitialMap().duplicate();
    this.nativeJSAdapterMap = NativeJSAdapter.getInitialMap().duplicate();
    this.nativeNumberMap = NativeNumber.getInitialMap().duplicate();
    this.nativeRangeErrorMap = NativeRangeError.getInitialMap().duplicate();
    this.nativeReferenceErrorMap = NativeReferenceError.getInitialMap().duplicate();
    this.nativeRegExpMap = NativeRegExp.getInitialMap().duplicate();
    this.nativeRegExpExecResultMap = NativeRegExpExecResult.getInitialMap().duplicate();
    this.nativeStrictArgumentsMap = NativeStrictArguments.getInitialMap().duplicate();
    this.nativeStringMap = NativeString.getInitialMap().duplicate();
    this.nativeSyntaxErrorMap = NativeSyntaxError.getInitialMap().duplicate();
    this.nativeTypeErrorMap = NativeTypeError.getInitialMap().duplicate();
    this.nativeURIErrorMap = NativeURIError.getInitialMap().duplicate();
    this.prototypeObjectMap = PrototypeObject.getInitialMap().duplicate();
    this.objectMap = JO.getInitialMap().duplicate();
    this.functionMap = ScriptFunctionImpl.getInitialMap().duplicate();
    this.anonymousFunctionMap = ScriptFunctionImpl.getInitialAnonymousMap().duplicate();
    this.strictFunctionMap = ScriptFunctionImpl.getInitialStrictMap().duplicate();
    this.boundFunctionMap = ScriptFunctionImpl.getInitialBoundMap().duplicate();

    // java
    if (! env._no_java) {
        this.nativeJavaImporterMap = NativeJavaImporter.getInitialMap().duplicate();
    }

    // typed arrays
    if (! env._no_typed_arrays) {
        this.arrayBufferViewMap = ArrayBufferView.getInitialMap().duplicate();
        this.nativeArrayBufferMap = NativeArrayBuffer.getInitialMap().duplicate();
    }
}
 
Example #10
Source File: Global.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void copyInitialMaps(final ScriptEnvironment env) {
    this.accessorPropertyDescriptorMap = AccessorPropertyDescriptor.getInitialMap().duplicate();
    this.dataPropertyDescriptorMap = DataPropertyDescriptor.getInitialMap().duplicate();
    this.genericPropertyDescriptorMap = GenericPropertyDescriptor.getInitialMap().duplicate();
    this.nativeArgumentsMap = NativeArguments.getInitialMap().duplicate();
    this.nativeArrayMap = NativeArray.getInitialMap().duplicate();
    this.nativeBooleanMap = NativeBoolean.getInitialMap().duplicate();
    this.nativeDateMap = NativeDate.getInitialMap().duplicate();
    this.nativeErrorMap = NativeError.getInitialMap().duplicate();
    this.nativeEvalErrorMap = NativeEvalError.getInitialMap().duplicate();
    this.nativeJSAdapterMap = NativeJSAdapter.getInitialMap().duplicate();
    this.nativeNumberMap = NativeNumber.getInitialMap().duplicate();
    this.nativeRangeErrorMap = NativeRangeError.getInitialMap().duplicate();
    this.nativeReferenceErrorMap = NativeReferenceError.getInitialMap().duplicate();
    this.nativeRegExpMap = NativeRegExp.getInitialMap().duplicate();
    this.nativeRegExpExecResultMap = NativeRegExpExecResult.getInitialMap().duplicate();
    this.nativeStrictArgumentsMap = NativeStrictArguments.getInitialMap().duplicate();
    this.nativeStringMap = NativeString.getInitialMap().duplicate();
    this.nativeSyntaxErrorMap = NativeSyntaxError.getInitialMap().duplicate();
    this.nativeTypeErrorMap = NativeTypeError.getInitialMap().duplicate();
    this.nativeURIErrorMap = NativeURIError.getInitialMap().duplicate();
    this.prototypeObjectMap = PrototypeObject.getInitialMap().duplicate();
    this.objectMap = JO.getInitialMap().duplicate();
    this.functionMap = ScriptFunctionImpl.getInitialMap().duplicate();
    this.anonymousFunctionMap = ScriptFunctionImpl.getInitialAnonymousMap().duplicate();
    this.strictFunctionMap = ScriptFunctionImpl.getInitialStrictMap().duplicate();
    this.boundFunctionMap = ScriptFunctionImpl.getInitialBoundMap().duplicate();

    // java
    if (! env._no_java) {
        this.nativeJavaImporterMap = NativeJavaImporter.getInitialMap().duplicate();
    }

    // typed arrays
    if (! env._no_typed_arrays) {
        this.arrayBufferViewMap = ArrayBufferView.getInitialMap().duplicate();
        this.nativeArrayBufferMap = NativeArrayBuffer.getInitialMap().duplicate();
    }
}
 
Example #11
Source File: Global.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ScriptObject newObject() {
    return new JO(getObjectPrototype(), getObjectMap());
}
 
Example #12
Source File: NativeJSAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #13
Source File: SpillObjectCreator.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Class<? extends ScriptObject> getAllocatorClass() {
    return codegen.useDualFields() ? JD.class : JO.class;
}
 
Example #14
Source File: NativeJSAdapter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #15
Source File: Global.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ScriptObject newObject() {
    return new JO(getObjectPrototype(), getObjectMap());
}
 
Example #16
Source File: SpillObjectCreator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Class<? extends ScriptObject> getAllocatorClass() {
    return codegen.useDualFields() ? JD.class : JO.class;
}
 
Example #17
Source File: NativeJSAdapter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee, Global.instance().getObjectMap());
}
 
Example #18
Source File: SpillObjectCreator.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Class<? extends ScriptObject> getAllocatorClass() {
    return codegen.useDualFields() ? JD.class : JO.class;
}
 
Example #19
Source File: NativeJSAdapter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee, Global.instance().getObjectMap());
}
 
Example #20
Source File: NativeJSAdapter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #21
Source File: Global.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ScriptObject newObject() {
    return new JO(getObjectPrototype(), getObjectMap());
}
 
Example #22
Source File: NativeJSAdapter.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee, Global.instance().getObjectMap());
}
 
Example #23
Source File: NativeJSAdapter.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #24
Source File: SpillObjectCreator.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Class<? extends ScriptObject> getAllocatorClass() {
    return codegen.useDualFields() ? JD.class : JO.class;
}
 
Example #25
Source File: NativeJSAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #26
Source File: NativeJSAdapter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #27
Source File: SpillObjectCreator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Class<? extends ScriptObject> getAllocatorClass() {
    return codegen.useDualFields() ? JD.class : JO.class;
}
 
Example #28
Source File: SpillObjectCreator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Class<? extends ScriptObject> getAllocatorClass() {
    return codegen.useDualFields() ? JD.class : JO.class;
}
 
Example #29
Source File: NativeJSAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static ScriptObject wrapAdaptee(final ScriptObject adaptee) {
    return new JO(adaptee);
}
 
Example #30
Source File: PropertyMap.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Public property map allocator. Used by nasgen generated code.
 *
 * <p>It is the caller's responsibility to make sure that {@code properties} does not contain
 * properties with keys that are valid array indices.</p>
 *
 * @param properties Collection of initial properties.
 * @return New {@link PropertyMap}.
 */
public static PropertyMap newMap(final Collection<Property> properties) {
    return properties == null || properties.isEmpty()? newMap() : newMap(properties, JO.class.getName(), 0, 0, 0);
}