aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add support for disk caching of ES modulesSimon Hausmann2018-08-179-14/+79
| | | | | | | | | | | | | | | | | | Two minor fixes needed for this otherwise straight-forward change: (1) When compiling modules, use the full url for the source file of the compilation unit, as that's what we use for the relocation check when loading the cache file. (2) Record the proper source time stamp for cache invalidation. As a bonus, when importing scripts from .qml files, we now also attempt to use the cached version that we created on the fly in an effort to replace heap memory with mmap backed memory - just like we do for .qml files. Change-Id: I5b03a18e3c44d537c3242cb1d969636df32fe42a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add support for importing ES modules in .qml filesSimon Hausmann2018-08-1719-72/+215
| | | | | | | | | | | | | | | | | This is a straight-forward hook into the module implementation in QV4::ExecutionEngine. Modules are pre-compiled in the QML type loader thread. That thread keeps track of all pending loading scripts through the type loader's m_scriptCache. Once a module is compiled, it's thread-safely registered with the execution engine. Script instantiation and evaluation is done solely in the QQmlEngine's thread. ES Modules are identified in imports as well as qmldir files by the .mjs extension. Change-Id: Ie9c59785118afcb49f43a1e176a9f7db00f09428 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Provide some more documentation for modules in QJSEngineSimon Hausmann2018-08-161-0/+39
| | | | | | | | A little example goes a long way :) Change-Id: I5aaac011e5a3e1348d7a084b669ec66349d441fa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add API to QJSEngine for importing ECMAScript modulesSimon Hausmann2018-08-165-0/+109
| | | | | | | | | | | | Now that the standard defines the concept of a module, it makes sense to offer a function in QJSEngine that can read files and load them. [ChangeLog][QtQml][QJSEngine] Added function to import ECMASCript modules from the file system or the Qt resource system. Change-Id: I72f8d49de948872221ac1b54fcfb066404bed9b9 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix the class name property of default exported classesSimon Hausmann2018-08-162-1/+8
| | | | | Change-Id: I171e571a336a15c27881999a10ffe3c52e92d816 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix the name of anonymous generators and function declarationsSimon Hausmann2018-08-152-7/+12
| | | | | | | | | | | | | | | | | | The spec says in 14.4.12 that an anonymous generator declaration can only occur as part of the export declaration. The same applies to anonymous function declarations in 14.1.20. It is only in the default export declaration rule that we can detect that we have an anonymous declaration/generator, so that is where we implement the step of setting "default" as the function name. It is safe to use an empty string in GeneratorDeclaration_Default and FunctionDeclaration_Default because that rule is only referenced from HoistableDeclaration_Default, which in turn is only referenced from ExportDeclaration. Change-Id: Ibd341b941f67cbcc727da4df23af04af313b6251 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix initialization of default exported functions and generatorsSimon Hausmann2018-08-155-15/+31
| | | | | | | | | When registering a default export, make sure that the local name points either to an entry that we've entered into the environment or the synthetic entry we create. Change-Id: I37e160dc1e3231214bb68f72d6bb0746d7aee3b3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix attributes returned by getOwnPropertyDescriptor on module namespace objectsSimon Hausmann2018-08-152-2/+1
| | | | | Change-Id: Ib07d1a215492640e82f4f4791ba714688508f3db Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix order of own property names of module namespace objectsSimon Hausmann2018-08-157-15/+59
| | | | | | | They must be sorted, no duplicates and only one default entry at most. Change-Id: Ia9c0e54a761ce7cbfebb837330bf3769d505eb3b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix Reflect.ownKeysSimon Hausmann2018-08-152-4/+22
| | | | | | | This function should not only return the names but also keys (symbols). Change-Id: I431e4aa8fa31ac6c16a415f00fb9f98405632562 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Minor tweak to the ES test expectationsSimon Hausmann2018-08-151-2/+6
| | | | | | | | One module test remains an expected failure but it comes with an explanation now. Change-Id: Id58bcbc840e2cde5f493ff88af972d29485f6c55 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix usage of const in for declarationsSimon Hausmann2018-08-154-5/+4
| | | | | | | | | | | | | | | We correctly produce a syntax error for a const declaration that is without an initialize, such as const x; but we have to make an exception if it's part of a for declaration, such as for (const x of [1, 2, 3]) Change-Id: Iab86d73f2edc1f3deaf62f0f43f8b04789696b65 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Implement RegExp.prototype[Symbol.split]Lars Knoll2018-08-153-69/+137
| | | | | Change-Id: Ia5ed7afc67122f4d70bf2e0169537f936df036a9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix spec compliance for the RegExp constructorLars Knoll2018-08-153-31/+76
| | | | | Change-Id: I767b27faab912e91962797ca154d929473113cc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix some details in RegExp handlingLars Knoll2018-08-156-46/+52
| | | | | Change-Id: If9f7c07ea657ba8503b9188a7b77e301f23423ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement RegExp.prototype[Symbol.replace]Lars Knoll2018-08-155-64/+182
| | | | | Change-Id: I5a2c9cb1e9dcca664526b3949671d72d2ffee427 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement RegExp.prototype[Symbol.search]Lars Knoll2018-08-153-18/+36
| | | | | Change-Id: Ie966628d020eb010eb5ecc3279fed2b002975728 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.prototype.match as per ES7 specLars Knoll2018-08-152-31/+17
| | | | | | | The implementation is supposed to call arg[Symbol.match]. Change-Id: Ia8028d259e152b1e65eb6b0e817ef60bdc0d37e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve RegExp.prototype[Symbol.match] implementationLars Knoll2018-08-154-30/+70
| | | | | Change-Id: Id632a4f4648f68f3b46d31f84e4ee05c86391f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup RegExpObjectLars Knoll2018-08-1512-210/+256
| | | | | | | | | | | Move properties from RegExpObject to getters in RegExp.prototype to be compliant with the JS spec. Implement support for the sticky flags ('y') and correctly parse the flags in the RegExp constructor. Change-Id: I5cf05d14e8139cf30d46235b8d466fb96084fcb7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Partial implementation of RegExp.prototype[Symbol.match]Lars Knoll2018-08-153-62/+98
| | | | | Change-Id: Id94c3cc25835b53bae08713cdd8f2e384d907690 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix explicit export of imported variablesSimon Hausmann2018-08-143-4/+24
| | | | | | | | | | | | | | | | | | | | Instead of using a re-export, it's also possible to write import { foo } from "./bar.js" and then export it again export { foo } Typically exported variables are referenced from the locals, but since we don't add imports to the locals, we need another way of locating them. This patch uses the index space after the locals in the internal class for imports, so that after we've identifier the export in the local export entry table, we can use the local name to search in the internal class and find imports past the locals. Change-Id: I58ab79ad3df1bbc1b972f0a2771d9ca1268de27b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Simplify ES module body handlingSimon Hausmann2018-08-145-100/+17
| | | | | | | | | Now that ImportDeclaration and ExportDeclaration are also statements in the AST, we can get rid of the ModuleItemList in the AST. We keep it in the grammar, but map it to a statement list. Change-Id: I4cab29fe9b075e88454fe3b194126f728000856a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix module dependency handlingSimon Hausmann2018-08-1410-47/+54
| | | | | | | | | | | | | | | | | | | | | The evaluation of a module can have side-effects by modifying the global object or objects in it. Therefore even a seemingly empty import such as import "./foo.js" needs to be listed in the module requests. It's also important that they are evaluated in the order of declaration. Therefore we collect all module requests separately - even those that don't have import variables to process. This patch also ensures that the export and import declarations are visited in the correct order, by unifying both AST nodes to be hooked into the statement list. The fact that we connect the module list items into a statement list is solely an artifact of re-using defineFunction() which takes a StatementList as body. Change-Id: I75dc357b2aecfc324d9a9fe66952eff1ec1dfd8a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix multi variable module import listsSimon Hausmann2018-08-142-4/+1
| | | | | | | | Select the correct head when finishing the linked list for ImportList AST nodes. Change-Id: I34ae2ccfd0e969dbd92ce2458de019bb02046aa5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve error handling for non-existent file importsSimon Hausmann2018-08-141-1/+3
| | | | | Change-Id: Ic043d30738c97836cf6afada6ee7cade23bf50f9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Implement star re-exportsSimon Hausmann2018-08-142-8/+30
| | | | | | | | | | | An export such as export * from "./foo.js" allows re-directing imports. Change-Id: I359ce7d4516ed4a7b95e6fcefb4725d854f9c2ce Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Implement initial support for import namespacesSimon Hausmann2018-08-145-34/+134
| | | | | | | | | | | | | The import via import * as foo from "./bar.js" allows accessing all exports via the special namespace object. This is conceptually quite similar to the existing import of .js files in QtQuick. Change-Id: Ia6d79342f0884a89dfe4dc07316570ca7789cac0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Implement indirect exports in modulesSimon Hausmann2018-08-143-24/+63
| | | | | | | | | This allows exports in the style of export { foo as bar } from "./baz.js" Change-Id: I2f723c3d9c5fbc530a30ac5bcb12a02f21918648 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQuickTableView: rename attached prop tableView to viewRichard Moe Gustavsen2018-08-133-10/+10
| | | | | | | | ListView calls the same attached property for 'view'. So do the same for TableView. Change-Id: I99034869813750e2fab56fe6ffcc4b4a6a4d9c52 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* StorageModel manual test: use enum class for Column enumShawn Rutledge2018-08-112-48/+48
| | | | | | | | We should set a good example by using enum classes more: internally, in examples, and in manual tests which might become examples eventually. Change-Id: Ife6f3b8eaf2f534d474c35e34370361d026f2c47 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Enable the Yarr JIT for regexps with nested parenthesisLars Knoll2018-08-113-2/+11
| | | | | Change-Id: I4e7a44ae2b5759febec6f83ab9fa85612515ab04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the Macro assembler for ARMv6 and earlierLars Knoll2018-08-117-3083/+0
| | | | | | | | We've not been using it for quite some time, and the interpreter is the better fallback option there. Change-Id: If4d698115eec6038b369586ebdd8c1e4b88ea0ba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the SH4 macro assemblerLars Knoll2018-08-116-4520/+0
| | | | | | | | It's not being used afaict, and is completely untested. If someone wants to use QML on SH4, the interpreter will have to do. Change-Id: I609c0646b19120abca5ad1ee893de9ec944d8dbf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix support for default exports in modulesSimon Hausmann2018-08-109-34/+87
| | | | | | | | | | | Default export declarations require a binding setup step at run-time, so we hook it into the ESModule's statement list to make it visible to the code gen visitor. We also reserve local slot zero for the default export. Change-Id: Ie064caad0422b92cfdadbd7d94db72a05e95c0cc Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQuickTableView: remove cacheBuffer from the public APIRichard Moe Gustavsen2018-08-1013-38/+0
| | | | | | | | | | | | | | | | | | As discussed during API review, remove cacheBuffer from the public API. The cache buffer was a feature inherited from ListView to avoid loading a lot of items (and affect performance) when the user started to flick. But now that TableView has support for reusing items, the point of the cache buffer is more or less gone. At least we choose to remove it from the public API until we have better understanding if this is really needed. Note that the cacheBuffer still plays a small role internally, so we don't remove it from the implementation. We want to preload an extra row and column for reuse at start-up, since you often cannot reuse the first row and column during the first flick (they will still be visible on the screen). Change-Id: Ie62835a04ac29a84c9a76151b73fe2f75d9ae844 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: add a 'forceLayout()' function to the public APIRichard Moe Gustavsen2018-08-104-5/+131
| | | | | | | | | | | | | | | | | This function needs to be called from the application whenever it needs to change column widths (or row heights) for the currently visible columns. Changing column widths is done by changing what values the columnWidthProvider returns. But TableView doesn't know that the assigned function has new values to return for the current columns. Calling 'forceLayout()' will inform about this, and trigger a re-layout. Change-Id: I3cf15bbfb522baf93c7e01a34841e54455a098b9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Enable unicode regular expressionsLars Knoll2018-08-1011-24/+30
| | | | | | | Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Update Yarr to the latest version from WebKitLars Knoll2018-08-1059-1694/+6163
| | | | | | | | | | | Updated Yarr to a to commit 4d2a53d60487cb1f8b2a9a1e9f684af336fd7d2c in WebKit. Adjusted the yarr code base to work with our older version of wtf and masm. Change-Id: I04b4593ece051e1d7aa087b87aa08c92595d1098 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Blacklist shadersource-dynamic-shadersource::test_endresultJoni Jantti2018-08-101-0/+2
| | | | | | | | This autotest fails on Ubuntu 18.04. Task-number: QTBUG-69893 Change-Id: If1af2baff0019fb8c9e6e9a30b8a56137ec57366 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* QQuickTableView: rename enforceFirstRowColumnAtOrigo to enforceTableAtOriginRichard Moe Gustavsen2018-08-102-3/+3
| | | | | Change-Id: Ib2a60bd8994bded2299ff96ac73137c9267398fa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Update qtdeclarative-testsuitesJani Heikkinen2018-08-101-0/+0
| | | | | | Task-number: QTBUG-69754 Change-Id: Ib88ad63e13f0598608d9305aeae77fd409e52ef7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQuickTableView: override contentWidth/Height propertiesRichard Moe Gustavsen2018-08-094-6/+117
| | | | | | | | | | | | | | | | | TableView uses contentWidth/height to report the size of the table (this will e.g make scrollbars written for Flickable work out of the box). This value is continuously calculated, and will change/improve as more columns are loaded into view. At the same time, we want to open up for the possibility that the application can set the content width explicitly, in case it knows what the exact width should be from the start. We therefore override the contentWidth/height properties from QQuickFlickable, to be able to implement this combined behavior. This also lets us lazy build the table if the application needs to know the content size early on. The latter will also fix problems related to querying the content size from Component.onCompleted. Change-Id: Ife7ef551dc46cf15d6940e3c6dff78545a3e4330 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add initial basic support for ES6 modulesSimon Hausmann2018-08-0930-73/+905
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The entry point from the parsing perspective into modules is not QV4::Script but QV4::ExecutionEngine::compileModule. For convenience, the ESModule AST node gets a body, which is the statement list connected between the ModuleItemList items that are not import/export declarations. The QV4::Module allocates a call context where the exported variables are stored as named locals. This will also become the module namespace object. The imports in turn is an array of value pointers that point into the locals array of the context of the imported modules. The default module loading in ExecutionEngine assumes the accessibility of module urls via QFile (so local file system or resource). This is what qmljs also uses and QJSEngine as well via public API in the future. The test runner compiles the modules manually and injects them, because they need to be compiled together with the test harness code. The QML type loader will the mechanism for injection in the future for module imports from .qml files. Change-Id: I93be9cfe54c651fdbd08c5e1d22d58f47284e54f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix build warning in tst_drawingmodesTor Arne Vestbø2018-08-091-2/+2
| | | | | Change-Id: Ie6cee9c4cf549eb582f86436908d6f3481026a72 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQuickTableView: change how we calculate content sizeRichard Moe Gustavsen2018-08-093-17/+180
| | | | | | | | | | The current calculations where a bit off. Change it to be precise, and add an auto test to verify the contentWidth/Height ends up correct as the flickable is flicked towards the end of the table. Change-Id: I784a1bba2ea8fddd09cee8ecda7e2089c8b5c74f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* TableView Conway's Game of Life exampleNicolas Ettlin2018-08-099-1/+688
| | | | | | | | | | This new example shows how a Conway's Game of Life implementation can be created with QML and the new TableView component. Change-Id: I940210c5e5a0554e6f052ff109070e69e59cab56 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* JS: Also have modulo return integer 0 when the lhs is 0Erik Verbruggen2018-08-091-4/+7
| | | | | | | | | | | | | | When both operands of a modulo are integers, and the right-hand side is bigger than zero, it is fine to have the left-hand side be 0, as the result is (positive) zero. This also handles the somewhat common case below, where lhs is 0, and where returning a double would result in the slow path to do the actual array access: array[lhs % array.length] Change-Id: I4ca268a08604c3c77a23a92eee193c807696d5ba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Compressed textures: Replace file decoding code with QtGui functionalityEirik Aavitsland2018-08-0912-690/+60
| | | | | | | | | | The functionality for reading and decoding texture files (currently pkm and ktx formats) is now available in QtGui util API. Utilize that instead of keeping equivalent code here. Task-number: QTBUG-67026 Change-Id: Icb7c348eaa51cd15e41031508ef54164fc876c9e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix ASAN warnings about new-delete-size-mismatchSimon Hausmann2018-08-081-1/+9
| | | | | | | | | | | | | | | | | | The optimization of allocating memory for a QML type along with its declarative data in one shot works well and has worked well for many years. However ASAN complains about it, because when the delete expression is called from _anywhere_ on for example a QQuickItem, the size returned by the virtual destructor and then passed to operator delete is less than what was allocated earlier (to include the declarative data structure). Fix this by providing an operator delete for the final QQmlElement class that we _do_ allocate, which is passed along by the virtual destructor. That operator ignores the size and thus silences ASAN. Task-number: QTBUG-58524 Change-Id: Ibb6120e7e07301bb4602130064c5157b21ec2202 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>