Search in sources :

Example 1 with BuiltinFunction

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

the class Bootstrap method callSetup.

private static MethodHandle callSetup(MutableCallSite callsite, Object function, ExecutionContext cx, Object thisValue, Object[] arguments) {
    MethodHandle target, test;
    if (function instanceof FunctionObject) {
        FunctionObject fn = (FunctionObject) function;
        test = MethodHandles.insertArguments(testFunctionObjectMH, 1, fn.getMethodInfo());
        target = fn.getCallMethod();
    } else if (function instanceof BuiltinFunction) {
        BuiltinFunction fn = (BuiltinFunction) function;
        test = MethodHandles.insertArguments(testBuiltinFunctionMH, 1, fn.getMethodInfo());
        target = fn.getCallMethod();
    } else {
        target = test = null;
    }
    return setCallSiteTarget(callsite, target, test, callGenericMH);
}
Also used : BuiltinFunction(com.github.anba.es6draft.runtime.types.builtins.BuiltinFunction) FunctionObject(com.github.anba.es6draft.runtime.types.builtins.FunctionObject) MethodHandle(java.lang.invoke.MethodHandle)

Example 2 with BuiltinFunction

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

the class Properties method createFunction.

private static void createFunction(Realm realm, OrdinaryObject target, FunctionLayout layout) {
    BuiltinFunction fun;
    if (layout.isTailCall()) {
        fun = new NativeTailCallFunction(realm, layout.name, layout.arity, layout.methodHandle);
    } else {
        fun = new NativeFunction(realm, layout.name, layout.arity, layout.nativeId, layout.methodHandle);
    }
    defineProperty(target, layout, valueProperty(layout, fun));
}
Also used : BuiltinFunction(com.github.anba.es6draft.runtime.types.builtins.BuiltinFunction) NativeFunction(com.github.anba.es6draft.runtime.types.builtins.NativeFunction) NativeTailCallFunction(com.github.anba.es6draft.runtime.types.builtins.NativeTailCallFunction)

Aggregations

BuiltinFunction (com.github.anba.es6draft.runtime.types.builtins.BuiltinFunction)2 FunctionObject (com.github.anba.es6draft.runtime.types.builtins.FunctionObject)1 NativeFunction (com.github.anba.es6draft.runtime.types.builtins.NativeFunction)1 NativeTailCallFunction (com.github.anba.es6draft.runtime.types.builtins.NativeTailCallFunction)1 MethodHandle (java.lang.invoke.MethodHandle)1