aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compileddata_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Simplify & speed up function callingLars Knoll2013-11-091-1/+2
| | | | | | | | | Get rid of the SimpleCallContext, instead simply use the CallContext data structure, but don't initialize the unused variables. Change-Id: I11b311986da180c62c815b516a2c55844156d0ab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-051-1/+1
| | | | | | | | | | | Don't use recursive function calls anymore. Instead, push marked objects onto the JS stack, and then pop them off when their children are being marked. Should reduce stack memory usage, and improves performance by ~5%. Change-Id: I2d37d97579144fcba87ec8e9fd545dd220c01fbb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Initial support for resolving meta-property access for the scope and context ↵Simon Hausmann2013-10-311-4/+10
| | | | | | | | | | | | | | | | | 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>
* Speed up id object lookupsSimon Hausmann2013-10-291-2/+11
| | | | | | | | | | | | | | | | | 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>
* Add a constant table to the compiled dataLars Knoll2013-10-291-1/+7
| | | | | | | | This will help simplifying and speeding up the moth generated code. Change-Id: I1b87c4b25dbfa6ce2e8a0b77e526f7fc063b0de2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add support CompositeSingleton to the new V4 compiler.v5.2.0-beta1Antti Piira2013-10-211-2/+6
| | | | | | | | | | | | | | | | | Implements QQmlCodeGenerator::visit(AST::UiPragma *) to process any pragma statements in a QML file for the new V4 compiler approach. Only pragma Singleton is supported, others will generate errors. Also adds necessary hooks to treat types as Singletons. Basic functionality is working, but three of the QML Singleton unit tests fail. Some of them are dependent on other language capabilities that seem to have problems. In addition removes unnecessary toString() call in the equivalent visit(AST::UiPragma *) function of the old parser. Change-Id: Iec9fa887f953b80b7f9a11878d846637a8f519ef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Qml JavaScript code generation cleanupsSimon Hausmann2013-10-201-1/+1
| | | | | | | | | | | | | | | * Run the binding expressions, functions and signal handlers through the V4 codegen _per_ component, and run the isel at the end for the entire file. We need to do per-component codegen because we want to set up the correct id and object scopes, which are different for the root component and anonymous components. * Changed V4IR::Module to allow for the concept of "qml modules" where there is no root function defined. This is a logical consequence of running v4 codegen multiple times with different input but the same V4IR::Module. Change-Id: Ib3a719f83507cbab7c2e4e145ccad5b663c795cf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove more uses of ValueLars Knoll2013-10-021-1/+1
| | | | | Change-Id: I889e760f75b485a28e1f2a2c26b2337ae9bfafac Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix invalid alias error reporting in new compilerSimon Hausmann2013-09-301-0/+1
| | | | | | | | Match exactly the VME code path by reporting the right type of error as well as the right hand side of the alias binding if necessary. Change-Id: I35d192a20641e0acbf25d20f3dc5fb53cc7cbae5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change the runtime API over to using StringRef's instead of String*Lars Knoll2013-09-221-1/+1
| | | | | Change-Id: I0ea95e6cca995dc5f98871f0369204af18e48111 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] Initial support for alias propertiesSimon Hausmann2013-09-201-1/+5
| | | | | | | | | Aliases are resolved at "compile time", not rough JS expressions. This is done right after we determined the scope of components in the QML file, which is also where we collect object ids (that aliases use). Change-Id: If5702337f2cca08d17f196c3b2fde3bbdfea5b3c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix destruction of QV4::CompiledData::CompilationUnit objectsSimon Hausmann2013-09-201-0/+1
| | | | | | | | | | | Now that we store them per QML file, they live in the type cache and can outlive the engine. Therefore the engine needs to free to unlink any remaining units upon destruction. This needs to be done after the "death" of the memory manager, which is likely to sweep away any function objects that also hold a reference to the compilation units. Change-Id: I3968d5995289e8d2bc1e3abbb1f8be88a0ab4e03 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crash in QV4::CompiledData::CompilationUnitSimon Hausmann2013-09-201-0/+1
| | | | | | | | | Don't crash when a CompilationUnit is created, never linked into an engine but instead deleted (because there was an error elsewhere compililing the rest of QML before it could reach the link-to-engine stage) Change-Id: Iff535009b6b4d1fc4004987c98730251a3a7d8d8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Initial support for componentsSimon Hausmann2013-09-201-0/+1
| | | | | | | | | We use a dedicated pass through the objects in QV4::CompiledData::QmlUnit to determine which objects are QQmlComponents. We remember their object indices as well as to which component other objects belong to (if any). Change-Id: I97929c57e2ccb2fd380d612002d128359c4bc253 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Cleanup attached and group property determinationSimon Hausmann2013-09-201-1/+3
| | | | | | | | | | Determine when a qualified identifier signifies an attached property or a group property in one place and set the Binding::Type accordingly. This simplifies the object builder code, too. Change-Id: I9f572441e9b5b43338752b848649fbd507cabe4c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Initial support for attached propertiesSimon Hausmann2013-09-201-3/+3
| | | | | | | | | Attached properties are implemented similarly to group properties, except that the object operated on isn't a QQmlValueType from a property (i.e. font) but the QObject that implements the attached properties. Change-Id: If73751162c191c65512ca1bddadd6270e6e33793 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Initial implementation of signal handler supportSimon Hausmann2013-09-201-1/+8
| | | | | | | | | | Signal handlers start out in the parser as binding expressions. A new SignalHandlerConverter converts the bindings then so that the expression is turned into a function declaration where the function parameters match the parameters of the signal. Change-Id: I3ea5aa3b80a6ee3b095c6841c63c3e3bb0b47e4f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup: Fold CompiledData::Value into CompiledData::BindingSimon Hausmann2013-09-201-7/+19
| | | | | | | Value isn't needed anywhere else Change-Id: Ib12d85332a6096e6232a790a7e6fd63961329e3b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Initial support for group propertiesSimon Hausmann2013-09-201-0/+3
| | | | | | | | | | | | | | | | | | | This implements support for "font.pixelSize: 24" for example. The representation in the compile data structure is so that font.pixelSize is short-hand for font { pixelSize: 24 } which means that inside the braces is a complete object initializer. For that initializer we create a dedicated CompiledData::Object, which however has its type name empty. When populating the outer instance then, the "font" property is read as QQmlValueType (a QObject) and instead of creating a new QObject we use that value type as instance to run the rest of the QML object initializer (everything in braces). Change-Id: Ic0a37ac77ab88f582546b9c09a3d06a07726420b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Implement proper type resolutionSimon Hausmann2013-09-131-0/+12
| | | | | | | | | Collect all references to unknown types after parsing, re-use the existing code in QQmlTypeLoader to resolve them and finally use the resolved references map in the QQmlObjectCreator instead of the type name cache directly. Change-Id: I8b83af4f8852e79c33985457081c024358bb9622 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Improve error reportingSimon Hausmann2013-09-121-6/+8
| | | | | | | | Re-enable COMPILE_EXCEPTION calls that were commented out due to missing location information (that this patch also adds). Change-Id: I0d584f474cc7e879350c8aae2869a9603ba415aa Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix error reporting timingSimon Hausmann2013-09-121-0/+1
| | | | | | | | | | | | | Errors for example in signal declarations are usually reported in the loader thread, during property cache construction. This patch separates out the property cache population into QQmlPropertyCacheCreator, runs it from the loader thread and reduces the QQmlObjectCreator to merely set the properties/bindings/ functions on the object. This also enables location tracking for signal declarations and their error reporting. Change-Id: Ief1ffbb3113f8279a50d1a12dab8dbe096702a60 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix error reporting for wrong signal parameter declarationsSimon Hausmann2013-09-081-6/+7
| | | | | | | | Record the line/column in the signal and report it together with the url if there was an error in declaring the signals. Change-Id: Idbbee9be271b0ca55709ffc1791637595d7ebd89 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Beginning of a new qml parserSimon Hausmann2013-09-081-25/+116
| | | | | | | | | | | | | | 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-0/+2
| | | | | | | | 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>
* Temporarily collect a map of all functions in the engineSimon Hausmann2013-09-021-1/+1
| | | | | | | | | | | | | | | | 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>
* Cleanup: Determine the root/entry function in isel independent codeSimon Hausmann2013-08-191-1/+1
| | | | | Change-Id: I99004b872be9bd7d9dd0c798eb2d9bb4ddfa4cbd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix invalid reads with stringsSimon Hausmann2013-08-181-21/+22
| | | | | | | | | | | It may happen that a dynamically created compilation unit disappears before any QV4::Strings it created. Those strings would still have a reference to the QString data in the compilation unit. I don't see a choice other than making a copy of the string data ;(. But this patch adds a flag that would allow for avoiding it if we happen to know that the compilation unit data is static. Change-Id: Ib35a4d2a566b301a25ffe56e392809e44e7b4ae8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of the functions list in QV4::ExecutionEngineSimon Hausmann2013-08-161-1/+2
| | | | | Change-Id: I97067dbb2819936a1b2029c9f63f0627cb6b8bd2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial port of moth to the new compile data structuresSimon Hausmann2013-08-161-10/+1
| | | | | Change-Id: I2ead40c5c8c9b12b29c48c387ea424838d1f7d9e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of the QV4::Function in the masm iselSimon Hausmann2013-08-161-1/+0
| | | | | Change-Id: Ide70ca5a3f3dcc793fb96fd64f8b8df6b07d1168 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-2/+29
| | | | | Change-Id: I21225e4bf0f66914229cf64fa29ce870548c0e93 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup: Store lookup tables inside the CompilationUnitSimon Hausmann2013-08-161-15/+21
| | | | | | | The size of each lookup is fixed, so it's easier to include in the unit itself. Change-Id: I66135efe4056eb0b4d7ff312eaa347fe98d8887f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Store line number mappings in the compiled functionSimon Hausmann2013-08-161-3/+5
| | | | | Change-Id: I4e37aac3618b20ccd52ce4833098781374a3daf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ported regular expressions over to be run-time generated dataSimon Hausmann2013-08-161-1/+21
| | | | | Change-Id: I04e693d4923c97c3d869a5beb17011f6aad85f03 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crashes with unmarked runtime stringsSimon Hausmann2013-08-151-0/+4
| | | | | | | | | Runtime strings are identifiers, but they still require to be marked. Keep track of all compilation units in the engine (one per file) and mark its run-time strings. Change-Id: Ie70b00dfa373c4567279591de2f717e8103c288f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ported lookups to use the compiled data infrastructureSimon Hausmann2013-08-151-0/+20
| | | | | Change-Id: Idf75cd51087ea825f22aabda59661be461fd3b86 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Prepare MASM for better runtime string handlingSimon Hausmann2013-08-151-2/+2
| | | | | | | | | | Keep the run-time functions as-is by taking String pointers and use a little bit of inline assembly to resolve the string ids to string pointers, by adding a runtimeStrings array pointer next to the lookups in the context (similar mechanism). Change-Id: Ib5a70bdf47fef7c447d646ccfe03f3dc30d39f20 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initialize formals and locals from the compiled function data instead of in ↵Simon Hausmann2013-08-151-0/+3
| | | | | | | the isel Change-Id: I9db976df310a5986ceca66d21efeeae536dbede4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Store the file name per compilation unit, not per compiled functionSimon Hausmann2013-08-151-1/+3
| | | | | Change-Id: Id699897b241a9ff6495689e5685092d311acb8c2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move codeRef out of QV4::FunctionSimon Hausmann2013-08-151-0/+3
| | | | | Change-Id: I65700b9cc4907aaa28623a95204e88f87fccfd49 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move the masm compilation unit entirely into qv4isel_masmSimon Hausmann2013-08-151-13/+0
| | | | | Change-Id: If24b6a761dc2f2443520b31b5130ab44b739cdf3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move QV4::Function::sourceFile to CompiledFunctionSimon Hausmann2013-08-151-0/+1
| | | | | Change-Id: Iacf907c475070bab4a5a1583280f110c089141c4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of flags in QV4::Function and use CompiledFunction::flags insteadSimon Hausmann2013-08-151-1/+8
| | | | | Change-Id: Iffe72ff6dd0311d7548d1ea41164a400fd3a7600 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix writing the function offset table and initialize the pointer to the ↵Simon Hausmann2013-08-151-2/+8
| | | | | | | compiled function in the runtime function Change-Id: I9aed9f394fedc4a4ea334f6ab1b72fe749c64c72 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Begin using the compiled data structures for runtime stringsSimon Hausmann2013-08-151-0/+37
| | | | | Change-Id: Idbf278a96624bf101df35de40577b38e593f22be Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initial version of generator for new data structuresSimon Hausmann2013-08-151-14/+30
| | | | | | Change-Id: I172a504f8b4f8284967a4a02e207bf4c0a04c2a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add initial draft of the compiled data structures for JS and QMLLars Knoll2013-08-091-0/+221
To be able to cleanly separate the compilation stage from the runtime, the compiler will create a read-only data structure, that is described in this file. This will later on also allow us to fully compile JS and QML in separate threads, and longer term replace the qqmlcompiler/vme infrastructure. Change-Id: Iafe6d527c0994c3bc17ba1630959ffd32cc74067 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>