aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
Commit message (Collapse)AuthorAgeFilesLines
* Clean up finally code genSimon Hausmann2018-06-231-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of emitting GetException MoveReg <returnvaluetemp>, <returnaddress> StoreReg <exceptiontemp> ... LoadReg <exceptionTemp> MoveReg <returnvaluetemp>, <returnaddress> SetException and implicitly relying on MoveReg to not clobber the accumulator, it's cleaner to produce MoveReg <returnvaluetemp>, <returnaddress> GetException StoreReg <exceptiontemp> ... MoveReg <returnvaluetemp>, <returnaddress> LoadReg <exceptionTemp> SetException Change-Id: I3c392ba5fb75aa2ad3ef32aa776fa7acbc25317c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add run time assertion for local handlingSimon Hausmann2018-06-231-0/+2
| | | | | | | | | | | | Commit f44782d0cdbdb800d9c31d5aff712fbf29d52edc fixed the missing call context creation that would lead to language/statements/break/S12.8_A2.js failing. It wouldn't always fail as the invalid cast from the global context to a call context would access memory that happens to be available just for the test. An assertion however will not require us to rely on memory setup. Change-Id: I131a2242004cd5e4d518e58cc9f6a79037f962d2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix remaining failues with qjstest --jitSimon Hausmann2018-06-223-2/+24
| | | | | | | | | | | | | | The codegen generates code like this for the unwind handling: GetException MoveReg <somereg>, <return value reg> SetException In the interpreter, MoveReg doesn't clobber the accumulator, but in the JIT it did. Change-Id: I7a9c8200468115ca37403ec8a0d511210e2b25fd Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix language/expressions/equals/coerce-symbol-to-prim-return-prim.js with JITSimon Hausmann2018-06-222-129/+122
| | | | | | | | | Use the same method for comparing values for the JIT as well as the interpreter, so that the test passes with interpreter as well as the JIT. Change-Id: I2e0249d8e915c816a64adc922839cb71f0e065db Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve GC safety of compare functionSimon Hausmann2018-06-221-5/+32
| | | | | | | | | When comparing values we may end up calling user-defined conversion functions, which in turn may accidentally end up triggering the GC. So any intermediate managed values we fetch, we must save on the JS stack. Change-Id: I810a46f740f22f8fd71a83ed362301cfc822190d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QQmlDebugConnector: Don't complain about new pluginKey if it's unchangedUlf Hermann2018-06-221-1/+1
| | | | | | | | We cannot set the plugin key to a new value if we've already instantiated the plugin. Setting the same value again, is a noop, though. Change-Id: Ib2d2cb3dc20d8d3d7f1673957970f5235e3aeccc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable perf map writing on all platformsErik Verbruggen2018-06-211-3/+1
| | | | | | | | This is controlled by a environment variable, so the code won't be executed if not explicitly asked for. Change-Id: Iec7be17ae1f21f604064e12f35ffe24be0407760 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Check that toObject() didn't failLars Knoll2018-06-211-0/+2
| | | | | | | | Avoid a crash below if the toObject call failed and threw an exception. Change-Id: I82a12c5cd8892c176d345d7f4b0cf3297357f272 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Extend V4's Math object with methods new in ES6Edward Welbourne2018-06-212-5/+206
| | | | | | | | | | Added: acosh, asinh, atanh, cbrt, clz32, cosh, expm1, fround, hypot, imul, sinh, tanh and trunc. Some needed hand-coding for android, whose std:: is defective. Fixed some buglets in existing asin and round in the process. Change-Id: I0858d45430dc0f5944c53723545717ca1ffa6ef7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for ReflectLars Knoll2018-06-215-1/+364
| | | | | | | | Implemented all methods in Reflect, only some smaller bugs left in there. Change-Id: I53d2304d0e59566aec64e200cd995e02afcfc33e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for function calls with spreadLars Knoll2018-06-2110-42/+235
| | | | | | | | | | | Function calls with thread are modelled by pushing an empty value in front of every argument that requires spreading. The runtime methods callWithSpread and constructWithSpread then take care of spreading out the arguments. Change-Id: Ie877c59d3d9d08fc5f20d7befb7153c7b716bf30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of LoadElement and LoadProperty instruction overloadsLars Knoll2018-06-218-87/+34
| | | | | | | Always use the overload where the value is in the accumulator. Change-Id: I6a3d81fea7aae957e0cf6efd123d7739f8880c95 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify DeleteMember and DeleteSubscript instructionsLars Knoll2018-06-219-92/+34
| | | | | | | | The delete operator is rarely used, so it's simpler to unify these into one DeleteProperty instruction. Change-Id: I8c0d4455b35efb03db2ab0010df70030d774a6ae Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the unused JumpEmpty instructionLars Knoll2018-06-218-37/+0
| | | | | Change-Id: I117687939e0f02d801dbad8de7761b4c799f2035 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for spread expressions in Array literalsLars Knoll2018-06-212-35/+140
| | | | | Change-Id: I613d853dbb34d86ebedd871e9676d3206f1e3349 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Provide API to access singletons associated with a QQmlEngineRichard Weickelt2018-06-216-9/+142
| | | | | | | | | | | | | | | | | | | This patch adds allows C++ code to retrieve the instance of a registered singleton type. Until now this required a deturn via QML expression. Two methods are added to QQmlEngine: A generic one that encapsulates all singleton objects in a QJSValue and a template function for QObject-derived singleton types. An additional convenience function is added to query the QML type id. This function may also be used for other purposes in the future. [ChangeLog][QtQml][QQmlEngine] Added API to access singletons associated with a QQmlEngine. Task-number: QTBUG-39970 Change-Id: I67c132ede35f80b9aaf1c5e5456715cf4f1b0848 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Variables declared in strict eval code don't all escapeLars Knoll2018-06-211-1/+1
| | | | | | | | | eval() calls in strict mode code create their own context, so even though we don't have a parent context, those variables do not escape, and can be allocated on the stack. Change-Id: Iea1853452fe1f792468fd6108851f04a1acf9b66 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QQmlDelegateModel: even for QAIM, only use first column by defaultRichard Moe Gustavsen2018-06-212-4/+13
| | | | | | | | | | | | | | | | | | | In 2f9afadd5d9b4899397dca, we introduced a change in QQmlAdaptorModel so that a QAIM model report that it contains "rows * cols" number of model items, and not just "rows". This was needed, otherwise TableView would only display the first column of such models. It turns out, however, that also ListView will now detect that a QAIM contain more items than just the items in the first column. The result will be that it ends up adding all the other columns underneath the first column in the view. To avoid this unforseen change, this patch will revert this logic, and instead add a private variable that can be set if the new behavior is wanted (e.g by TableView). Change-Id: I8c13da99f05e2f922362e498d1fa1779cdbd0d72 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix const expressions containing destructuring patternsLars Knoll2018-06-212-2/+1
| | | | | | | | Don't throw a syntax error when encountering a destructuring pattern. Change-Id: I93250a2963d2d50ff61d725229e1b51be17689e9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix array destructuring nested in a rest elementLars Knoll2018-06-212-24/+23
| | | | | Change-Id: I3a8c15fe221bff04a3b9b21ed8c0b06c04770a3d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix more issues with destructuringLars Knoll2018-06-214-30/+50
| | | | | | | | | | Fix destructuring targets that are complex lhs expressions. There are still some failures remaining, but this fixes another larger chunk of test cases. Change-Id: Icf08f42d7c70d4e81be5d5d2e27ebe6249d25467 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove some dead codeLars Knoll2018-06-213-28/+0
| | | | | | | maxNumberOfArguments isn't used anymore. Change-Id: Ibb891101b971b4b0b01be7897e6d1490e1dde62c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix handling of elisions in destructuring expressionsLars Knoll2018-06-215-24/+17
| | | | | | | | We need to iterator over elisions at the end, as those could trigger side effects by calling iterator.next() Change-Id: Ieb5fa3562b6e60fdf179fa228510b2eeaaf9da30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix more test failures for destructuring expressionsLars Knoll2018-06-211-3/+6
| | | | | | | | Fix parsing of var { x = function(){} } = ... Change-Id: I524e39c7a556c392a5359eafc445b59020ccadf2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Correctly set the name of anonymous functions in most casesLars Knoll2018-06-211-0/+6
| | | | | | | | If the anonymous function is bound to an identifier, set the name to the identifier. Change-Id: Idbb3170210e6f91cca3c9bd36b2b6ddcb3a50c7b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Allow a trailing comma in parameter listsLars Knoll2018-06-211-8/+19
| | | | | | | | This got changed in ES8, but let's already take this in now, as there are quite a few tests checking this behavior. Change-Id: I73f86b8fd8a681881bcc9cc3132bef1589d5194f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix some of the finer details with regards to CompletionsLars Knoll2018-06-213-11/+121
| | | | | | | | | | | JS completion records have some finer details that can only be seen when using eval(), where the value of the completion record becomes important. Fix most of those cases to be compliant with the spec. Change-Id: I0c8105a8e778de7be3aea151d1bd64243aea067c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Always generate QML cache files in the cache directory, never in sourcesRichard Weickelt2018-06-212-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | This patch eliminates the annoying behavior of the QML compiler that .qmlc cache files are stored alongside the sources. When cache files are generated at run-time, then they are always stored in the application's local cache directory defined by QStandardPaths::CacheLocation (qmlcache subfolder). The application's uninstaller is responsible for cleaning up the cache directory during removal. If explicitly precompiled QML files exist at the source location, then they are loaded from there and no cache file is being generated. Storing cache files in the source directory is as problematic as an in-tree build. The cache files pollute the source directory and create unnecessary inconvenience with version control systems. [ChangeLog][QtQml][QQmlEngine] QML cache files are now always stored in the application's cache directory when being generated at run-time. If precompiled QML files exist at the source location, then they are loaded and no cache file is being generated. The application's uninstaller is responsible for cleaning up the cache during removal. Task-number: QTBUG-56150 Change-Id: I5a64b7f958e782e03c71873a82cef4b07011cbf1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rework unwind handlingLars Knoll2018-06-2113-430/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | The old code was rather convoluted and expanded to quite a bit of bytecode. It was also very hard to fix some of the remaining issues with unwinding in there. The new code handles unwinding a bit differently. Basically, we now have three instructions to do what the spec requires. SetUnwindHandler is the same as the old SetExceptionHandler instruction. It basically tells the runtime where to jump to to handle any abrupt completion (ie. throw/break/continue/return) that requires unwinding. UnwindToLabel is a new instruction that is used for unwinding break/continue/return statements. It takes two arguments, one telling the runtime how many levels to unwind and the second a target label to jump to when unwinding is done. UnwindDispatch is the third instruction and is invoked at the end of each unwind block to dispatch the the parent unwind handler if required and thus implement the support for the levelled unwinding. Change-Id: I079a39d0d897b3ecc2f0dc631ca29b25eae05250 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devSimon Hausmann2018-06-194-14/+9
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/qml/compiler/qv4codegen.cpp tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp Change-Id: I010505326d76ee728ffe5fbd4c7879f28adadb12
| * V4: Set argumentsCanEscape when debuggingUlf Hermann2018-05-301-0/+2
| | | | | | | | | | | | | | | | | | This causes the updated arguments to be reported to the debugger when they are overwritten in the function body. Task-number: QTBUG-68534 Change-Id: I30c22d31aa97da0d58a4bbaaa032180a919669a8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Formals come after locals in the CallContextLars Knoll2018-05-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | The method updating the internal class for a CallContext messed up the order between locals and formals, leading to wrong name lookups for signal handlers taking implicit arguments Task-number: QTBUG-68522 Change-Id: I36d55b3b0cfe9af6397455782551498b7ddb940a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Fix a crash in the modulus operationLars Knoll2018-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | INT_MIN % -1 crashes in C++ with an arithmetic exception, so avoid passing negative numbers into the integer operation, use fmod() instead. Task-number: QTBUG-68513 Change-Id: Ib5a37b55a0f9d41a84c7e6c00ea3f87622155de5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Remove old pre-QFileSystemEngine-rewrite codeErik Verbruggen2018-05-281-9/+1
| | | | | | | | | | | | | | | | | | | | | | Once upon a time, calling stat directly on Unix-alike systems gave a significant speed-up compared to calling QFile::exists. These days not so much. It also breaks any use of custom subclasses of QAbstractFileEngine. Task-number: QTBUG-68463 Change-Id: Icae8a16880723dee13c460cfdb15b03dc63c1371 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Ensure we read context properties before the global objectLars Knoll2018-06-173-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also global variables declared in a .pragma library script should not be saved in the global object, as the script has it's on context where those variables live. [ChangeLog][QtQml] Properties of the JS global object will now be looked up after local properties in the QML object. This can lead to runtime incompatibilities if your qml file is named the same as a property of the global object (e.g. Date.qml). Task-number: QTBUG-51581 Change-Id: I108aea4c76d088ca8c2124700f91e8eac3fc19f3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QQmlDelegateModelItem: move row and column up to the base classRichard Moe Gustavsen2018-06-093-31/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change 8c33c70 injected row and column (alongside index) into the QML context of a delegate when the view had a QAbstractItemModel as model. Rather than only inject those properties when using QAIM, this patch will move the code to the base class. This way, if a view uses e.g a javascript list as model, row and column is still be available. This is useful, since then the delegate can bind to both row and column regardless of what kind of model the view uses. In the case of a list model, the column property will always be 0. Change-Id: I1d9f11c0b7d7a5beb83198184ba12cc1e48cd100 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQmlDelegateModelPrivate: refactor release()Richard Moe Gustavsen2018-06-091-17/+16
| | | | | | | | | | | | | | | | | | | | | | Change the structure a bit, so it becomes a little less nested, and to make some "clean" space for the patch that handles recycling if items, which will add an extra section into this function in a subsequent patch. Change-Id: Ib94142827373d6894b508718f58e9f5e61e8c8e1 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* | Ensure identical behavior for singleton types defined in C++ and QMLRichard Weickelt2018-06-083-29/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Singleton types defined in C++ have no QML context. Therefore, both qmlContext(obj) and qmlEngine(obj) return zero. Although documented, this behavior is surprising and inconsistent with singleton types defined in QML. The current behavior was decided upon in QTBUG-23116. This patch puts C++ singleton types into a sub-context of the root context by default, just like it is the case for QML-defined singleton types. This doesn't cause any harm, but avoids surprises. It also fixes a bug in QmlTypeWrapper that returned an invalid QVariant for QJSValue singletons. Task-number: QTBUG-38583 Change-Id: Id1d48ecdc49f0e22714857a1b49b457885889e5e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QQmlDelegateModelAttached: factor out resetCurrentIndex()Richard Moe Gustavsen2018-06-042-8/+16
| | | | | | | | | | | | | | | | | | | | When we in subsequent patches start to recycle items, we'll somtimes need to reset m_currentIndex after construction time. This patch will not change any logic, but just move the code that calculates m_currentIndex into a separate function. Change-Id: Ic61825e9cf4b6c0fdb2dfcab1ad9b582ef4413ac Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QQmlDelegateModel: factor out addCacheItem()Richard Moe Gustavsen2018-06-042-4/+9
| | | | | | | | | | | | | | | | | | | | | | The code for adding an item to the cache will also be needed in subsequent patches for recycling items, so factor it out into a function alongside removeCacheItem(). This patch will not change any logic, it will just move the code out into a separate function. Change-Id: I199a4e1c823ded29c576afba12cddfa27a543431 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Fix typoRainer Keller2018-06-041-1/+1
| | | | | | | | | | Change-Id: Ide31c25444e4ced23c024400d34022d3b1f4ff00 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Show property name in error messageRainer Keller2018-06-041-1/+1
| | | | | | | | | | Change-Id: Ic78a38200959e39375753624af13c6edebe4e1f1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Rename SetExceptionHandler to SetUnwindHandlerLars Knoll2018-06-0410-27/+27
| | | | | | | | | | | | | | | | | | It's being used for more than just exception handling, unwinding for return or break/continue statements also goes through those handlers. Change-Id: I145c7909540a1adca431de6a98d9c115ddf23612 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | skip Symbol properties in for-in loopsLars Knoll2018-06-041-1/+2
| | | | | | | | | | Change-Id: Id161269329d3cd34357580730999e4dee5b0135f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix creation of object literalsLars Knoll2018-06-0412-179/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our method to create object literals wasn't compliant with the ES7 spec, as we would in some cases re-order the properties. This violated the spec which required properties to be created in order, so that for-of would also iterate over them in creation order. As a nice side effect, this simplifies the code and gets a couple of test cases using computed property names to pass. Task-number: QTBUG-62512 Change-Id: I6dfe004357c5d46a0890027f4fd9e2d1e1a2a17a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement ToPropertyKey() from the ES7 specLars Knoll2018-06-044-14/+26
| | | | | | | | | | | | | | and use it where required. Change-Id: I309ca61e0360b26428fc2ea5a2eea47c8e0632a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix remaining test failures with the ** operatorLars Knoll2018-06-042-2/+7
| | | | | | | | | | Change-Id: I98da5b552747d6d0b363d83ecb4c408c66a2667b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | The length property of RegExp should be configurableLars Knoll2018-06-041-1/+1
| | | | | | | | | | Change-Id: Ie19dc556d13081a1b750695e81d6b4e5a6b3afac Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | TypedArray.prototype[Symbol.iterator] and .values are the same functionLars Knoll2018-06-041-2/+7
| | | | | | | | | | | | | | | | Those two properties are supposed to point to the same function object according to ES7 spec. Change-Id: Ic0917aa28836ad8d665d2177f2f5c2a8d8ad3f6d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix Object::defineAccessorPropertyLars Knoll2018-06-041-3/+16
| | | | | | | | | | | | | | | | Create setter and getter functions with proper names and make the property configurable to be compliant with the ES7 spec. Change-Id: I13b24f540fdd3261cf29b660aa3393d661acacfd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>