aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Use Symbol.toStringTag in Object.prototype.toStringLars Knoll2018-06-046-10/+48
| | | | | | | | | | | | | | | | | | This should make toString comply fully with the JS Spec. Also add a couple of missing Symbol.toStringTag properties. Change-Id: I29e2018b486a0e1d174b58ce7a14f0e42cc78767 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add the start of a Map from ES7Robin Burchell2018-06-019-2/+716
| | | | | | | | | | | | | | | | | | | | Like Set, for the time being, this is baseed on top of ArrayObject: two of them, one for keys, one for values. Again, this goes against the spirit of the spec (which requires nonlinear access), but having the API present is at least a start, and the implementation is easily changed. Change-Id: Idcf0ad8d92eb5daac734d52e8e2dd4c8e0dd5109 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add the start of a Set from ES7Robin Burchell2018-05-3015-17/+662
| | | | | | | | | | | | | | | | | | | | Based on top of an ArrayObject for now, which is admittedly a bit of a cheat and not matching the "spirit" of the spec. OTOH, that makes it easy to write, and is presumably quite lightweight, so perhaps this is acceptable as a starting point. Change-Id: Ibc98137965b3e75635b960a2f88c251d45e6e837 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | qv4arrayobject: Implement Array.from from ES7Robin Burchell2018-05-303-15/+169
| | | | | | | | | | | | | | | | The remaining failures look to be down to the constructor hack, but this gets us a good part of the way there already. Change-Id: I6e57828a56edddd5cb70560b6f50dfc6311c88ae Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | qv4arrayobject: Implement Array.prototype.copyWithin as per ES7Robin Burchell2018-05-302-0/+72
| | | | | | | | | | | | | | The remaining two failures are due to Proxy being missing. Change-Id: I6cc5177cd958d98600cc2ba3b1e1a18bc420530c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Memory manager: Track icAllocator as part of used and allocated memoryUlf Hermann2018-05-301-3/+4
| | | | | | | | | | | | | | This makes it consistent with the memory profiler. Change-Id: I628d03a4c0d079af0940f0e424b779d992b2919d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Simplify with context runtime handlingSimon Hausmann2018-05-294-19/+14
| | | | | | | | | | | | | | | | Instead of duplicating the accumulator-to-object conversion in moth as well as the JIT, let's do that in one place in the runtime. Change-Id: I6870567d3c4fe663e54fece024f1e5e9bde97c35 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Fix possibly unaligned reads in interpreterErik Verbruggen2018-05-291-1/+3
| | | | | | | | | | Change-Id: Icaa6fa5dc0fa9a03127b0c28dfd84b9b3057212e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Minor cleanup with bytecode pointer typesSimon Hausmann2018-05-287-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | Even though we consider the bytecode to be a sequence of unsigned bytes, we store it as const char * (so unsigned except on arm) everywhere, because that makes it convenient to work with QByteArray's constData(). By using const char * consistently we can get rid of at least one more reinterpret_cast. Change-Id: I7a803e4201381c39eec2fdc6497d9bf36a1c2b6b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove unused QV4::Function::code memberSimon Hausmann2018-05-284-7/+3
| | | | | | | | | | | | | | | | Since commit 831ddc54932d2681712ca9fa3e94484ae11d59f7 we always call the interpreter entry function when calling into JS. Change-Id: Ieeb549f6d144f02f0a919759fd31541a7f636f83 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix language change support for qsTr in ListElementSimon Hausmann2018-05-283-21/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We must store translations by binding reference in order to support translation changes. This is similar to commit db15c3455971f47b86078a44a30e0f0a13b54204. [ChangeLog][QtQml] Fix QQmlEngine::retranslate() with ListElement objects that use translation functions such as qsTr. Task-number: QTBUG-68350 Change-Id: Ie5b4d5beb0505a260b524da820c0ce1142893d54 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | The first branch in a ( ? : ) operator can always include the in keywordLars Knoll2018-05-281-1/+1
| | | | | | | | | | | | | | Fix the grammar to be compliant with the spec in this case. Change-Id: I5740c9427db6f5c6c2551d4e23f1f14070e497fb Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Implement toPrimitive() the way the ES7 spec wants itLars Knoll2018-05-287-14/+68
| | | | | | | | | | | | | | | | Add Dat.prototype[Symbol.toPrimitive] and make use of those methods in the toPrimitive implementation. Change-Id: I82a9a94dcae6822100de364373b3f4de1e3d749b Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Rename qv4jit* to qv4baselinejitErik Verbruggen2018-05-284-4/+4
| | | | | | | | | | | | | | So it reflects its contents better. Change-Id: Ie9414117a28e681fbb6220c8cddb41be1481fd44 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move bytecode handler into a separate file, so it can be re-usedErik Verbruggen2018-05-286-529/+650
| | | | | | | | | | Change-Id: I11721025fd3df5efbcc6f6c8cb31fa2f89ead03f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix build with QT_NO_THREADSimon Hausmann2018-05-281-1/+1
| | | | | | | | | | Change-Id: I246460709eb45e1fb5a029ca14dd1d931fb0a329 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | qv4arrayobject: Implement Array.of from ES7Robin Burchell2018-05-272-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One small difficulty: We can't accurately tell whether a thisObject is a constructor or not, so right now we're just swallowing all exceptions and creating an array if they occur. This isn't correct, but it isn't trivial to fix, either: I think we would have to somehow mark our builtins that are constructors, and allow those, but use the array fallback for other builtins, calling user functions and bubbling up if they throw. This is probably good enough for the time being though, as writing something like: function Test() { throw "Foo"; } Array.of.call(Test) ... is probably not very likely, compared to more "usual" use. Change-Id: Ied341a7fa9c3a7fd907e2815c019bc431171ce62 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix multi line string literals using backquotesLars Knoll2018-05-261-1/+1
| | | | | | | | | | | | Task-number: QTBUG-67476 Change-Id: Ia8c6863ad35c8a92298e5dffd750d17628200573 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Cleanup JS stack allocationsLars Knoll2018-05-268-30/+65
| | | | | | | | | | | | | | | | Avoid double writes to the stack, and use scope.alloc() for most allocations on the stack. Change-Id: I8b89273c1b6796d955fc8eeb72c67cff208ef786 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-05-262-4/+3
|\| | | | | | | Change-Id: I626068886d4440b569dbeb1789b1ebfa480000c5
| * Fix build for Android with android-clangLiang Qi2018-05-251-2/+1
| | | | | | | | | | | | | | | | | | | | jit/qv4assembler.cpp:65:11: error: unused variable 'IsIntegerConvertible_Shift' [-Werror,-Wunused-const-variable] const int IsIntegerConvertible_Shift = QV4::Value::IsIntegerConvertible_Shift; ^ Change-Id: I8fd7f03661e9bb7d80c92947cd43841189f148ce Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
| * Fix crash when modifying list model in worker threadSimon Hausmann2018-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we call get() on a model in a worker thread, we may end up creating a ModelNodeMetaObject (aka cacheObject). Subsequent mutation of properties may make us end up in emitDirectNotifies(). However since we can't have bindings in there, we should shortcut/suppress the notify emission, which we can do by checking ddata->context via qmlEngine(). The previous code crashed when qmlEngine() return a null pointer but QQmlEnginePrivate::get(const QQmlEngine *) would attempt to dereference the parameter. Started-by: Slava Monich<slava.monich@jolla.com> Change-Id: I880619c686436c053692faafa5dba2c96c2ace96 Reviewed-by: Robin Burchell <robin.burchell@crimson.no> Reviewed-by: Slava Monich <slava.monich@jolla.com>
* | qv4arrayobject: Implement Array.prototype.includes from ES7Robin Burchell2018-05-254-1/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We also add a sameValueZero helper, to make life easier. Remaining failures: built-ins/Array/prototype/includes/get-prop.js fails (due to missing Proxy) built-ins/Array/prototype/includes/length-boundaries.js fails length-boundaries failure is due to strange treatment of edge number values in Value, I think, I haven't yet been able to rectify that one. Change-Id: Idacca528d88fb052d19a5d244662927f502f20d2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | qv4arrayobject: Implement Array.prototype.fill according to ES7Robin Burchell2018-05-253-0/+55
| | | | | | | | | | | | Task-number: QTBUG-56824 Change-Id: Ib12b9fe5ebdd5375f17cf4927eb9b4e292731932 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | V4: Peephole optimize LoadReg/MoveRegErik Verbruggen2018-05-252-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following sequence: StoreReg rX LoadReg rX Can be optimized by dropping the LoadReg, as the value is still in the accumulator. Also, the sequence: StoreReg rX MoveReg rY, rX Can be optimized to: StoreReg rX StoreReg rY This last optimization prevents one load from the JS stack (reading rX). Both cases are only valid if there is no label on the second instruction. Change-Id: Ibd4543459e1eab4da55e92248eba544c707c5456 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Don't use empty values anymore to store internal freelistsLars Knoll2018-05-245-69/+37
| | | | | | | | | | | | | | | | | | | | | | | | Simply encode them as integers. That works just as well, and allows removing the indexed empty values. This is helpful, to swap the internal representations of undefined and empty values, which in turn will simplify an implementation of correct handling of uninitialized variables (through let/const). Change-Id: I299f975d665309611d1b561f6a0c86b5ca15782a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement Object.is and Object.getOwnPropertySymbolsLars Knoll2018-05-242-8/+41
| | | | | | | | | | Change-Id: Id64f91f6bf1abbcfa28590a43fb4f8673db6730b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>