summaryrefslogtreecommitdiff
path: root/src/qml/compiler/qv4isel_moth.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Optimize some unops and binops for mothLars Knoll2013-10-301-0/+62
| | | | | | | | Optimize unops for ints/bools and add some special binops where one side is constant. Change-Id: I4f5639e36458560e5614371733abaafd94909ab1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Moth: Inline a couple of binopsLars Knoll2013-10-301-0/+57
| | | | | | | This gives another 10-15% for v8-bench Change-Id: Iaea90402179813af23008c35d344fa7f5353cf5f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Speed up id object lookupsSimon Hausmann2013-10-291-0/+8
| | | | | | | | | | | | | | | | | We can resolve lookups for objects referenced by id at QML compile time and use a run-time helper to extract the id object out of the QML context data by index instead of name. Dependencies to id objects are also tracked at compile time and registered separately before entering the generated function code. The lookup of id objects is encoded in the IR as special member lookups. Members will also then in the future be used to for property lookups in context and scope properties, as well as any other property lookups in QObjects where we can determine the meta-object. Change-Id: I36cf3ceb11b51a983da6cad5b61c3bf574acc20a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Inline unary operations in mothLars Knoll2013-10-291-17/+46
| | | | | Change-Id: I6e141a425c2b4cc0cd64c7f0011e7028b9147f69 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework parameter handling for mothLars Knoll2013-10-291-1/+0
| | | | | | | | | | Get rid of the parameter type, and only store a scope, that is an index into a SafeValue ** array. This significantly speeds up loading and saving of parameters. Change-Id: I185145f1afd0b8cea461c7ca732ada3ebe39c34c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the LoadValue instructionLars Knoll2013-10-291-12/+12
| | | | | | | | | With the constant table this is exactly the same as a move. Also renamed MoveTemp to Move, as it not only moves Temps but also other variables. Change-Id: I1fccc04314661954179d903519adbc39777395e5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move constants into the compiled data for the interpreterLars Knoll2013-10-291-3/+6
| | | | | | | | | This makes it possible to remove the Value stored as part of the instruction stream. Reduces the size of the instruction stream and will allow to optimize Param lookup. Change-Id: I23dab5dbed76bf8d62df7042934064d4676bc43d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement new exception handling for mothLars Knoll2013-10-291-4/+33
| | | | | | | | | Add the required instructions and check for exceptions in the engine before storing any results. Change-Id: Ibfaf904d659859e8012920270825211ba202c63d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework IR code generation for try/catch/finallyLars Knoll2013-10-291-0/+5
| | | | | | | | | | | | | | | | | | Simplify the generated code. Add a special block to catch exceptions thrown inside a catch() statement. store the exception on the stack when entering finally and rethrow it at the end. This ensure correct behavior for break/continue/return statements inside finally. Don't check for exceptions after calling push_catch_scope and pop_scope in the JIT'ed code. This can lead to infinite loops when throwing inside an exception handler. Change-Id: I67e9325794e2fd25b0773b21e02fbaadb43faab0 Change-Id: Ic1ea9c0c43eec1d49177dc1ab4552a1da04e96fe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework exception handlingLars Knoll2013-10-291-19/+8
| | | | | | | | | | | | | | Start the work to remove c++ exceptions from our JS exception handling. Rather rely on engine->hasException. Check the flag after we return from any runtime call in the JIT. Implement new try/catch handling code in qv4codegen and for the JIT that doesn't rely on exceptions. As an added bonus, we can remove the Try statement in the IR. Change-Id: Ic95addd6ae03371c43c47e04cac26afdce23a061 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Disable the stack slot allocatorLars Knoll2013-10-291-1/+1
| | | | | | | | | | | The allocator doesn't work correctly and sometimes assigns temps with overlapping ranges to the same stack slot. This fixes crypto.js and qt quick controls autotests running with the interpreter. Change-Id: If3d0f90edfac669f89da5174cd58eb345d48f2b8 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup: Avoid unnecessary irModule->functions.indexOf callsSimon Hausmann2013-10-201-1/+1
| | | | | | | | | With a growing number of functions per module, these calls become expensive and are unnecessary. defineFunction in the code generator can simply return the correct index right away. Change-Id: I8ab56a3083bf215674a1b46c502b415be694e465 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: Remove more jumps.Erik Verbruggen2013-10-101-0/+7
| | | | | | | | | | | | | | | | | | | | | Do not generate jump instructions when the target immediately follows the current basic block, even if there are intermediate jumps in between as long as they jump to the same basic block. In the IR snippet below, no jumps will be generated at all. … L8: goto L6; L12: goto L6; L6: goto L4; L11: goto L4; L4: goto L2; L10: goto L2; L2: …. Before this change, the gotos in L8, L6, and L2 were still generated. Change-Id: I718ed0d41c603a6905f2279b782cd9e9cafb7d55 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use a QVector instead of a QListLars Knoll2013-10-031-1/+1
| | | | | | | | This makes the code go quite a bit faster (saves ~7-8% of the total amount of instructions executed when running crypto.js Change-Id: I6b3bd08eca98b45593262e2fc6e0ce5056257e76 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: invert conditions when the true block follows the test.Erik Verbruggen2013-10-031-5/+13
| | | | | Change-Id: I5044acd4263b71734e4eb5d7e74b1a4a8414741e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: remove inplace operationsErik Verbruggen2013-09-301-79/+0
| | | | | | | | | Inplace operations are expanded when building the IR, so the neither the IR, nor the instruction selection backends or runtime need to handle them. Change-Id: Id01f9544e137dd52364cf2ed2c10931c31ddfff3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-1/+1
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix cases where mark() would access uninitialized memoryLars Knoll2013-09-221-0/+1
| | | | | Change-Id: I4e07e20d30ba57759a0ece1c298a02b098718b33 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'wip/v4' of qtdeclarative into devSimon Hausmann2013-09-201-4/+3
|\ | | | | | | | | | | | | | | This brings in the infrastructure for the new compilation of QML and JS in the loader thread and the new VME replacement for creating objects in the GUI thread. Change-Id: Ib8127c10f5cb3ad238e57469723d031ab765a79b
| * Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into HEADSimon Hausmann2013-09-201-88/+12
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_masm.cpp src/qml/jsruntime/qv4script.cpp src/qml/qml/qml.pri src/qml/qml/qqmltypeloader_p.h Change-Id: Ia784d855a2131e3289454f12d841ca2c65be15c1
| * \ Merge branch 'dev' of qtdeclarative into wip/v4Simon Hausmann2013-09-111-25/+21
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4script.cpp Change-Id: I20136cab29d86862b5bd9208003200bc24bcdacf
| * | | Beginning of a new qml parserSimon Hausmann2013-09-081-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to parse QML and JavaScript binding expressions/functions in one go and generate data structures that allow for the parsing to happen in a thread and the instantiation of the object tree in another thread, just reading from the generated data structures. This will replace qqmlcompiler and the VME. This new way of loading QML is currently hidden behind the QML_NEW_COMPILER=1 environment variable. There's lots of work left to fill in the gaps in object construction, Component support, Component.onComplete, error messages, etc. etc. Change-Id: I5e40643cff169f469f0b6ce151584ffee5ca5e90 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * | | Make it possible to supply an external JS unit generator to the iselSimon Hausmann2013-09-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed for QML unit generation, when we share the JS generator for QML types/strings and JS code. Change-Id: I50f0c1fa6721d6e3e59417c6c256c82aec124e8f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | | V4 interpreter: inline add/sub/mul on numbers.Erik Verbruggen2013-09-201-9/+20
| | | | | | | | | | | | | | | | | | | | Change-Id: I36d000acef9426b842847691372e9a786b9a45e8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | | V4 interpreter: add hints for unop/binop targetsErik Verbruggen2013-09-201-1/+9
| |_|/ |/| | | | | | | | | | | Change-Id: Ic1230170a89557ad25f0e37261f98819a42a2b47 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | V4: Fix SSA decomposition when no regalloc is used.Erik Verbruggen2013-09-131-19/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add scheduling for moves generated by removing phi nodes by re-using the MoveMapping class from the register allocator. This change applies to both the JIT when no register allocator is used, and the interpreter. Change-Id: I38eac5b13759c7790132d1ef07fa17fcb53187e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | | Remove unused code to generate post increment and decrement expressionsLars Knoll2013-09-121-68/+0
| | | | | | | | | | | | | | | | | | | | | | | | We generate lower level code in codegen and don't use these runtime methods anymore. Change-Id: If1023ce5295431305f4528839bcf2a3031fa7ad2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | | Fix passing of exception table pointers to ARM runtime on unwindingSimon Hausmann2013-09-121-1/+2
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our synthetic exception unwind table for ARM is located at (char *)codeStart + function->codeSize; This relies on function->codeSize to contain the number of bytes of instructions the function has, not the size of the MacroAssemblerCodeRef (which contains the size of the entire area). This patch fixes the calculation of function->codeSize and also replaces the QHash for the IR::Function* -> CodeRef mapping in the masm backend with a simple vector that's perfectly sufficient. Bug spotted by Petr Nejedly Change-Id: I78a53599085c613c6d97aa2490922f54e0bb4f63 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Generate CallData structures directly in the instruction selectionLars Knoll2013-09-111-25/+21
|/ | | | | | | | | Like this we can hand the CallData through the runtime methods without any need to modify them. This simplifies the code in there, and should also speed them up to some degree. Change-Id: Ibd92ff4a8f279a5c4a054c5678646f658cfed5ca Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Temporarily collect a map of all functions in the engineSimon Hausmann2013-09-021-0/+9
| | | | | | | | | | | | | | | | At the moment we collect a lot of compilation units (one per binding expression!), which for long running QML accumulates and creates a horrible performance when trying to retrieve back traces. There is work in progress to reduces the number of units down to one per QML file, and then the fixed sorted QVector might proof to be a more efficient data structure for the lookups. But until that code lands, this patch proposes to use a QMap instead for the time being, that tracks all functions. This brings down the qtquickcontrols auto-test run from 2.5 minutes to just under a minute on my machine. Change-Id: I45bf609055877081daa984de90f291a030f2f24f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* The fast and the furious, register drift.Erik Verbruggen2013-08-271-14/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable the register allocator for X86_64 on Linux and MacOS. The implications are: - handle as much as possible with current code with as few changes as possible - temporarily force the register allocator to spill unop/binop arguments to the stack by doing a call in the implementation (as is the current case), so no change is needed here - only have loadThis and loadConst handle registers - have any method that might need to handle registrers actually cope with them - the inline versions of binops are not generated, as they cannot cope with registers. This will change when ISel for binops is added in the next patch. This means that we are still running with the handbrakes on, but allow for full-throttle in certain/limited cases. Note about the changed test: multiplication always returns a Number (double), so the operands are passed as doubles, so __qmljs_mul will return a double. For addition this is different: because it might return a Number or a String, the operands are passed as whatever fits best. So __qmljs_add will return an int when both operands are ints. Hence the change to the tests. Change-Id: If5bd7dffca8f7de5ba45af700b9c7bb568fc74b7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Interpreter fixes.Erik Verbruggen2013-08-261-7/+15
| | | | | | | | - Support constants in phi-nodes - Fix possible null-pointer dereference. Change-Id: I7cb773f1b4469d1cda648317670d9993d5b35ca3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'wip/v4' of ssh://codereview.qt-project.org/qt/qtdeclarative ↵Simon Hausmann2013-08-201-65/+74
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into dev Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtime_p.h src/qml/jsruntime/qv4script.cpp sync.profile Change-Id: I1d785e2134bffac9553a1c16eed12816cbd1ad2c
| * Cleanup: Determine the root/entry function in isel independent codeSimon Hausmann2013-08-191-13/+1
| | | | | | | | | | Change-Id: I99004b872be9bd7d9dd0c798eb2d9bb4ddfa4cbd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Prospective MSVC build fixSimon Hausmann2013-08-191-1/+1
| | | | | | | | | | | | | | | | It seems LoadString is somehow expanded as a macro, so call the instruction LoadRuntimeString, which is closer to the meaning. Change-Id: I16836b495d29db8cb1af5874762c8e66acb9c529 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Cleanup: Make isel subclass the unit generatorSimon Hausmann2013-08-181-29/+28
| | | | | | | | | | Change-Id: Iadff4974ec6fde25c6586d03d23136ea280f9555 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Get rid of engine pointer in iselSimon Hausmann2013-08-181-2/+2
| | | | | | | | | | Change-Id: I58759712624713cd2215621dca4ccc86fa9a9194 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Merge Function::init with the constructorSimon Hausmann2013-08-161-4/+5
| | | | | | | | | | Change-Id: I557f8a80aa2c74398b94e87ed0f29fe8d2297150 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Eliminate all vm functions on the isel sideSimon Hausmann2013-08-161-7/+2
| | | | | | | | | | Change-Id: I7c0e50498c937ce554b019f98829fa8c5d96c18e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Use indices into the runtime functions array instead of function pointers in ↵Simon Hausmann2013-08-161-3/+2
| | | | | | | | | | | | | | the isel for closures Change-Id: Ieaf7b112f80adc3f1041cb1397db4eab55fb0184 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Reduce ExecutionEngine dependencies in the moth and masm iselSimon Hausmann2013-08-161-3/+3
| | | | | | | | | | Change-Id: Ic3d0287e15c404c5527fa6fe0dfa759631b66dd4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Get rid of QV4::Function::lineNumberMappings by porting moth to the new mappingSimon Hausmann2013-08-161-6/+7
| | | | | | | | | | Change-Id: Ib79489ac4c6c93042143be1f512d29c13d4cd3c6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Get rid of QV4::Function::generatedValues by porting moths' regexps to ↵Simon Hausmann2013-08-161-7/+2
| | | | | | | | | | | | | | runtime expressions Change-Id: Iaae3c4855016948952159596d2528fca73341b72 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Ported identifiers in moth to use runtime stringsSimon Hausmann2013-08-161-31/+24
| | | | | | | | | | Change-Id: I09f04994a2ebe631b12fa76b77a622711de31926 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Initial port of moth to the new compile data structuresSimon Hausmann2013-08-161-5/+45
| | | | | | | | | | Change-Id: I2ead40c5c8c9b12b29c48c387ea424838d1f7d9e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Ported the compile-time class setup for object literals to be run-time basedSimon Hausmann2013-08-161-4/+2
| | | | | | | | | | Change-Id: I21225e4bf0f66914229cf64fa29ce870548c0e93 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Begin using the compiled data structures for runtime stringsSimon Hausmann2013-08-151-1/+1
| | | | | | | | | | Change-Id: Idbf278a96624bf101df35de40577b38e593f22be Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Move arguments object creation into the generated codeLars Knoll2013-08-171-0/+7
| | | | | | | | | | | | | | | | | | | | So far we've been creating the arguments object at runtime in initCallContext(). It's much more efficient to simply add arguments as a local variable in qv4codegen if it's being used and initialize it through a builtin method. Change-Id: I6913f3565adf3aa1917adae8dceef9f50ecf1722 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Move the Param struct out of the Instr union.Erik Verbruggen2013-08-141-10/+12
|/ | | | | | | | The parameter struct was accidentally put in the instruction union. As it is not an instruction, it should not be part of that union. Change-Id: Id70619fed50ae606f43f2c1701f28aea0a0baed7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix leak of QString in V4 IRSimon Hausmann2013-08-121-1/+1
| | | | | | | | | The destructors of the IR nodes won't be called because they come out of a memory pool. Therefore we must store strings by pointer from the function's string pool. Change-Id: I841e801b81c871e8d08cf63ee1e053744c0bf4dc Reviewed-by: Lars Knoll <lars.knoll@digia.com>