Commit Graph

20 Commits

Author SHA1 Message Date
Lars Knoll 1a1f10806c Access the id objects through a specialized runtime method
This brings us one step closer to getting rid of the
QQmlContextWrapper.

Change-Id: Ied57f4c174c2ebd95096310a4ad4c0c28787e7a4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-12 07:29:44 +00:00
Lars Knoll f21e8c641a Access context properties through the qml context
And get rid of another temp in the IR.

Change-Id: I039393e020e5141f1986aee276246c30fd8057f3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-10 01:22:05 +00:00
Lars Knoll b288956817 Use the QmlContext to access properties of the scope object
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>
2015-08-10 01:21:57 +00:00
Lars Knoll 416c0f3263 Add ability to retrieve and use the QmlContext from our generated code
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>
2015-08-10 01:21:48 +00:00
Frank Meerkoetter a450f2807d Remove unused QQmlPool
This code is no longer in use.

Change-Id: If0cb009ac6622ed36cba5886d6685d3f242c3c87
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-31 07:14:28 +00:00
Jani Heikkinen c5796292ad Update copyright headers
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>
2015-02-12 10:28:11 +00:00
Simon Hausmann 9d7b27f5bf Clean up JS .import/.pragma directive scanning
There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so
let's get rid of extra parser that operates on a string. Instead this way we
can do the scanning all in one shot, avoid detaching a copy of the source code
string and (most importantly) bring the parser closer to the copy in Qt
Creator, which uses the directives approach to extract imports and pragma.

Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
2015-01-08 22:08:19 +01:00
Simon Hausmann 9e71faae03 Fix QQmlExpression/QQmlScriptString/QQmlBinding crashes
In the QQmlScriptString we store the binding id and it is an index into the
runtimeFunctions array of the compilation unit. However we don't store the
compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve
it from the cache via the context url (we have the context after all). That
turns out to be not a reliable way, as sometimes the URL might slightly differ
from the originally compiled cache (qrc:/// turning to qrc:/ maybe).
Consequently the type is (unnecessarily) compiled again and unfortunately not
_linked_, therefore the runtime functions array is empty. Another option is
that when the component was created from a QByteArray, then no entry exists in
the cache in the first place.

This patch addresses the problem by storing a reference to the compilation unit
in the QQmlContextData. That we can safely retrieve and it'll make sure the
compilation unit also stays alive.

In the process of that the manual reference counting was switched over to
QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit.

Task-number: QTBUG-41193
Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-10-09 17:41:39 +02:00
Jani Heikkinen e7ceacda70 Update license headers and add new licenses
- 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>
2014-08-25 11:28:46 +02:00
Simon Hausmann 82fc196252 Cleanup
Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS
units it means a slight increase of memory usage by a few bytes, but overall it
makes the code a lot simpler.

Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-08-15 08:28:43 +02:00
Simon Hausmann 8a71e2bd03 Cleanup: Get rid of the url and file name members in QQmlCompiledData
This is part of the effor of moving members from QQmlCompiledData into
QV4::CompilationUnit in order to eliminate the former in the long run.

Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-06-05 10:01:44 +02:00
Friedemann Kleint 6f8f73e74f Fix linking of qmlimportscanner in MSVC debug builds.
Qt5QmlDevToolsd.lib(qqmlirbuilder.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QmlIR::CompiledFunctionOrExpression::CompiledFunctionOrExpression(void)"

Use Q_QML_PRIVATE_EXPORT so that it does not have effect when building
qmldevtools.

Change-Id: I138fe9cba518829d7ec1d0bfe9d4a9d657446c7d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-04-28 20:04:42 +02:00
Simon Hausmann a885d10a02 Extend the QML bootstrap library by the IR builders
This is among other things needed to fix the qml import scanner to detect
dependencies from .js files correctly.

The patch also fixes the use of Q_QML_EXPORT towards Q_QML_PRIVATE_EXPORT
where appropriate and corrects the wrong include path for the double conversion
code to actually be relative to the file it is included from. This worked by
accident because of other include paths present in the build.

Change-Id: I338583dad2f76300819af8ab0dae8e5724c84430
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-04-23 21:16:46 +02:00
Simon Hausmann c494da0979 Reduce memory consumption of runtime compiled QML types
Don't store the string of binding scripts in the compiled data. The only
exception to the rule are properties of type QQmlScriptString as well as types
with custom parsers.

Change-Id: I7f53262bf957b442bac4db71d0a2c0bed74a9b54
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-04-02 14:04:17 +02:00
Simon Hausmann 0ed744c1ef Various cleanups
* Encapsulate the string pooling for the V4 data generation into a StringGenerator class.
* Move type reference collection into the IR::Document, where it belongs (as it writes
  into the typeReferences there)
* const fixes
* Remove unused methods and members
* Store unit and qml unit sizes right in the generated data structure. That makes copying
  easier (like we do when generating the QML data based on the JS fields)

Change-Id: I053146ab0b00cc90ac7f72f867415962d1be121b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-28 15:07:03 +01:00
Simon Hausmann 12e55eaa65 Cleanup: Remove last traces of QQmlScript
What remains is the code for removing .pragma from script source code (and
replacing it with white-space to preserve line/column numbers).  The previous
code even returned the value of the pragmas, but for the remaining caller sites
that value isn't used, so we can just return void.

Change-Id: I16db15da236970660b817d6c4493005365a7a1af
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-19 17:24:01 +01:00
Simon Hausmann cf5fd11c8a Cleanup: Remove dead code
Change-Id: I073a8c61d666a08b5e88edcbf4cefa71d7f5b7c3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-19 08:32:53 +01:00
Simon Hausmann 89218c6d0e Clean up script imports
Move the .pragma and .import script extraction out of qqmlscript and
into qqmlirbuilder, where it can populate a QQmlIR::Document. Changed
the script part of the type loader to use that, which also allowed
eliminating the m_source member and m_metaData.

Change-Id: Icc64d219fff5666679a02e6afda73f7edfca132b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-19 08:32:33 +01:00
Simon Hausmann c33a79f0a0 Clean, part 3
* Get rid of QQmlScript::Pragma
* Allow retrieving the QML unit size after generation
* Add flag equivalent of .pragma library to QV4::CompiledData
* Remove unused method

Change-Id: I2f95b83f919004013741bc539c82960cc878f3a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-19 08:32:23 +01:00
Simon Hausmann fa24ef3d72 Cleanup, part 2
* QQmlCodeGenerator -> QQmlIR::IRBuilder (it doesn't generate code, it
generates the Object/Property/Signal/etc. IR of the .qml file, that's
going to get transformed to QV4::CompiledData::*)

* ParsedQML -> QQmlIR::Document

Change-Id: I329e858487b66e1ae528d44316761f5dd34b79f4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-03-18 09:05:57 +01:00