aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcomponent.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Split ManagedVTable into two classesLars Knoll2014-01-211-3/+3
| | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] Preliminary support for QQmlIncubatorSimon Hausmann2014-01-081-1/+5
| | | | | | | | Just enough to run some unit tests that use QQuickLoader, components are created instantly. Change-Id: I1c827aa946d3e2a60ccc220bb79572aca2ed8c96 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove unused static functions from QtQml found by Clang 3.4Thiago Macieira2014-01-041-28/+0
| | | | | | | qqmlcomponent.cpp:112:23: error: unused function 'buildTypeNameForDebug' [-Werror,-Wunused-function] Change-Id: I5cc82b20fee8e3f0b61ad59b831723359c8dcda4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-1/+1
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the vtable pointer from the object to the internal classLars Knoll2013-12-041-1/+1
| | | | | | | | This saves one pointer per object, and willmake other optimizations easier in the future. Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove old qml object creation profilingUlf Hermann2013-11-291-16/+0
| | | | | | | | | | The old way the object creation profiler works is unsuitable for detailed profiling as it only tracks top level components. Task-number: QTCREATORBUG-10631 Change-Id: I502d0e144f2965f5e09af8461b50b56c61de5b4b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Simplify & speed up function callingLars Knoll2013-11-091-10/+10
| | | | | | | | | 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-6/+6
| | | | | | | | | | | 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>
* Doc: Fix broken linksSze Howe Koh2013-11-051-2/+2
| | | | | | Change-Id: Ie7408409ddbaa354370267f2dd74326ec56a4186 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-4/+0
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the remaining try/catch statements in C++Lars Knoll2013-10-291-6/+6
| | | | | Change-Id: I2421dc48fb271b66bd476fb16a32a88fcc4c5177 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid side effects when en exception has been thrown.Lars Knoll2013-10-291-5/+5
| | | | | | | | | | | | | | We don't want to check for exceptions after every single line on our runtime methods. A better way to handle this is to add the check in all methods that have direct side effects (as e.g. writing to a property of the JS stack). We also need to return whereever we throw an exception. To simplify the code, ExecutionContext::throwXxx methods now return a ReturnedValue (always undefined) for convenience. Change-Id: Ide6c804f819c731a3f14c6c43121d08029c9fb90 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly propagate parse errorsLars Knoll2013-10-291-1/+1
| | | | | | | | Replace all try/catch statements used when parsing with checks for engine->hasException. Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove internal method from public APILars Knoll2013-10-191-1/+1
| | | | | | | | QQmlError is public API and shouldn't expose an internal method. Change-Id: I7caf06af9340fefec5c96103395fe74acbf19497 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make QQmlIncubatorPrivate refcountedLars Knoll2013-10-151-1/+1
| | | | | | | | | This fixes possible bugs and crashes where the incubator could get deleted through GC while constructing the component. Change-Id: Ibe0c5d4e172f0b5505ace0c3ea0369169b8b48a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make sure the incubated object survives the statusChanged callLars Knoll2013-10-151-6/+10
| | | | | | | | | | | | QQmlComponent::statusChanged() marked the incubated object as destructable when it was done loading. This implied that any gc call afterwards could clean it up. To fix, push the object on the GC stack so it lives until the method returns. Also renamed the WrapperIncubator to QQmlComponentIncubator. Change-Id: I5a8f478a1fd65ea73ddff310392219709a935a70 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix GC issue with incubatorsLars Knoll2013-10-151-19/+45
| | | | | | | | | | | | Never use multiple inheritance with Managed subclasses, as this can easily mess up garbage collection. In this case the vtable from the QQmlIncubator would be added before the start of the Managed pointer. That would not work correctly for the memory manager that casts void pointers to Managed pointers. Change-Id: I1c1ebc6c44bd9cb77eea49738e86ce3374c7ef80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change exception handling APISimon Hausmann2013-10-021-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the exception handling API in the engine slightly, encapsulating any use of direct throw statements and catch blocks with concrete types. In the future we need to be able to change the way these are implemented, in order to ensure that the correct stack unwinding code is triggered for throw and re-throw. This patch separates the C++ exception object thrown from the V4 exception (that includes value, throwing context pointer) and stores the latter inside the engine. In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to move into the QV4 namespace directly. In addition the syntax for catching exceptions changes from try { ... } catch (QV4::Exception &ex) { ex.accept(context); QV4::ScopedValue exceptionValue(scope, ex.value()); } to try { ... } catch (...) { QV4::ScopedValue exception(scope, context->catchException()); } Context::catchException() checks if there's a "current" exception in the engine, and if not assumes that we caught an unrelated exception and consequently re-throws. partiallyUnwind() is also gone and replaced with rethrowException(), in order to encapsulate the re-throw. Lastly, in the future nesting try/catch blocks isn't going to be possible due to limitations in the common C++ ABI with regards to foreign exceptions. Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* qdoc: no longer recognizes the version nr in QML refsMartin Smith2013-10-021-1/+1
| | | | | | | | | | All QML references of the form <QML-module-name><QML-module-version>::<QML-type>::<member-name> have had the <QML-module-version> removed i. Task-number: QTBUG-33776 Change-Id: Idde279e0f254cd24ea44f9841662dd81a2c5bbc6 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Remove most uses of Value from qml/qmlLars Knoll2013-09-301-10/+9
| | | | | Change-Id: I409a8505a9e01f86d777bc694d24516d1c8f0c4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Less QV4::Value usageLars Knoll2013-09-281-4/+4
| | | | | | | | Fix some usages in qv4engine, and fix return types in methods in qqmlxmlhttprequest. Change-Id: I3d6225ca01bf7ea77fcc424914c8392bb6c3a454 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-6/+6
| | | | | | | | 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 CallContext to not hold arguments on the C stack anymoreLars Knoll2013-09-281-7/+12
| | | | | Change-Id: I35f46cce4f243d4b8b2bac9244f8fc26836f413b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc: Updated imports, \qmlmodule, and \inqmlmodule versions in src/qml.Jerome Pasion2013-09-271-1/+1
| | | | | | | | | | | | -QDoc ignores the version in \inqmlmodule so its better to remove them to avoid confusion. -Qt QML import version is 2.2 for 5.2 release -Qt Quick import version is 2.2 for 5.2 release Task-number: QTBUG-32172 Change-Id: I15df270f1fb4df0476a9ddd854fb9ddf58e9fc7c Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix QQmlV4Function API to be GC safeLars Knoll2013-09-261-23/+24
| | | | | Change-Id: Id4f79c22fc48ada1c8a9a858e1b7b3d1cf14d120 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-15/+19
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix cases where mark() would access uninitialized memoryLars Knoll2013-09-221-2/+3
| | | | | Change-Id: I4e07e20d30ba57759a0ece1c298a02b098718b33 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup Object::define*Property APILars Knoll2013-09-221-4/+4
| | | | | Change-Id: I99125908a9bc1d41a2642c409af9704def7a0832 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Start using StringRef for parameter passingLars Knoll2013-09-221-3/+3
| | | | | Change-Id: If2c41daeda2862cd1162c5da8163a9d62fe4111d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup ExecutionEngine::newBuiltinFunction() usagesLars Knoll2013-09-221-13/+4
| | | | | | | And change the return type to be GC safe Change-Id: I6d7513962370fea4072a3d8c6b2c6f2d1705992e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-221-6/+6
| | | | | | | | | | emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Further work towards an exact GCLars Knoll2013-09-221-2/+3
| | | | | | | | | | | Add some more convenience in the helper classes in qscopedvalue_p.h Make accesses to CallData safer, and change ExecutionEngine::newObject() to return a safe pointer. Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] Fix JavaScript expressions in composite typesSimon Hausmann2013-09-201-4/+0
| | | | | | | | | | | | When creating a composite type, we instantiate a nested QQmlObjectCreator on the QQmlCompiledData of the composite type. It may be that this is the first time the type is instantiated and the QV4::CompiledData::CompilationUnit isn't linked into the engine yet. Instead of doing that on the QQmlComponent side, do it in the QQmlObjectCreator constructor (on demand), so that it also works for nested builders. Change-Id: I614bbae4ef6da5a5960cc64b40b092663e1bd810 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Initial support for componentsSimon Hausmann2013-09-201-18/+2
| | | | | | | | | 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] Implement setting object propertiesSimon Hausmann2013-09-201-0/+2
| | | | | | | | | This includes assigning to interface properties, variants that hold QObject pointers and regular QObject <> QObject assignments (assuming that they are compatible) Change-Id: Icd82c672e6899c6bfeb7f0ec758a81f8b70275ab Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Add support for finalization callbacksSimon Hausmann2013-09-201-3/+5
| | | | | | | | | | | This is needed for Component.onCompleted (the signal emission) as well as the private finalization callback API in QQmlEngine, used by QtQuick. The creator - similar to the VME - tracks the attached properties object of QQmlComponent through a linked list. Change-Id: I8ada94009a7ce2078feefd359485657626c300fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Add support for id propertiesSimon Hausmann2013-09-201-1/+14
| | | | | Change-Id: Idb4a0ad06f6cbe5d040da075a8f43d067a27ebc4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into HEADSimon Hausmann2013-09-201-29/+38
|\ | | | | | | | | | | | | | | | | | | 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
| * Initialize variablesLars Knoll2013-09-181-0/+4
| | | | | | | | | | | | | | They could end up being used uninitialized otherwise. Change-Id: I169f0023a8079f32b42508d39f7655985eba5d6b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-6/+6
| | | | | | | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Convert more methods to use ReturnedValueLars Knoll2013-09-181-6/+7
| | | | | | | | | | | | | | Change Exception.value() and a few other places. Change-Id: I53ce17e5656e260138b1ac7f6d467e4636c0a0b9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Convert builtin methods to return a ReturnedValueLars Knoll2013-09-181-15/+15
| | | | | | | | | | Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-4/+4
| | | | | | | | | | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
| * Require a ValueScope for ScopedCallData as wellLars Knoll2013-09-181-4/+8
| | | | | | | | | | | | | | | | This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | [new compiler] Implement proper type resolutionSimon Hausmann2013-09-131-1/+1
| | | | | | | | | | | | | | | | | | 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>
* | Fix error reporting timingSimon Hausmann2013-09-121-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'dev' of qtdeclarative into wip/v4Simon Hausmann2013-09-111-20/+21
|\| | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4script.cpp Change-Id: I20136cab29d86862b5bd9208003200bc24bcdacf
| * Move CallData onto the JS stackLars Knoll2013-09-111-20/+21
| | | | | | | | | | Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix error reporting for wrong signal parameter declarationsSimon Hausmann2013-09-081-1/+1
| | | | | | | | | | | | | | | | 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-5/+21
|/ | | | | | | | | | | | | | 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>