aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* V4: Collect trace information in the interpreterErik Verbruggen2019-01-251-0/+10
| | | | | | | | | | | | | | | Collect type information about values used in a function. These include all parameters, and the results of many bytecode instructions. For array loads/stores, it also tracks if the access is in-bounds of a SimpleArrayData. Collection is only enabled when the qml-tracing feature is turned on while configuring. In subsequent patches this is used to generated optimized JITted code. Change-Id: I63985c334c3fdc55fca7fb4addfe3e535989aac5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-221-0/+5
|\ | | | | | | | | | | | | | | Conflicts: .qmake.conf tests/auto/quick/qquickpathview/tst_qquickpathview.cpp Change-Id: Ic1f5e219a255d0613f7654368a5ce3eccb8f0ee9
| * Annotate stack traces when frames are elided through tail callsErik Verbruggen2019-01-151-0/+5
| | | | | | | | | | | | Task-number: QTBUG-72407 Change-Id: I98b96852309fc783a945797185f666196513d24b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-171-1/+1
|\| | | | | | | Change-Id: Ic5a0c02ab45aac18c218dbeb8cd4b4cd3b609eb6
| * Don't crash when compiling with QT_FORCE_ASSERTS enabledLars Knoll2018-11-021-1/+1
| | | | | | | | | | | | Change-Id: I9af3dc69cc5baf1c35e836345590baf5b55b1bed Fixes: QTBUG-70937 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-061-0/+15
|\| | | | | | | Change-Id: I85be5e6ef173fa733d7febd3209164bb31762e0d
| * Add convenience functions for creating and inspecting error objectsAllan Sandfeld Jensen2018-10-301-0/+15
| | | | | | | | | | | | | | | | | | Serves to simplify porting from QtScript by replacing QScriptContext::Error and QScriptContext::throwError(). Change-Id: I4bfe404c358c50aaf3b5469a4304fec97552bf24 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-10-121-0/+42
|\| | | | | | | Change-Id: I0ad1a3aa3a211ef86c4baf605361de860266dde1
| * QML Engine: Support for JavaScript PromisesValery Kotov2018-10-111-0/+42
| | | | | | | | | | | | | | Support for JavaScript Promises. Change-Id: I90ce328b35f3bdf3fd666a8829f22b5d56b6f861 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Teach QML that it is possible to treat custom QObjects as QObjectJędrzej Nowacki2018-10-081-3/+7
| | | | | | | | | | | | | | It is always better to treat a QObject child as QObject then a QVariant. Change-Id: I4ac069e85232dd4d1411e325bc5b858bd001f9a6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for QSequentialIterable in QMLJędrzej Nowacki2018-10-081-0/+21
|/ | | | | | | | | That means that now QML understand many sequential value types and it is able to convert it to a JS array. Fixes: QTBUG-60338 Change-Id: I46943b7c130296bb64c23008ce2e52a55d7f019d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Speed up instanceof operationsLars Knoll2018-09-271-5/+14
| | | | | | | | | | | Introduce a shortcut if the rhs is a functionobject with the regular function proto as prototype. Add an optimized instanceOf implementation when we already have some checks done, and inline some methods. Change-Id: Iab9b648ae7bbec749b319e883b6ae90a23875454 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Unify layout of function objectsLars Knoll2018-09-271-6/+12
| | | | | | | | | | Ensure we have the proto property at always the same place. This will be used in a subsequent commit to optimize accesses to the prototype property e.g. when doing instanceof operations or constructor calls. Change-Id: I6e9a19e0b7d0e8ab583648a60d1978f5cf838b06 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Get rid of remaining assumptions about setter being next to gettersLars Knoll2018-09-271-27/+33
| | | | | | | | The only place where we now assume that getters and setters are next to each other in the MemberData is in the internal class. Change-Id: I3285f3abb1cbfe051853e808339cd360eb602262 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Refactor InternalClass::find()Lars Knoll2018-09-271-1/+1
| | | | | | | | | Specialize find() into several methods for different purposes. Prepares for further cleanups and being able to split up getter and setter for accessor properties. Change-Id: Id4ec5509ac1a1361e2170bbfc2347b89b520c782 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Better inheritance structure for functionsLars Knoll2018-09-231-3/+4
| | | | | | | | Give Arrow functions their own representation. This also prepares for further optimizations especially for the instanceof operator. Change-Id: I1f70c0271169a237e1acdeb7fe855be957ba2ea5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-5/+5
| | | | | | | | | | | | Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for yield*Lars Knoll2018-09-071-0/+1
| | | | | Change-Id: I5b054b59519ed825459a5b0b0a7cd2c6fc8a3797 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't define a prototype property for most functionsLars Knoll2018-09-041-4/+0
| | | | | | | | Only functions that are constructors should have a prototype property. Change-Id: Ifcf6f8b6c38de055d871d57ada38a23432974263 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for WeakSetLars Knoll2018-08-281-0/+5
| | | | | Change-Id: I5cee2bf0c6a45ad2c14b52e1a4fc5ef015e01042 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for WeakMapLars Knoll2018-08-281-0/+5
| | | | | Change-Id: Id23e80fe5918ba7dc897568123bf3db4d35e9092 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Partial Atomics supportLars Knoll2018-08-261-0/+2
| | | | | | | | | | Implement support for basic atomic operations on SharedArrayBuffers. Half of the methods still need a proper implementation. Change-Id: Ia88da358e0c2ae6d28e9bcc1feb8980b6f51a812 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up the code handling reads and writes into typed arraysLars Knoll2018-08-251-3/+3
| | | | | | | This is a preparation for supporting atomic operations on Typed arrays. Change-Id: I91d00f3aee3f35fc22e74ee010ed2cbec2d46aae Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for SharedArrayBufferLars Knoll2018-08-251-0/+5
| | | | | | | | We'll still need to hook this up with Worker threads to become useful. Change-Id: Iedae7307edd76368aeba163731856ebe9b32c6b6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for call/callAsConstructor in Proxy objectsLars Knoll2018-08-231-0/+1
| | | | | | | | | | | This adds the last missing piece of functionality for Proxy objects. Also fix a bug where we ignored the newTarget in Reflect.construct. Change-Id: I2443470f2ca13fb6223768c3bf6bdc3766bb4fc3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix toLocaleString implementations in (Typed)Array.prototypeLars Knoll2018-08-231-0/+1
| | | | | Change-Id: Idcabd68b1651ad3cae315a16cb0e1361cba21253 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for compiling ES modules ahead of timeSimon Hausmann2018-08-171-25/+28
| | | | | | | | | | | | This is also pretty straight-forward by adding .mjs as supported extension in the qmake and cmake support. This also tweaks qv4engine.cpp to share the same module compilation function across all code paths. Change-Id: Ia0e23c78a794f2330ecf8f991ee6ea948f4ac89d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add support for disk caching of ES modulesSimon Hausmann2018-08-171-5/+9
| | | | | | | | | | | | | | | | | | 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-171-1/+23
| | | | | | | | | | | | | | | | | 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>
* Fix order of own property names of module namespace objectsSimon Hausmann2018-08-151-1/+1
| | | | | | | 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 spec compliance for the RegExp constructorLars Knoll2018-08-151-0/+2
| | | | | Change-Id: I767b27faab912e91962797ca154d929473113cc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix some details in RegExp handlingLars Knoll2018-08-151-1/+1
| | | | | Change-Id: If9f7c07ea657ba8503b9188a7b77e301f23423ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve RegExp.prototype[Symbol.match] implementationLars Knoll2018-08-151-0/+5
| | | | | Change-Id: Id632a4f4648f68f3b46d31f84e4ee05c86391f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup RegExpObjectLars Knoll2018-08-151-16/+1
| | | | | | | | | | | 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>
* Improve error handling for non-existent file importsSimon Hausmann2018-08-141-1/+3
| | | | | Change-Id: Ic043d30738c97836cf6afada6ee7cade23bf50f9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Enable unicode regular expressionsLars Knoll2018-08-101-1/+4
| | | | | | | Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add initial basic support for ES6 modulesSimon Hausmann2018-08-091-0/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Setup the prototype correctly when subclassing error objectsLars Knoll2018-08-061-2/+2
| | | | | Change-Id: I5e394ef8d4d6d87bedb26070d51660e3ebe3ab1b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix a couple of test failures related to error objectsLars Knoll2018-08-021-1/+1
| | | | | | | | Set up the prototype chain for error objects correctly, and make them inherit from the right classes. Change-Id: I7bb12b3bb285950a1bff25e5c62954287a95970a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix the remaining test failures with non strict arguments objectsLars Knoll2018-07-301-37/+0
| | | | | Change-Id: Ib50f602263dd0146d792fb3d12bd5971585fda30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix class members that are generatorsLars Knoll2018-07-031-0/+2
| | | | | | | Properly support member functions that are generators in classes. Change-Id: I5fc8d5b58a17c61a446b43d6576bb83de5ecd920 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the C++ and JS stack frame definitions into it's own fileLars Knoll2018-07-031-31/+1
| | | | | Change-Id: I86e89e07197aec6071809c2d32bd5c98cb7ac6f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove ExecutionEngine::setCurrentContext()Lars Knoll2018-07-031-0/+5
| | | | | | | | It's unused and shouldn't exist. Also de-inline currentContext() to avoid a dependency on the CppStackFrame in the header. Change-Id: I44724f8097883dc1b1064430778f45f7811460df Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of Value::asArrayIndex()Lars Knoll2018-07-021-4/+3
| | | | | | | | | | | It was only used in a few places now, that can be replaced by either using a PropertyKey, or by limiting the fast path optimization in the runtime to array indices smaller than INT_MAX. Since there are less branches this should even be faster for pretty much all use cases. Change-Id: Ib4f2f2f3e27f14ad180b810546e82ac83170b106 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up the property key API in StringOrSymbolLars Knoll2018-07-021-31/+33
| | | | | | | | | | | | | | Get rid of makeIdentifier(), as toPropertyKey() will take care of it. Rename identifier() to propertyKey() and check that the key is valid. Remove String/StringOrSymbol::asArrayIndex(), we don't need it anymore. Change-Id: I3c490fabc1475c9ea288b49b1638b6fa1bc237b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-2/+2
| | | | | | | | This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a MemberFunction function objectLars Knoll2018-06-261-0/+4
| | | | | | | | | | | Member functions in ES7 can not be called as constructors and will throw a type error when trying. Some more fixes are needed here, as they also do not have a prototype property. Change-Id: Ieb920163acaa68d4ff0ff73ae4c1015e883b406f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add basic support for EcmaScript classesYulong Bai2018-06-261-0/+2
| | | | | | | | | | | | | | | | Most of the class creation is done inside the runtime in the CreateClass method. Added a corresponding instruction to the interpreter and jit. The compiled data now contains an array of classes containing the compile time generated layout of the class. Currently, classes without an explicit constructor and classes with inheritance are not supported. Done-with: Yulong Bai <yulong.bai@qt.io> Change-Id: I0185dcc1e3b0b8f44deff74e44a8262fc646aa9e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-06-251-6/+0
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/5.11' into devUlf Hermann2018-06-251-6/+0
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/quick/handlers/qquickhandlerpoint.cpp src/quick/handlers/qquicksinglepointhandler.cpp tests/auto/qml/ecmascripttests/test262 Change-Id: I8908ec8c6116ca626fbd269af7625d4c429429ca