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