Search in sources :

Example 11 with MethodTypeDescriptor

use of com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor in project es6draft by anba.

the class ExpressionGenerator method invokeDynamicNativeCall.

private static ValType invokeDynamicNativeCall(String name, Type[] arguments, CodeVisitor mv) {
    // stack: [cx, ...args] -> [result]
    MethodTypeDescriptor desc = Type.methodType(Types.Object, arguments);
    mv.invokedynamic(NativeCalls.getNativeCallName(name), desc, NativeCalls.getNativeCallBootstrap());
    return ValType.of(desc.returnType());
}
Also used : MethodTypeDescriptor(com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor)

Example 12 with MethodTypeDescriptor

use of com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor in project es6draft by anba.

the class ExpressionGenerator method doExpression.

private OutlinedCall doExpression(DoExpression node, CodeVisitor mv) {
    if (!codegen.isEnabled(Compiler.Option.NoCompletion)) {
        CompletionValueVisitor.performCompletion(node);
    }
    MethodTypeDescriptor methodDescriptor = DoExpressionCodeVisitor.methodDescriptor(mv);
    MethodCode method = codegen.method(mv, "doexpr", methodDescriptor);
    return outlined(new DoExpressionCodeVisitor(node, method, mv), body -> {
        return statement(node.getStatement(), body);
    });
}
Also used : MethodCode(com.github.anba.es6draft.compiler.assembler.Code.MethodCode) MethodTypeDescriptor(com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor)

Example 13 with MethodTypeDescriptor

use of com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor in project es6draft by anba.

the class ExpressionGenerator method spreadElement.

private OutlinedCall spreadElement(SpreadElementMethod node, CodeVisitor mv) {
    MethodTypeDescriptor methodDescriptor = SpreadElementCodeVisitor.methodDescriptor(mv);
    MethodCode method = codegen.method(mv, "spread", methodDescriptor);
    return outlined(new SpreadElementCodeVisitor(node, method, mv), body -> {
        Variable<ArrayObject> array = body.getArrayParameter();
        Variable<Integer> index = body.getIndexParameter();
        MutableValue<Integer> nextIndex = body.iarrayElement(body.getNextIndexParameter(), 0);
        spreadArray(node.getElements(), array, index, body);
        body.store(nextIndex, index);
        return Completion.Normal;
    });
}
Also used : ArrayObject(com.github.anba.es6draft.runtime.types.builtins.ArrayObject) BigInteger(java.math.BigInteger) MethodCode(com.github.anba.es6draft.compiler.assembler.Code.MethodCode) MethodTypeDescriptor(com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor)

Aggregations

MethodTypeDescriptor (com.github.anba.es6draft.compiler.assembler.MethodTypeDescriptor)13 MethodCode (com.github.anba.es6draft.compiler.assembler.Code.MethodCode)12 SwitchClause (com.github.anba.es6draft.ast.SwitchClause)3 Jump (com.github.anba.es6draft.compiler.assembler.Jump)3 OrdinaryObject (com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject)3 Completion (com.github.anba.es6draft.compiler.StatementGenerator.Completion)2 MethodName (com.github.anba.es6draft.compiler.assembler.MethodName)2 ArrayObject (com.github.anba.es6draft.runtime.types.builtins.ArrayObject)2 ValType (com.github.anba.es6draft.compiler.DefaultCodeGenerator.ValType)1 ExecutionContext (com.github.anba.es6draft.runtime.ExecutionContext)1 InstanceMethod (com.github.anba.es6draft.runtime.language.ClassOperations.InstanceMethod)1 OrdinaryConstructorFunction (com.github.anba.es6draft.runtime.types.builtins.OrdinaryConstructorFunction)1 BigInteger (java.math.BigInteger)1