Search in sources :

Example 1 with Type

use of com.github.anba.es6draft.runtime.types.Type in project es6draft by anba.

the class Bootstrap method relCmpSetup.

@SuppressWarnings("unused")
private static MethodHandle relCmpSetup(MutableCallSite callsite, RelationalOperator op, Object arg1, Object arg2, ExecutionContext cx) {
    Type type = getType(arg1, arg2);
    MethodHandle target;
    if (type == Type.String) {
        target = filterReturnValue(relCmpStringMH, op);
    } else if (type == Type.Number) {
        target = filterReturnValue(relCmpNumberMH, op);
    } else {
        target = null;
    }
    return setCallSiteTarget(callsite, target, getTestFor(type), filterReturnValue(MethodHandles.insertArguments(relCmpGenericMH, 2, op), op));
}
Also used : Type(com.github.anba.es6draft.runtime.types.Type) MethodType(java.lang.invoke.MethodType) MethodHandle(java.lang.invoke.MethodHandle)

Example 2 with Type

use of com.github.anba.es6draft.runtime.types.Type in project es6draft by anba.

the class Bootstrap method addSetup.

@SuppressWarnings("unused")
private static MethodHandle addSetup(MutableCallSite callsite, Object arg1, Object arg2, ExecutionContext cx) {
    Type type = getType(arg1, arg2);
    MethodHandle target;
    if (type == Type.String) {
        target = addStringMH;
    } else if (type == Type.Number) {
        target = addNumberMH;
    } else {
        target = null;
    }
    return setCallSiteTarget(callsite, target, getTestFor(type), addGenericMH);
}
Also used : Type(com.github.anba.es6draft.runtime.types.Type) MethodType(java.lang.invoke.MethodType) MethodHandle(java.lang.invoke.MethodHandle)

Example 3 with Type

use of com.github.anba.es6draft.runtime.types.Type in project es6draft by anba.

the class Bootstrap method strictEqCmpSetup.

@SuppressWarnings("unused")
private static MethodHandle strictEqCmpSetup(MutableCallSite callsite, Object arg1, Object arg2) {
    Type type = getType(arg1, arg2);
    MethodHandle target;
    if (type == Type.String) {
        target = strictEqCmpStringMH;
    } else if (type == Type.Number) {
        target = strictEqCmpNumberMH;
    } else if (type == Type.Boolean) {
        target = strictEqCmpBooleanMH;
    } else {
        target = null;
    }
    return setCallSiteTarget(callsite, target, getTestFor(type), strictEqCmpGenericMH);
}
Also used : Type(com.github.anba.es6draft.runtime.types.Type) MethodType(java.lang.invoke.MethodType) MethodHandle(java.lang.invoke.MethodHandle)

Example 4 with Type

use of com.github.anba.es6draft.runtime.types.Type in project es6draft by anba.

the class Bootstrap method eqCmpSetup.

@SuppressWarnings("unused")
private static MethodHandle eqCmpSetup(MutableCallSite callsite, Object arg1, Object arg2, ExecutionContext cx) {
    Type type = getType(arg1, arg2);
    MethodHandle target;
    if (type == Type.String) {
        target = eqCmpStringMH;
    } else if (type == Type.Number) {
        target = eqCmpNumberMH;
    } else if (type == Type.Boolean) {
        target = eqCmpBooleanMH;
    } else {
        target = null;
    }
    return setCallSiteTarget(callsite, target, getTestFor(type), eqCmpGenericMH);
}
Also used : Type(com.github.anba.es6draft.runtime.types.Type) MethodType(java.lang.invoke.MethodType) MethodHandle(java.lang.invoke.MethodHandle)

Aggregations

Type (com.github.anba.es6draft.runtime.types.Type)4 MethodHandle (java.lang.invoke.MethodHandle)4 MethodType (java.lang.invoke.MethodType)4