aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4instr_moth_p.h
Commit message (Collapse)AuthorAgeFilesLines
* QML: Fix typeof context property.Erik Verbruggen2015-10-271-0/+16
| | | | | | | | This was missing from f21e8c641af6b2d10f0d7e7e0fc6a755dab3673c. Task-number: QTBUG-48524 Change-Id: I5cc6a979d965a1ef6b7fbc916a7ca9df868b459a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-061-0/+11
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Access the id objects through a specialized runtime methodLars Knoll2015-08-121-6/+8
| | | | | | | | This brings us one step closer to getting rid of the QQmlContextWrapper. Change-Id: Ied57f4c174c2ebd95096310a4ad4c0c28787e7a4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Access context properties through the qml contextLars Knoll2015-08-101-6/+26
| | | | | | | And get rid of another temp in the IR. Change-Id: I039393e020e5141f1986aee276246c30fd8057f3 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Use the QmlContext to access properties of the scope objectLars Knoll2015-08-101-6/+26
| | | | | | | | | Add some runtime methods to access properties of the scope object directly (using the QmlContext), and generate proper code to call those. Change-Id: I0b29357c9a3b9ad53ba568ec6cb763e8ecb10f21 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Add ability to retrieve and use the QmlContext from our generated codeLars Knoll2015-08-101-0/+6
| | | | | | | | | | | | | | Our generated code (JIT and interpreter) should operate on the QML context to retrieve QML related things. That's better than operating on 4 different temps. So this commit introduces the QML context as a temp in the code we generate for QML. The next commits will move things over to use that context with specialized runtime methods instead of using generic subscript/get calls on the different subobjects. Change-Id: Ia05cf339de9cdd23003f35cf78ede17d2590f8de Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Accelerate property lookups for C++-based QObject singletons.Michael Brasser2014-08-071-1/+1
| | | | | Change-Id: Icbdf06a077014db5dd57cba42f84591433ec4196 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup our runtime methodsLars Knoll2014-03-111-2/+2
| | | | | | | | | Move all our runtime methods into the QV4::Runtime struct and give them nicer names without underscores. Sort them logically and remove a few unused methods. Change-Id: Ib69b71764ff194d0ba211aac581f9a99734d8180 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a Line instruction to the interpreterLars Knoll2014-03-071-0/+6
| | | | | | | | | | This unifies the way we handle line numbers in the JIT and Interpreter. Remove the now unused lineNumberMapping code and data. Change-Id: I1d60b1fbb77e70b531fa73d93410683e84dd1e3c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify our breakpoint handlingLars Knoll2014-03-071-1/+1
| | | | | | | | | | | | | | | | | Only store a Hash of break points in the debugger, instead of the involved logic that currently adds and removes break points. Add the current line number to the Debug statements in the interpreter, and pass them on to the debugger for checking whether we should really break. This adds a slight additional overhead to running inside the debugger, but greatly simplifies the logic and doesn't require modifying the bytecode anymore. This in turn opens up the possibility to run the debugger on JIT generated code later on. Change-Id: If2a3ae8f8d08b69a3a704cbbe0a84000f917a32e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Determine whether or not an object literal requires a sparse array at ↵Simon Hausmann2014-02-241-2/+2
| | | | | | | compile time Change-Id: Ieb7f6ee97a4f251f1e2369850ebb9e2931f84ac1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up object literal handling with integral indicesSimon Hausmann2014-02-241-17/+2
| | | | | | | | | | | | | | | | | | | | | * Object literals with array indices are now created with one run-time call, instead of an initial one for non-integral keys followed by sub-sequent define_builtin_property calls. * Cleaned up propert name retrieval. Instead of using a visitor, it's easier to define a virtual method on the PropertyName type. The visitor doesn't buy us much as it's not possible to recurse within property names, and this way we can use it also from the function scanner to correctly determine the number of arguments needed for object literal initalizations. * Similarly the duplicated/common name member for all property assignments has been moved into PropertyName, for convenient access without AST casts. * Removed now unused builtin_define_property/settergetter functions from IR, run-time and moth. Change-Id: I90d54c81ea5f3f500f4f4a9c14f7caf5135e7f9f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up our internal namespacesLars Knoll2014-02-231-4/+4
| | | | | | | | QQmlJS::MASM -> QV4::JIT QQmlJS::V4IR -> QV4::IR Change-Id: I707e8990459114a699c200fe3c22cec3c8df1afc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Reapply 612785f39e325b0578be89e09b0e32d7d08d471e fixing GCC warningsThiago Macieira2014-02-161-0/+4
| | | | | | | | See 612785f39e325b0578be89e09b0e32d7d08d471e for details. The warning is exactly the same as before, with the exact same solution as before. Change-Id: I2f6cbc64234696f1d240611f376ab5daf8d0f89c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove add/sub/mul instruction specializations for numbersLars Knoll2014-02-071-24/+0
| | | | | | | | | | These instructions did hurt more than help, as they converted ints to doubles. Since the regular add/sub/mul runtime methods have fast paths for both ints and doubles, we're better off using those instead. Change-Id: I0b7a6f95818943bfc8a0669c1c56f7db4e7246e0 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Specialize CJump into JumpEq and JumpNeLars Knoll2014-02-071-4/+10
| | | | | | | | This avoids the bool invert in the instruction stream, and some additional code in the VME. Change-Id: I0ea675a2e3d07c1b8c5234b888d8d9683bcee330 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add specialized instructions for right and left shiftLars Knoll2014-02-071-0/+32
| | | | | | | | These give a measurable speedup as the critical code paths are now inline. Change-Id: I3cee8a432fbe96d66ba1e6bd277a38e624a50c14 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a MoveConst instruction to the interpreterLars Knoll2014-02-071-0/+7
| | | | | | | This simplifies and speeds up loading of constants Change-Id: I05b4f7a34abd4ed6416fa800a31debbb28b37104 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a special Debug instruction to the interpreter and use itLars Knoll2014-02-051-4/+8
| | | | | | | | | | | | | | | This avoid having to check for the debugger at every instruction we execute. Instead we only add debug instructions at the beginning of every line and every basic block when we have a debugger. This still allows interrupting the JS execution at any time (as we can't loop inside a basic block), and single stepping through lines. But it has no overhead when the debugger is not running and a lot less when it is running. Change-Id: Ib17170b42944b608fc6caa1891082205dd2b2763 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Use lookups for get/setElement in the interpreterLars Knoll2014-01-311-0/+18
| | | | | | | Significantly speeds up crypto.js Change-Id: Icd3d59bea3fe4427e93e9e10e3526178e8de859c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-3/+3
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support for accelerated property access to QML types and namespace supportSimon Hausmann2013-11-281-0/+9
| | | | | | | | | | | * Resolve lookups in namespaces at compile time and instruct the SSA optimizer to eliminate reads from the namespace (QQmlTypeWrapper) if possible. For example access to attached properties of types (i.e. MyNameSpace.ListView.isCurrentItem) requires neither reading the namespace nor the type. * Add support for accelerated lookup of attached properties Change-Id: Ib0b66404ed7e70e1d4a46a1ac8218743a4cc8608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for accelerated property access to QML singletons and enumsSimon Hausmann2013-11-251-1/+8
| | | | | | | | | With this patch we determine the meta-object of singletons, propagate it into the IR and load them separately using a dedicated run-time function. In addition enums in singletons and QML types are resolved at compile time. Change-Id: I01ce1288391b476d1c9af669cb2987a44c885703 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* IR Cleanup, resolve ID objects through array subscriptsSimon Hausmann2013-11-251-4/+3
| | | | | | | | | | | | ...instead of a special MEMBER type. This allows removing the type member from V4IR::Member altogether (and thus unshadow from V4IR::Expr::type). By not requiring the base of a id lookup member expression to be a NAME, we can also speed up repeated id lookups by fetching the id object array wrapper only once per function. Change-Id: I3e9b8f498d32ace4a0cc2254f49e02ecc124f79c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use lookups for create_property (ie. new foo.bar)Lars Knoll2013-11-221-0/+10
| | | | | | | | This is not used that often, but it removes one more place where we do lookups by name. Change-Id: I9f798b8b4a64be3fdf3e53090e4288724c9d2b22 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix property dependency generation for accelerated QML QObject propertiesSimon Hausmann2013-11-121-0/+1
| | | | | | | | | | | | | | The previous approach of collecting the dependencies through an IR visitor doesn't work, because it relies on a fixed structure - for example MEMBER(NAME, prop) - which we can't guarantee (it's usually MEMBER(TEMP, prop)). But it turns out that we can only pre-calculate dependencies for context, scope or id properties, so we can do that right away in the QML specific JS codegen, store that information in the IR function and use it from there in the data structure generator as well as in the isel as a parameter to getQObjectProperty to tell the run-time whether capture is required or not. Change-Id: I33711c3420d6534c653c2a6a4284f0fc12e941cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move conversion of this object into generated codeLars Knoll2013-11-051-0/+5
| | | | | | | | | | | | When a non strict mode function uses the this object, we need to make sure it's being correctly converted into a object before being accessed. So far this was being done by ScriptFunction::call. Move this into the generated code to avoid overhead for methods not using 'this', and simplify our ScriptFunction::call() implementation. Change-Id: I739f4a89d29ed8082ce59e48d1523776224fc29d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Speed up lookups of imported scriptsSimon Hausmann2013-10-311-4/+3
| | | | | | | | | | The QQmlContextData stores the JS objects of imported scripts in a QList<PersistentValue>. Instead of indexing into that list, this patch changes ctxt->importedScripts to be a JavaScript array, that in the IR we can index via subscript. Change-Id: Ie2c35fb5294a20a0b7084bb51d19671a27195fec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement loading of resolved imported scriptsSimon Hausmann2013-10-311-0/+7
| | | | | | | | We can resolve the use of names that refer to imported scripts at compile time and load them at run-time by index through context->importedScripts. Change-Id: I681b19e7d68dbf3b9a68af00b4cea2a9254c2d78 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Implement setting of values to resolved QObject propertiesSimon Hausmann2013-10-311-0/+8
| | | | | | | | After the resolution of a property, we can set it by index at run-time instead of via name resolution. Change-Id: I479599dabe343cf9e6582dcda12291aebfcce418 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial support for resolving meta-property access for the scope and context ↵Simon Hausmann2013-10-311-3/+23
| | | | | | | | | | | | | | | | | objects at QML compile time This avoids having to do a string lookup for ids and in the import cache at run-time, before we can do a string hash lookup in the property cache. Instead we resolve final properties in the context and scope object at compile time and look them up at run-time using their index instead. The dependencies to these properties are also tracked separately and recorded in the compiled data. This is merely the initial patch. There's a lot left to do, such as having specialized getter and setters for specific property types. Setters are missing altogether right now and will fall back to name lookup. Change-Id: If3cb4e7c9454ef4850a615f0935b311c9395b165 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use lookups in the interpreterLars Knoll2013-10-301-0/+51
| | | | | | | | | | | | | Implement lookup calls for the interpreter. This significantly reduces overhead by avoiding repeated name lookups on the same object type. This doubles the speed of quite a few of the v8 benchmarks, and brings the interpreter up to close to 40% of the speed of the JIT. Change-Id: Ie8c2f5b1ca71a7329bc643c3d2158a6301a392ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimize some unops and binops for mothLars Knoll2013-10-301-0/+38
| | | | | | | | 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/+48
| | | | | | | 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-1/+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-4/+38
| | | | | Change-Id: I6e141a425c2b4cc0cd64c7f0011e7028b9147f69 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rework parameter handling for mothLars Knoll2013-10-291-24/+19
| | | | | | | | | | 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-10/+3
| | | | | | | | | 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-6/+5
| | | | | | | | | 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-0/+18
| | | | | | | | | 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 exception handlingLars Knoll2013-10-291-14/+0
| | | | | | | | | | | | | | 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>
* V4: invert conditions when the true block follows the test.Erik Verbruggen2013-10-031-0/+1
| | | | | Change-Id: I5044acd4263b71734e4eb5d7e74b1a4a8414741e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove more uses of ValueLars Knoll2013-10-021-2/+2
| | | | | Change-Id: I889e760f75b485a28e1f2a2c26b2337ae9bfafac Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: remove inplace operationsErik Verbruggen2013-09-301-27/+1
| | | | | | | | | 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>
* V4: Fix SSA decomposition when no regalloc is used.Erik Verbruggen2013-09-131-0/+7
| | | | | | | | | 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-60/+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>
* Generate CallData structures directly in the instruction selectionLars Knoll2013-09-111-7/+7
| | | | | | | | | 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>