微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

jdk.nashorn.internal.runtime.linker.NashornGuards的实例源码

项目:OLD-OpenJDK8    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,final LinkRequest request) {
    final String       name      = desc.getNametoken(2);
    final FindProperty find      = findProperty(NO_SUCH_METHOD_NAME,true);
    final boolean      scopeCall = isScope() && NashornCallSiteDescriptor.isScope(desc);

    if (find == null) {
        return noSuchProperty(desc,request);
    }

    final Object value = getobjectValue(find);
    if (! (value instanceof ScriptFunction)) {
        return createEmptyGetter(desc,name);
    }

    final ScriptFunction func = (ScriptFunction)value;
    final Object thiz = scopeCall && func.isstrict() ? ScriptRuntime.UNDEFINED : this;
    // Todo: It'd be awesome if we Could bind "name" without binding "this".
    return new GuardedInvocation(MH.dropArguments(MH.constant(ScriptFunction.class,func.makeBoundFunction(thiz,new Object[] { name })),Object.class),null,NashornGuards.getMapGuard(getMap()));
}
项目:nashorn-backport    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,NashornGuards.getMapGuard(getMap()));
}
项目:nashorn    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,NashornGuards.getMapGuard(getMap()));
}
项目:Openjsharp    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,final LinkRequest request) {
    final Object self = request.getReceiver();
    final Class<?> returnType = desc.getmethodType().returnType();

    if (returnType == Object.class && (self instanceof String || self instanceof Consstring)) {
        try {
            return new GuardedInvocation(MH.findStatic(MethodHandles.lookup(),NativeString.class,"get",desc.getmethodType()),NashornGuards.getInstanceOf2Guard(String.class,Consstring.class));
        } catch (final LookupException e) {
            //empty. Shouldn't happen. Fall back to super
        }
    }
    return super.findGetIndexMethod(desc,request);
}
项目:Openjsharp    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,request);
    }

    final boolean explicitInstanceOfCheck = explicitInstanceOfCheck(desc,request);

    final Object value = find.getobjectValue();
    if (!(value instanceof ScriptFunction)) {
        return createEmptyGetter(desc,explicitInstanceOfCheck,name);
    }

    final ScriptFunction func = (ScriptFunction)value;
    final Object         thiz = scopeCall && func.isstrict() ? UNDEFINED : this;
    // Todo: It'd be awesome if we Could bind "name" without binding "this".
    // Since we're binding this we must use an identity guard here.
    return new GuardedInvocation(
            MH.dropArguments(
                    MH.constant(
                            ScriptFunction.class,NashornGuards.combineGuards(
                    NashornGuards.getIdentityguard(this),NashornGuards.getMapGuard(getMap(),true)));
}
项目:Openjsharp    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,final boolean explicitInstanceOfCheck,final String name) {
    if (NashornCallSiteDescriptor.isOptimistic(desc)) {
        throw new UnwarrantedOptimismException(UNDEFINED,NashornCallSiteDescriptor.getProgramPoint(desc),Type.OBJECT);
    }

    return new GuardedInvocation(Lookup.emptyGetter(desc.getmethodType().returnType()),explicitInstanceOfCheck),getProtoSwitchPoint(name,null),explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:Openjsharp    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,final String name,final ScriptObject owner) {
    final GuardedInvocation newLink             = fixReceiverType(link,WITHScopEFILTER);
    final MethodHandle      expressionGuard     = expressionGuard(name,owner);
    final MethodHandle      filterGuardReceiver = filterGuardReceiver(newLink,WITHScopEFILTER);
    return link.replaceMethods(
            filterReceiver(
                    newLink.getInvocation(),WITHScopEFILTER),NashornGuards.combineGuards(
                    expressionGuard,filterGuardReceiver));
}
项目:Openjsharp    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,or neither does. The reason for that is that Now
    // getGuard returns a map guard that casts its argument to ScriptObject,and if that fails,we need to
    // relink on ClassCastException.
    final boolean explicitInstanceOfCheck = NashornGuards.explicitInstanceOfCheck(desc,request);
    return new GuardedInvocation(methodHandle,NashornGuards.getGuard(sobj,property,desc,(SwitchPoint)null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:openjdk-jdk10    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,final LinkRequest request) {
    final Object self = request.getReceiver();
    final Class<?> returnType = desc.getmethodType().returnType();

    if (returnType == Object.class && JSType.isstring(self)) {
        try {
            return new GuardedInvocation(MH.findStatic(MethodHandles.lookup(),NashornGuards.getStringGuard());
        } catch (final LookupException e) {
            //empty. Shouldn't happen. Fall back to super
        }
    }
    return super.findGetIndexMethod(desc,request);
}
项目:openjdk-jdk10    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,final LinkRequest request) {
    final String       name      = NashornCallSiteDescriptor.getoperand(desc);
    final FindProperty find      = findProperty(NO_SUCH_METHOD_NAME,request)
                // Add proto switchpoint to switch from no-such-property to no-such-method if it is ever defined.
                .addSwitchPoint(getProtoSwitchPoint(NO_SUCH_METHOD_NAME));
    }

    final boolean explicitInstanceOfCheck = explicitInstanceOfCheck(desc,func.createBound(thiz,true)))
            // Add a protoype switchpoint for the original name so this gets invalidated if it is ever defined.
            .addSwitchPoint(getProtoSwitchPoint(name));
}
项目:openjdk-jdk10    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,getProtoSwitchPoints(name,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:openjdk-jdk10    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,owner);
    final MethodHandle      filteredGuard       = filterGuardReceiver(newLink,filteredGuard));
}
项目:openjdk-jdk10    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:openjdk9    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,request);
}
项目:openjdk9    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,true)));
}
项目:openjdk9    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:openjdk9    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,filterGuardReceiver));
}
项目:openjdk9    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:kaziranga    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,request);
}
项目:kaziranga    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,true)));
}
项目:kaziranga    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:kaziranga    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,filterGuardReceiver));
}
项目:kaziranga    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:lookaside_java-1.8.0-openjdk    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,request);
}
项目:lookaside_java-1.8.0-openjdk    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,true)));
}
项目:lookaside_java-1.8.0-openjdk    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:lookaside_java-1.8.0-openjdk    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,filterGuardReceiver));
}
项目:lookaside_java-1.8.0-openjdk    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:jdk8u_nashorn    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,request);
}
项目:jdk8u_nashorn    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,true)));
}
项目:jdk8u_nashorn    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:jdk8u_nashorn    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,filterGuardReceiver));
}
项目:jdk8u_nashorn    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:infobip-open-jdk-8    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,request);
}
项目:infobip-open-jdk-8    文件ScriptObject.java   
/**
 * Fall back if a function property is not found.
 * @param desc The call site descriptor
 * @param request the link request
 * @return GuardedInvocation to be invoked at call site.
 */
public GuardedInvocation noSuchMethod(final CallSiteDescriptor desc,true)));
}
项目:infobip-open-jdk-8    文件ScriptObject.java   
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:infobip-open-jdk-8    文件WithObject.java   
private GuardedInvocation fixScopeCallSite(final GuardedInvocation link,filterGuardReceiver));
}
项目:infobip-open-jdk-8    文件SetMethodCreator.java   
/**
 * Composes from its components an actual guarded invocation that represents the dynamic setter method for the property.
 * @return the composed guarded invocation that represents the dynamic setter method for the property.
 */
GuardedInvocation createGuardedInvocation() {
    // getGuard() and getException() either both return null,explicitInstanceOfCheck ? null : ClassCastException.class);
}
项目:OLD-OpenJDK8    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,final LinkRequest request) {
    final Object self = request.getReceiver();
    final Class<?> returnType = desc.getmethodType().returnType();

    if (returnType == Object.class && (self instanceof String || self instanceof Consstring)) {
        try {
            MethodHandle mh = MH.findStatic(MethodHandles.lookup(),desc.getmethodType());
            return new GuardedInvocation(mh,Consstring.class));
        } catch (final LookupException e) {
            // Shouldn't happen. Fall back to super
        }
    }
    return super.findGetIndexMethod(desc,request);
}
项目:nashorn-backport    文件NativeString.java   
@Override
protected GuardedInvocation findGetIndexMethod(final CallSiteDescriptor desc,request);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。