use of com.github.anba.es6draft.compiler.assembler.InstructionAssembler in project es6draft by anba.
the class RuntimeInfoGenerator method runtimeInfo.
void runtimeInfo(FunctionNode node, MethodCode method, FunctionCode call, FunctionCode construct, String source, Function<MethodName, MethodName> debugInfo) {
InstructionAssembler asm = new InstructionAssembler(method);
asm.begin();
asm.invokedynamic("methodInfo", Type.methodType(Types.Object), RUNTIME_INFO_BOOTSTRAP);
asm.aconst(node.getFunctionName());
asm.iconst(functionFlags(node, call.tailCall, construct != null && construct.tailCall));
asm.iconst(ExpectedArgumentCount(node.getParameters()));
if (hasMappedOrLegacyArguments(node)) {
// TODO: Make this a compact string (to save bytecode and memory size)?
newStringArray(asm, mappedNames(node.getParameters()));
} else {
asm.anull();
}
asm.aconst(source);
if (node.isAsync() || node.isGenerator()) {
asm.handle(call.body);
} else {
asm.anull();
}
asm.handle(call.entry);
if (construct != null) {
asm.handle(construct.entry);
} else {
asm.anull();
}
if (debugInfo != null) {
asm.handle(debugInfo.apply(method.name()));
asm.invoke(Methods.RTI_newFunctionDebug);
} else {
asm.invoke(Methods.RTI_newFunction);
}
asm._return();
asm.end();
}
use of com.github.anba.es6draft.compiler.assembler.InstructionAssembler in project es6draft by anba.
the class RuntimeInfoGenerator method runtimeInfo.
static void runtimeInfo(Module node, MethodCode method, MethodName moduleInit, MethodName moduleBody, Function<MethodName, MethodName> debugInfo) {
InstructionAssembler asm = new InstructionAssembler(method);
asm.begin();
asm.handle(moduleInit);
asm.handle(moduleBody);
if (debugInfo != null) {
asm.handle(debugInfo.apply(method.name()));
asm.invoke(Methods.RTI_newModuleBodyDebug);
} else {
asm.invoke(Methods.RTI_newModuleBody);
}
asm._return();
asm.end();
}
use of com.github.anba.es6draft.compiler.assembler.InstructionAssembler in project es6draft by anba.
the class RuntimeInfoGenerator method runtimeInfo.
static void runtimeInfo(Script node, MethodCode method, MethodName scriptCode, Function<MethodName, MethodName> debugInfo) {
InstructionAssembler asm = new InstructionAssembler(method);
asm.begin();
asm.handle(scriptCode);
if (debugInfo != null) {
asm.handle(debugInfo.apply(method.name()));
asm.invoke(Methods.RTI_newScriptBodyDebug);
} else {
asm.invoke(Methods.RTI_newScriptBody);
}
asm._return();
asm.end();
}
Aggregations