• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PropertyMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jdk.nashorn.internal.runtime.PropertyMap的典型用法代码示例。如果您正苦于以下问题:Java PropertyMap类的具体用法?Java PropertyMap怎么用?Java PropertyMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyMap类属于jdk.nashorn.internal.runtime包,在下文中一共展示了PropertyMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: dumpCounters

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
/**
 * Dump all Nashorn debug mode counters. Calling this may be better if
 * you want to print all counters. This way you can avoid too many callsites
 * due to counter access itself!!
 * @param self self reference
 * @return undefined
 */
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static Object dumpCounters(final Object self) {
    final PrintWriter out = Context.getCurrentErr();

    out.println("ScriptObject count " + ScriptObject.getCount());
    out.println("Scope count " + ScriptObject.getScopeCount());
    out.println("ScriptObject listeners added " + PropertyListeners.getListenersAdded());
    out.println("ScriptObject listeners removed " + PropertyListeners.getListenersRemoved());
    out.println("ScriptFunction constructor calls " + ScriptFunction.getConstructorCount());
    out.println("ScriptFunction invokes " + ScriptFunction.getInvokes());
    out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
    out.println("PropertyMap count " + PropertyMap.getCount());
    out.println("PropertyMap cloned " + PropertyMap.getClonedCount());
    out.println("PropertyMap history hit " + PropertyMap.getHistoryHit());
    out.println("PropertyMap proto invalidations " + PropertyMap.getProtoInvalidations());
    out.println("PropertyMap proto history hit " + PropertyMap.getProtoHistoryHit());
    out.println("PropertyMap setProtoNewMapCount " + PropertyMap.getSetProtoNewMapCount());
    out.println("Callsite count " + LinkerCallSite.getCount());
    out.println("Callsite misses " + LinkerCallSite.getMissCount());
    out.println("Callsite misses by site at " + LinkerCallSite.getMissSamplingPercentage() + "%");

    LinkerCallSite.getMissCounts(out);

    return UNDEFINED;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:NativeDebug.java


示例2: NativeStrictArguments

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
NativeStrictArguments(final Object[] values, final int numParams,final ScriptObject proto, final PropertyMap map) {
    super(proto, map);
    setIsArguments();

    final ScriptFunction func = Global.instance().getTypeErrorThrower();
    // We have to fill user accessor functions late as these are stored
    // in this object rather than in the PropertyMap of this object.
    final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
    initUserAccessors("caller", flags, func, func);
    initUserAccessors("callee", flags, func, func);

    setArray(ArrayData.allocate(values));
    this.length = values.length;

    // extend/truncate named arg array as needed and copy values
    this.namedArgs = new Object[numParams];
    if (numParams > values.length) {
        Arrays.fill(namedArgs, UNDEFINED);
    }
    System.arraycopy(values, 0, namedArgs, 0, Math.min(namedArgs.length, values.length));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:NativeStrictArguments.java


示例3: makeFieldMap

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
/**
 * Constructs a property map based on a set of fields.
 *
 * @param hasArguments  does the created object have an "arguments" property
 * @param fieldCount    Number of fields in use.
 * @param fieldMaximum  Number of fields available.
 * @param evalCode      is this property map created for 'eval' code?
 * @return New map populated with accessor properties.
 */
PropertyMap makeFieldMap(final boolean hasArguments, final int fieldCount, final int fieldMaximum, final boolean evalCode) {
    final List<Property> properties = new ArrayList<>();
    assert tuples != null;

    for (final MapTuple<T> tuple : tuples) {
        final String   key         = tuple.key;
        final Symbol   symbol      = tuple.symbol;
        final Class<?> initialType = tuple.getValueType();

        if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
            final int      flags    = getPropertyFlags(symbol, hasArguments, evalCode);
            final Property property = new AccessorProperty(
                    key,
                    flags,
                    structure,
                    symbol.getFieldIndex(),
                    initialType);
            properties.add(property);
        }
    }

    return PropertyMap.newMap(properties, structure.getName(), fieldCount, fieldMaximum, 0);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:MapCreator.java


示例4: makeSpillMap

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
PropertyMap makeSpillMap(final boolean hasArguments) {
    final List<Property> properties = new ArrayList<>();
    int spillIndex = 0;
    assert tuples != null;

    for (final MapTuple<T> tuple : tuples) {
        final String key    = tuple.key;
        final Symbol symbol = tuple.symbol;

        //TODO initial type is object here no matter what. Is that right?
        if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
            final int flags = getPropertyFlags(symbol, hasArguments, false);
            properties.add(
                    new SpillProperty(
                            key,
                            flags,
                            spillIndex++));
        }
    }

    return PropertyMap.newMap(properties, structure.getName(), 0, 0, spillIndex);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:MapCreator.java


示例5: loadConstant

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private void loadConstant(final Object object, final CompileUnit compileUnit, final MethodEmitter methodEmitter) {
    final String       unitClassName = compileUnit.getUnitClassName();
    final ClassEmitter classEmitter  = compileUnit.getClassEmitter();
    final int          index         = compiler.getConstantData().add(object);
    final Class<?>     cls           = object.getClass();

    if (cls == PropertyMap.class) {
        methodEmitter.load(index);
        methodEmitter.invokestatic(unitClassName, GET_MAP.symbolName(), methodDescriptor(PropertyMap.class, int.class));
        classEmitter.needGetConstantMethod(PropertyMap.class);
    } else if (cls.isArray()) {
        methodEmitter.load(index);
        final String methodName = ClassEmitter.getArrayMethodName(cls);
        methodEmitter.invokestatic(unitClassName, methodName, methodDescriptor(cls, int.class));
        classEmitter.needGetConstantMethod(cls);
    } else {
        methodEmitter.loadConstants().load(index).arrayload();
        if (object instanceof ArrayData) {
            // avoid cast to non-public ArrayData subclass
            methodEmitter.checkcast(ArrayData.class);
            methodEmitter.invoke(virtualCallNoLookup(ArrayData.class, "copy", ArrayData.class));
        } else if (cls != Object.class) {
            methodEmitter.checkcast(cls);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:CodeGenerator.java


示例6: addObjectProperty

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private PropertyMap addObjectProperty(final PropertyMap propertyMap, final List<Object> values,
                                             final String id, final Object value) {
    final Property oldProperty = propertyMap.findProperty(id);
    final PropertyMap newMap;
    final Class<?> type;
    final int flags;
    if (dualFields) {
        type = getType(value);
        flags = Property.DUAL_FIELDS;
    } else {
        type = Object.class;
        flags = 0;
    }

    if (oldProperty != null) {
        values.set(oldProperty.getSlot(), value);
        newMap = propertyMap.replaceProperty(oldProperty, new SpillProperty(id, flags, oldProperty.getSlot(), type));;
    } else {
        values.add(value);
        newMap = propertyMap.addProperty(new SpillProperty(id, flags, propertyMap.size(), type));
    }

    return newMap;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:JSONParser.java


示例7: createObject

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:JSONParser.java


示例8: dumpCounters

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
/**
 * Dump all Nashorn debug mode counters. Calling this may be better if
 * you want to print all counters. This way you can avoid too many callsites
 * due to counter access itself!!
 * @param self self reference
 * @return undefined
 */
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static Object dumpCounters(final Object self) {
    final PrintWriter out = Context.getCurrentErr();

    out.println("ScriptObject count " + ScriptObject.getCount());
    out.println("Scope count " + Scope.getScopeCount());
    out.println("ScriptObject listeners added " + PropertyListeners.getListenersAdded());
    out.println("ScriptObject listeners removed " + PropertyListeners.getListenersRemoved());
    out.println("ScriptFunction constructor calls " + ScriptFunction.getConstructorCount());
    out.println("ScriptFunction invokes " + ScriptFunction.getInvokes());
    out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
    out.println("PropertyMap count " + PropertyMap.getCount());
    out.println("PropertyMap cloned " + PropertyMap.getClonedCount());
    out.println("PropertyMap history hit " + PropertyMap.getHistoryHit());
    out.println("PropertyMap proto invalidations " + PropertyMap.getProtoInvalidations());
    out.println("PropertyMap proto history hit " + PropertyMap.getProtoHistoryHit());
    out.println("PropertyMap setProtoNewMapCount " + PropertyMap.getSetProtoNewMapCount());
    out.println("Callsite count " + LinkerCallSite.getCount());
    out.println("Callsite misses " + LinkerCallSite.getMissCount());
    out.println("Callsite misses by site at " + LinkerCallSite.getMissSamplingPercentage() + "%");

    LinkerCallSite.getMissCounts(out);

    return UNDEFINED;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:NativeDebug.java


示例9: makeFieldMap

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
/**
 * Constructs a property map based on a set of fields.
 *
 * @param hasArguments  does the created object have an "arguments" property
 * @param fieldCount    Number of fields in use.
 * @param fieldMaximum  Number of fields available.
 * @param evalCode      is this property map created for 'eval' code?
 * @return New map populated with accessor properties.
 */
PropertyMap makeFieldMap(final boolean hasArguments, final boolean dualFields, final int fieldCount, final int fieldMaximum, final boolean evalCode) {
    final List<Property> properties = new ArrayList<>();
    assert tuples != null;

    for (final MapTuple<T> tuple : tuples) {
        final String   key         = tuple.key;
        final Symbol   symbol      = tuple.symbol;
        final Class<?> initialType = dualFields ? tuple.getValueType() : Object.class;

        if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
            final int      flags    = getPropertyFlags(symbol, hasArguments, evalCode, dualFields);
            final Property property = new AccessorProperty(
                    key,
                    flags,
                    structure,
                    symbol.getFieldIndex(),
                    initialType);
            properties.add(property);
        }
    }

    return PropertyMap.newMap(properties, structure.getName(), fieldCount, fieldMaximum, 0);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:MapCreator.java


示例10: makeSpillMap

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
PropertyMap makeSpillMap(final boolean hasArguments, final boolean dualFields) {
    final List<Property> properties = new ArrayList<>();
    int spillIndex = 0;
    assert tuples != null;

    for (final MapTuple<T> tuple : tuples) {
        final String key    = tuple.key;
        final Symbol symbol = tuple.symbol;
        final Class<?> initialType = dualFields ? tuple.getValueType() : Object.class;

        if (symbol != null && !isValidArrayIndex(getArrayIndex(key))) {
            final int flags = getPropertyFlags(symbol, hasArguments, false, dualFields);
            properties.add(
                    new SpillProperty(
                            key,
                            flags,
                            spillIndex++,
                            initialType));
        }
    }

    return PropertyMap.newMap(properties, structure.getName(), 0, 0, spillIndex);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:MapCreator.java


示例11: loadConstant

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private void loadConstant(final Object object, final CompileUnit compileUnit, final MethodEmitter methodEmitter) {
    final String       unitClassName = compileUnit.getUnitClassName();
    final ClassEmitter classEmitter  = compileUnit.getClassEmitter();
    final int          index         = compiler.getConstantData().add(object);
    final Class<?>     cls           = object.getClass();

    if (cls == PropertyMap.class) {
        methodEmitter.load(index);
        methodEmitter.invokestatic(unitClassName, GET_MAP.symbolName(), methodDescriptor(PropertyMap.class, int.class));
        classEmitter.needGetConstantMethod(PropertyMap.class);
    } else if (cls.isArray()) {
        methodEmitter.load(index);
        final String methodName = ClassEmitter.getArrayMethodName(cls);
        methodEmitter.invokestatic(unitClassName, methodName, methodDescriptor(cls, int.class));
        classEmitter.needGetConstantMethod(cls);
    } else {
        methodEmitter.loadConstants().load(index).arrayload();
        if (object instanceof ArrayData) {
            methodEmitter.checkcast(ArrayData.class);
            methodEmitter.invoke(virtualCallNoLookup(ArrayData.class, "copy", ArrayData.class));
        } else if (cls != Object.class) {
            methodEmitter.checkcast(cls);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:CodeGenerator.java


示例12: NativeJSAdapter

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
NativeJSAdapter(final Object overrides, final ScriptObject adaptee, final ScriptObject proto, final PropertyMap map) {
    super(proto, map);
    this.adaptee = wrapAdaptee(adaptee);
    if (overrides instanceof ScriptObject) {
        this.overrides = true;
        final ScriptObject sobj = (ScriptObject)overrides;
        this.addBoundProperties(sobj);
    } else {
        this.overrides = false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:NativeJSAdapter.java


示例13: NativeArguments

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
NativeArguments(final Object[] arguments, final Object callee, final int numParams, final ScriptObject proto, final PropertyMap map) {
    super(proto, map);
    setIsArguments();
    setArray(ArrayData.allocate(arguments));
    this.length = arguments.length;
    this.callee = callee;
    this.numMapped = Math.min(numParams, arguments.length);
    this.numParams = numParams;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:NativeArguments.java


示例14: checkAndGetMap

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private static PropertyMap checkAndGetMap(final Context context) {
    // security check first
    final SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new RuntimePermission(Context.NASHORN_CREATE_GLOBAL));
    }

    // null check on context
    context.getClass();

    return $nasgenmap$;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:Global.java


示例15: createStrictModeMap

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private static PropertyMap createStrictModeMap(final PropertyMap map) {
    final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
    PropertyMap newMap = map;
    // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
    newMap = newMap.addPropertyNoHistory(map.newUserAccessors("arguments", flags));
    newMap = newMap.addPropertyNoHistory(map.newUserAccessors("caller", flags));
    return newMap;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ScriptFunctionImpl.java


示例16: NativeDate

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private NativeDate(final double time, final ScriptObject proto, final PropertyMap map) {
    super(proto, map);
    final ScriptEnvironment env = Global.getEnv();

    this.time = time;
    this.timezone = env._timezone;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:NativeDate.java


示例17: NativeReferenceError

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
private NativeReferenceError(final Object msg, final ScriptObject proto, final PropertyMap map) {
    super(proto, map);
    if (msg != UNDEFINED) {
        this.instMessage = JSType.toString(msg);
    } else {
        this.delete(NativeError.MESSAGE, false);
    }
    NativeError.initException(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:NativeReferenceError.java


示例18: NativeEvalError

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
private NativeEvalError(final Object msg, final ScriptObject proto, final PropertyMap map) {
    super(proto, map);
    if (msg != UNDEFINED) {
        this.instMessage = JSType.toString(msg);
    } else {
        this.delete(NativeError.MESSAGE, false);
    }
    NativeError.initException(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:NativeEvalError.java


示例19: newInitWithSpillArraysMethod

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
private static MethodEmitter newInitWithSpillArraysMethod(final ClassEmitter classEmitter, final Class<?> superClass) {
    final MethodEmitter init = classEmitter.init(PropertyMap.class, long[].class, Object[].class);
    init.begin();
    init.load(Type.OBJECT, JAVA_THIS.slot());
    init.load(Type.OBJECT, INIT_MAP.slot());
    init.load(Type.LONG_ARRAY, 2);
    init.load(Type.OBJECT_ARRAY, 3);
    init.invoke(constructorNoLookup(superClass, PropertyMap.class, long[].class, Object[].class));

    return init;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ObjectClassGenerator.java


示例20: newInitScopeMethod

import jdk.nashorn.internal.runtime.PropertyMap; //导入依赖的package包/类
/**
 * Allocate and initialize a new <init> method for scopes.
 * @param classEmitter  Open class emitter.
 * @return Open method emitter.
 */
private static MethodEmitter newInitScopeMethod(final ClassEmitter classEmitter) {
    final MethodEmitter init = classEmitter.init(PropertyMap.class, ScriptObject.class);
    init.begin();
    init.load(Type.OBJECT, JAVA_THIS.slot());
    init.load(Type.OBJECT, INIT_MAP.slot());
    init.load(Type.OBJECT, INIT_SCOPE.slot());
    init.invoke(constructorNoLookup(FunctionScope.class, PropertyMap.class, ScriptObject.class));

    return init;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:ObjectClassGenerator.java



注:本文中的jdk.nashorn.internal.runtime.PropertyMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OFTableFeaturePropApplyActions类代码示例发布时间:2022-05-22
下一篇:
Java RefreshServiceAclResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap