当前位置: 首页>>代码示例>>Java>>正文


Java Property.canChangeType方法代码示例

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


在下文中一共展示了Property.canChangeType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGuard

import jdk.nashorn.internal.runtime.Property; //导入方法依赖的package包/类
/**
 * Get the guard for a property access. This returns an identity guard for non-configurable global properties
 * and a map guard for everything else.
 *
 * @param sobj the first object in the prototype chain
 * @param property the property
 * @param desc the callsite descriptor
 * @param explicitInstanceOfCheck true if we should do an explicit script object instanceof check instead of just casting
 * @return method handle for guard
 */
public static MethodHandle getGuard(final ScriptObject sobj, final Property property, final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck) {
    if (!needsGuard(property, desc)) {
        return null;
    }
    if (NashornCallSiteDescriptor.isScope(desc)) {
        if (property != null && property.isBound() && !property.canChangeType()) {
            // This is a declared top level variables in main script or eval, use identity guard.
            return getIdentityGuard(sobj);
        }
        if (!(sobj instanceof Global) && (property == null || property.isConfigurable())) {
            // Undeclared variables in nested evals need stronger guards
            return combineGuards(getIdentityGuard(sobj), getMapGuard(sobj.getMap(), explicitInstanceOfCheck));
        }
    }
    return getMapGuard(sobj.getMap(), explicitInstanceOfCheck);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:NashornGuards.java

示例2: getGuard

import jdk.nashorn.internal.runtime.Property; //导入方法依赖的package包/类
/**
 * Get the guard for a property access. This returns an identity guard for non-configurable global properties
 * and a map guard for everything else.
 *
 * @param sobj the first object in the prototype chain
 * @param property the property
 * @param desc the callsite descriptor
 * @param explicitInstanceOfCheck true if we should do an explicit script object instanceof check instead of just casting
 * @return method handle for guard
 */
public static MethodHandle getGuard(final ScriptObject sobj, final Property property, final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck) {
    if (!needsGuard(property, desc)) {
        return null;
    }
    if (NashornCallSiteDescriptor.isScope(desc) && sobj.isScope()) {
        if (property != null && property.isBound() && !property.canChangeType()) {
            // This is a declared top level variables in main script or eval, use identity guard.
            return getIdentityGuard(sobj);
        }
        if (!(sobj instanceof Global) && (property == null || property.isConfigurable())) {
            // Undeclared variables in nested evals need stronger guards
            return combineGuards(getIdentityGuard(sobj), getMapGuard(sobj.getMap(), explicitInstanceOfCheck));
        }
    }
    return getMapGuard(sobj.getMap(), explicitInstanceOfCheck);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:NashornGuards.java

示例3: needsGuard

import jdk.nashorn.internal.runtime.Property; //导入方法依赖的package包/类
/**
 * Determine whether the given callsite needs a guard.
 * @param property the property, or null
 * @param desc the callsite descriptor
 * @return true if a guard should be used for this callsite
 */
static boolean needsGuard(final Property property, final CallSiteDescriptor desc) {
    return property == null || property.isConfigurable()
            || property.isBound() || !ObjectClassGenerator.OBJECT_FIELDS_ONLY
            || !NashornCallSiteDescriptor.isFastScope(desc) || property.canChangeType();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:NashornGuards.java

示例4: needsGuard

import jdk.nashorn.internal.runtime.Property; //导入方法依赖的package包/类
/**
 * Determine whether the given callsite needs a guard.
 * @param property the property, or null
 * @param desc the callsite descriptor
 * @return true if a guard should be used for this callsite
 */
static boolean needsGuard(final Property property, final CallSiteDescriptor desc) {
    return property == null || property.isConfigurable()
            || property.isBound() || property.hasDualFields()
            || !NashornCallSiteDescriptor.isFastScope(desc) || property.canChangeType();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:NashornGuards.java


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