aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Improve RegExp.prototype[Symbol.match] implementationLars Knoll2018-08-153-15/+67
| | | | | Change-Id: Id632a4f4648f68f3b46d31f84e4ee05c86391f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup RegExpObjectLars Knoll2018-08-1510-148/+244
| | | | | | | | | | | 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-152-46/+98
| | | | | Change-Id: Id94c3cc25835b53bae08713cdd8f2e384d907690 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix explicit export of imported variablesSimon Hausmann2018-08-142-3/+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-149-45/+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-141-1/+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-141-1/+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-144-4/+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-142-12/+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-132-10/+9
| | | | | | | | 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>
* 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-108-21/+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-102-25/+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-102-5/+23
| | | | | | | | | | | | | | | | | 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-1010-10/+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>
* QQuickTableView: rename enforceFirstRowColumnAtOrigo to enforceTableAtOriginRichard Moe Gustavsen2018-08-102-3/+3
| | | | | Change-Id: Ib2a60bd8994bded2299ff96ac73137c9267398fa Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: override contentWidth/Height propertiesRichard Moe Gustavsen2018-08-093-6/+98
| | | | | | | | | | | | | | | | | 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-0925-12/+812
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* QQuickTableView: change how we calculate content sizeRichard Moe Gustavsen2018-08-091-17/+17
| | | | | | | | | | 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>
* 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>
* Add missing header guardJędrzej Nowacki2018-08-081-0/+5
| | | | | Change-Id: I58aaa65047c3b7244cb69a84117b41453ff9ee0a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix ASAN error about new-delete-size mismatchSimon Hausmann2018-08-081-1/+4
| | | | | | | | | | When object cache for list model items is a plain QObject that was allocated together with declarative data in one go. Since we control the site of deletion, we can call the destructor manually as well as operator delete to avoid the ASAN error. Change-Id: I346d6ef34876cb495573ba9cfbc68be92dd937ab Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* QQmlTableInstanceModel: remove false assertRichard Moe Gustavsen2018-08-071-6/+18
| | | | | | | | | | | | | | There current assert turned out to not be valid for all cases. If the model is currently incubating an object, m_modelItems list will contain it, but the view will not. So be more specific what we check. Also, we need to release the object for items that are being incubated. The code snippet for doing that is more or less the same as found in the destructor of QQmlDelegateModel. Change-Id: I84b4286a037b27ad809c3a63afed94ce61febc19 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: don't access the model from the destructorRichard Moe Gustavsen2018-08-072-20/+15
| | | | | | | | | | | | | | Calling clear() from the destructor is problematic, since clear() will try to access the application model, which has typically already been destructed at that point. Instead we should just clean-up any local resources. Since we don't really have a need for the clear() function anymore, we move the code where it belongs: into the beginRebuildTable() function. Task-number: QTBUG-69554 Change-Id: Ic43704c71407e805427de27cf10dbdeeae475ba8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTableView: improve draining of reuse poolRichard Moe Gustavsen2018-08-073-16/+56
| | | | | | | | | | | | It turns out that using a maxTime of 2 when draining the pool was a bit naive. If e.g the width of the table is greater than the height, it starts releasing pooled items to quickly. So change the logic to be more dynamic, and to calculate what the maxTime should be based on the geometry of the table. Change-Id: Ifeed62789575f98cff063f550f45eb54ef312fdb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Minor cleanupSimon Hausmann2018-08-062-5/+5
| | | | | | | | | | | | | | | Rename bool String::compare(const String *other) to the slightly more self-explaining bool String::lessThan(const String *other) as the returned boolean value does not relate to equality. Change-Id: Ia7b1a7f47beca0659fb199c0c9d49951468ad03d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQuickWindow: obey AA_SynthesizeMouseForUnhandledTouchEventsShawn Rutledge2018-08-061-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, AA_SynthesizeMouseForUnhandledTouchEvents has only affected behavior of QGuiApplicationPrivate::processTouchEvent, but had no effect in Qt Quick. QQuickWindow also accepts the touch event just to make sure that QGuiApplication will not synthesize mouse from touch, because it would be redundant: QQuickWindow does that for itself. Now we make it have an effect in Qt Quick too: skip mouse synthesis if it is set to false. This provides a way to simplify the event delivery. If you set it false, then you cannot manipulate old mouse-only items like MouseArea and Flickable on a touchscreen. (You can of course use event handlers for that.) [ChangeLog][QtQuick][QQuickWindow] You can now disable touch->mouse event synthesis in QtQuick by calling qGuiApp.setAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents, false); This will simplify and speed up event delivery, and it will also prevent any and all interaction with mouse-only items like MouseArea and Flickable on a touchscreen. Task-number: QTBUG-52748 Change-Id: I71f1731b5abaeabd9dbce1112cd23bc97d24c12a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Mark non-notifying properties in event types CONSTANTShawn Rutledge2018-08-062-43/+43
| | | | | | | | | | | | | | Event objects are valid only within the context of a JS callback that receives the object as a signal parameter, and the object will not change during the runtime of that callback. It's not true that the properties will never change, because event objects are pooled and reused; but the QML is not allowed to keep a reference to an event, so the property changes during this reuse are not meant to be seen. QQuickMouseEvent is similar, and its properties were already marked CONSTANT. Change-Id: I4985e4a27bf192779629311eb8c6c1f63d22df3e Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Setup the prototype correctly when subclassing error objectsLars Knoll2018-08-064-20/+21
| | | | | Change-Id: I5e394ef8d4d6d87bedb26070d51660e3ebe3ab1b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix some details in class initializationLars Knoll2018-08-062-1/+18
| | | | | Change-Id: Ib8a76362686f1bbba49daca59fa4a30773150103 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.rawLars Knoll2018-08-062-0/+43
| | | | | Change-Id: I331fd4d114f68fb5cb71186813f851af25539ffa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify chunk sweeping codeSimon Hausmann2018-08-051-17/+11
| | | | | | | | | Instead of collecting the empty chunks after sweeping in a separate vector, partition the chunks into non-empty and empty ones and erase the second half after freeing them. Change-Id: I7896c167b8b09a01b124dcdcb1eba8ddc0eef7f4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crashes when GC'ing internal classesLars Knoll2018-08-041-3/+11
| | | | | | | | | | | | | The destroy() method of internal classes tries to reference it's parent class to unregister itself there. This could go wrong if the parent class had been destroyed already and it's associated memory been freed by the GC. Fix this by only freeing actual memory at the end after the sweeping has been done. Change-Id: I85beb4792038d5a1a5708f5897af2c1950f8b8d1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for ownKeys in Proxy objectsLars Knoll2018-08-044-3/+162
| | | | | Change-Id: I7edee88e4252e6ed0d2666c3f633bb595cb0e831 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for Object.valuesLars Knoll2018-08-042-0/+30
| | | | | Change-Id: I1f2507afb1c6f148d129325088a7db9d9b6fc98e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for Object.getOwnPropertyDescriptorsLars Knoll2018-08-042-0/+31
| | | | | Change-Id: I9f80c583a5c238997b7141e11f4302a9e19c5499 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Object.entries()Lars Knoll2018-08-042-0/+41
| | | | | Change-Id: Ia06813a7cac5bd8be99e9f6ab3cd30eac26e499f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify ObjectIterator::nextLars Knoll2018-08-045-71/+38
| | | | | | | Use PropertyKey instead of two out pointers Change-Id: I4f57bcb36fd412f19f0ed116042f7b094b5785dc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Adapt to QMetaObject::d internal changesThiago Macieira2018-08-041-1/+1
| | | | | | | | qtbase is changing the type of the QMetaObject pointers to use a wrapper class. Change-Id: Id2be776c7ae0467c9d9ffffd15431f7b1b005c09 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix crash in ↵Simon Hausmann2018-08-031-1/+2
| | | | | | | | | | | | | language/statements/class/syntax/class-body-method-definition-super-property.js with JIT CallValue was changed to pass undefined as the this object, instead of a null pointer. This also needs to be done from the other call site used by the JIT, Runtime::method_callValue. Amends commit d31541fd9d7d52ef3eae29e7e5d36733d7f55375 Change-Id: I0e2c2542ae96a88bb7e6e24d012f7f7fe72aeb80 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crash of language/expressions/object/setter-super-prop.js with JITSimon Hausmann2018-08-031-1/+1
| | | | | | | | | | | Generally super.foo = bar calls the storeSuperProperty run-time method, which expects the engine as the first parameter, not the function pointer. Amends commit d31541fd9d7d52ef3eae29e7e5d36733d7f55375 Change-Id: Ic0c933e855066273a635fe62ad88316c75cb8f45 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix language/expressions/class/scope-name-lex-close.js crashing with the JITSimon Hausmann2018-08-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | With a reduced test case like this: var C = 'outside'; var cls = class C { method() { return C; } }; cls.prototype the class expression is expected to return the reference to the class in the accumulator, so that the cls = assignment can store it. Between that we have to deal with the {} block, a ControlFlowBlock instances in the code generator. That one will - among other things - issue a PopContext instruction after the class creation instruction. With the JIT that clobbers the accumulator unfortunately, causing a bogus value being stored in the global object under "cls". Consequently the lookup for "cls" crashes. Change-Id: I6056b352f9d8f42fa65afe4aefcd233c3ccf31ab Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Minor cleanup in CompilationUnit::linkToEngineSimon Hausmann2018-08-032-27/+20
| | | | | | | | | This is the only call-site for linkBackendToEngine, which used to be a virtual function. There's no need anymore for an indirection, so we can inline the code. Change-Id: I79fe3d5a9c65cc8c05f108065017465270999de1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>