Playing with QV4
QtDeclarative is where the fun is. Starting with Qt5.2 a JavaScript Engine written by Digia is used. Compared to JavaScriptCore and V8 this engine is very basic but tightly integrated with the QML and Quick code. Motivated by attending the Qt Developer Summit and my work on GNU Smalltalk I started to look at the VM.
There are some environment variables that help to see what the JavaScript VM is doing and also how it is doing things. The below table gives a quick overview of the available flags and what they do. Specially the usage of QV4_SHOW_IR and QV4_SHOW_ASM helps to understand what is going on.
Name | Function |
---|---|
QV4_NO_SSA | Do not convert the IR::Function to SSA representation. This disables optimizations as well. |
QV4_NO_OPT | Do not run the optimizer. This disables dead-code-elimination, constant propagation, copy propagation |
QV4_SHOW_IR | Show the Intermediate Representation at the various stages of the compilation/optimization. |
QV4_SHOW_ASM | Show the disassembled code. This requires QtDeclrative to be compiled with CONFIG+=disassembler and without PCH |
QV4_NO_REGALLOC | Do not use the linear register allocator |
QV4_FORCE_INTERPRETER | Do not use the JIT but force the interpreter |
QV4_MM_AGGRESSIVE_GC | Run the GC on every allocation |
QV4_MM_STATS | Print the time it took to mark and sweep |