Commit Graph

137 Commits

Author SHA1 Message Date
Qt Forward Merge Bot 499c6ed78d Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I3058a6b9347d7ca2a0c04a58cb030ae5c47de415
2020-01-15 12:18:57 +01:00
Qt Forward Merge Bot 8a22c92b55 Merge remote-tracking branch 'origin/5.15' into dev
Conflicts:
	src/imports/folderlistmodel/plugin.cpp
	src/imports/layouts/plugin.cpp
	src/imports/localstorage/plugin.cpp
	src/imports/models/plugin.cpp
	src/imports/particles/plugin.cpp
	src/imports/qtqml/plugin.cpp
	src/imports/qtquick2/plugin.cpp
	src/imports/shapes/plugin.cpp
	src/imports/statemachine/plugin.cpp
	src/imports/testlib/main.cpp
	src/imports/wavefrontmesh/plugin.cpp
	src/imports/window/plugin.cpp
	src/imports/workerscript/plugin.cpp
	src/qml/jsruntime/qv4sequenceobject.cpp
	src/qml/qml/qqmlengine.cpp
	src/qmlmodels/qqmlmodelsmodule.cpp
	src/qmlmodels/qqmlmodelsmodule_p.h
	src/qmlworkerscript/qqmlworkerscriptmodule.cpp
	src/qmlworkerscript/qqmlworkerscriptmodule_p.h
	src/quick/items/qquickitemsmodule.cpp

Change-Id: I5f1fbc3d00e8f583d2c89afc5389de84d68633a7
2020-01-14 11:24:11 +01:00
Ulf Hermann e5ddcab385 SequenceObject: Better message when trying to write readonly container
Before it would only output "Type Error".

Change-Id: Ibd3a85f327c3ce8c58295c7e900c516b77c85a2b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-01-09 15:24:48 +00:00
Ulf Hermann d9fe0f3667 qv4sequenceobject.cpp: Add "here be dragons" comment
No one should remove this at() before Qt6.

Task-number: QTBUG-80535
Change-Id: I464c6f675dc68ad9762fcb594bb4d6ba6bdaf316
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2019-12-11 12:36:38 +01:00
Ulf Hermann fb54af6638 qv4sequenceobject.cpp: Use operator[] rather than at()
at() does a range check on the argument. There is no reason to do this
here, and for std::vector this can trigger an exception with interesting
compiler bugs attached to it.

Task-number: QTBUG-80535
Change-Id: I186262de89074a93e68cacec4fba31cc8b8108c8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2019-12-09 10:46:24 +01:00
Lars Knoll 893100fba3 Fix build after QList->QVector changes in qtbase
Change-Id: I1575c247de26ba08fba349bf879ed3e017530975
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-10-31 10:44:44 +01:00
Tasuku Suzuki 89c9418621 Fix build without features.itemmodel
Change-Id: Ia4304644a2a365c359eed31c55c2ca9d7d42f10c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-07-08 18:42:26 +09:00
Lars Knoll 009a125d07 Fix ownKey iteration over Proxy objects
Change-Id: I045a4844c06df9232cc8b04485ab0a39bb990e3f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-09-09 15:52:02 +00:00
Lars Knoll a88f01364e Implement ObjectIterator using the new iteration mechanism
And with that get rid of the old advanceIterator methods.

Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-08-02 20:25:55 +00:00
Lars Knoll 0754f55287 Introduce a new mechanism to iterate over object properties
The old advanceIterator schema was extremely ugly and in addition
not flexible enough to support the requirements for Proxy.ownKeys
and some of the methods in Object

Implemented a new scheme through a OwnPropertyKeys method in the
Object VTable that creates and returns an iterator object. Ported
QJSValueIterator and for-in to use the new mechanism.

There's still many places where we use the old ObjectIterator (that
relies on advanceIterator). Those will be ported in subsequent
commits.

Change-Id: I091a9bea9ff6b2b63630cc336814700757a718be
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-08-02 20:25:41 +00:00
Lars Knoll 61440411a9 Prefix vtable methods with virtual
Turns out that the overloading of vtable methods and regular
ones is problematic in some cases. So let's rather make it explicit
which methods are part of the vtable, and which aren't.

Change-Id: Ifee32a26104d30f3c82bca8b5a9cdea2d4f4f526
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-07-03 08:08:35 +00:00
Lars Knoll 86f88521fb Replace Identifier by PropertyKey
Change all uses of Identifier to use the new PropertyKey class
and get rid of Identifier.

Change-Id: Ib7e83b06a3c923235e145b6e083fe980dc240452
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-07-02 19:29:40 +00:00
Lars Knoll db695c5b1d Unify the get and getIndexed vtable functions of QV4::Object
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>
2018-07-02 19:29:29 +00:00
Lars Knoll 98263a0137 Unify put and putIndexed
Pass an Identifier through those virtual methods to unify
the string and integer based versions.

Also add the receiver that's required in ES7

Change-Id: I4e7f01b4c97cc80bcb3c485f6343f28213dc9e6b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-07-02 19:29:25 +00:00
Lars Knoll 53adb5bbc6 Unify deleteProperty and deleteIndexedProperty vtable methods
Change-Id: I25245818c6ff2104642594476cb9684bac824f29
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-06-26 10:03:46 +00:00
Simon Hausmann d258c904a6 Throw type errors when attempting to mutate read-only sequence properties
Calling for example Qt.application.arguments.push("...") should throw an
exception.

Task-number: QTBUG-67774
Change-Id: Ifd5cd3357dde510cca77b9b32c9f55f8f72837ff
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2018-05-02 15:46:26 +00:00
Lars Knoll 278b144a35 Disambiguate different allocation functions in the memory manager
Some compilers (in this case MingW 5.3) don't manage to properly
disambiguate the template overloads, and try to instantiate the
wrong template function.

Solve this by renaming the one of the template functions.

Change-Id: I3574e617fe96c4bd52920a0127a1dfe39cc3d302
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-04-12 13:58:48 +00:00
Shawn Rutledge 499ec43937 use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.

Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).

Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-02-26 07:13:18 +00:00
Lars Knoll 4e1512baf6 Convert more builtin functions to use the new calling convention
Convert most of the methods used QML objects to the new calling
convention. Converted IndexedBuiltinFunction to do the same.

Change-Id: I41b26042c2f56f24988485b06e8ccd214e2573c0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-01-12 07:04:27 +00:00
Lars Knoll e72306a6f2 Further cleanup JSCallData
Avoid allocations on the JS stack if possible

Change-Id: I344cd6dceb6264314f9d22c94db22b22d1d24d14
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-11-07 09:00:48 +00:00
Lars Knoll bc5ff76e5a Simplify JSCallData construction
Change-Id: Ic53532edae9a209aa7125af6f00a9d993d74f1a3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-11-07 09:00:44 +00:00
Lars Knoll a59d9a7eac Get rid of JSCallData::call()
Change-Id: I6b99e9a7102b3dcb6a7699f54b6456eba6248699
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-11-07 09:00:37 +00:00
Lars Knoll c6c79644dc Rename JSCall to JSCallData
As, this is going to change in a simple stack based structure
to keep pointers to the data to pass to calls.

Change-Id: Ia9aa3f81ee3eeba36affd16aac7b2fe97d59aea9
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-11-07 09:00:26 +00:00
Erik Verbruggen 042aa2eb0e Change CallData::argc to be a QV4::Value
Instead of mimicking a Value. This makes sure that argc now stays
correct even when anything on Value changes.

Most of the change is mechanical: replace callData->argc by
callData->argc().

Change-Id: I521831ae1ffb3966bad6589c18d7a373e13439d7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-09-19 09:44:33 +00:00
Lars Knoll 74c8fe8675 Always set the correct FunctionObject when calling JS functions
Renamed ScopedCallData to JSCall, enforced passing a JS
FunctionObject to it, and added call() and callAsConstructor()
methods to it.

Change-Id: I30db65c9765c2896b5909fe2105c0934c6dad861
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-02 07:12:17 +00:00
Lars Knoll aa8f956e8d Move ScopedCallData and ScopedStackFrame into a separate file
Change-Id: I9ae42aa7a811aa93fe0950725e9d253a0c5e8dba
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-09-01 12:31:19 +00:00
Lars Knoll 4e0174a88e Move line number information into a side table
Don't emit any Line instructions anymore, and instead store
the info in a side table in the compiled data, where it can
be looked up on demand.

Change-Id: Idcaf3bf4ee4129fd62f9e717bf1277dc6a34fe19
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-08-25 12:05:59 +00:00
Lars Knoll 4acb72bf35 Cleanup naming of Stack frame structures
Change-Id: I0b392040b6726e6d93f237ccccc9f053256ed819
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-10 08:20:15 +00:00
Lars Knoll 50e7badd5f Remove Scope::result and convert calling convention for builtins
Allow for faster calling of builtins, and completely avoid
scope creation in many cases.

Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-08-08 18:58:14 +00:00
Lars Knoll 7835060518 Fix frame handling
Fix some regressions introduced by change
1ae1eaf59e0475a2dc9c5e22e53e9be19d0f2feb.

Change-Id: I24c1db78634e3beb1ab090325b60e70f788f92a7
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-08-04 08:59:54 +00:00
Lars Knoll c0f961cd6b Change function signatures for call/construct back
Change those back again to return a value. This will be required
to avoid creation of Scope objects between JS function calls.

Change-Id: I05cb5cf8fd0c13dcefa60d213ccd5983fab57ea3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-08-04 07:08:19 +00:00
Lars Knoll be70a025c1 Don't store the current line number in the ExecutionContext
Instead modify our StackFrame struct to hold the
QV4::Function and have a linked list of those for
the frames.

Change-Id: I8676e16bc51a5ba6cf25a5b3423576d44e8a926a
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2017-08-04 07:08:02 +00:00
Ville Voutilainen 4be29bdbd5 Don't wrap std::vector into a QVariant when passing it to a Q_INVOKABLE
Task-number: QTBUG-60386
Change-Id: Idd5a8939a575c254636042b5cb1900d2d8673072
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-27 14:31:41 +00:00
Ville Voutilainen c50113aaf4 Add support for std::vector and QVector matching the support for QList
Task-number: QTBUG-60133
Change-Id: I5497dc3c4a1c3922e7147d7a20593c75a0d9d0e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-04-21 17:15:07 +00:00
Robin Burchell 5f83e6dfe6 Object: Allow put and putIndexed to return success or failure
Some parts of the ES6 (and even ES5!) spec specifically require handling
of a property write failure. This will be introduced in followup changes,
as it's going to be rather more involved than this.

Change-Id: Ie482493fcf4780df0e23619650a856421d20bd55
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-02-09 14:53:01 +00:00
Lars Knoll 25552c1404 Convert more builtin functions to the new calling convention
Change-Id: I053215261e1186aff25f29e0967219ef667f7678
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2017-01-25 08:31:28 +00:00
Liang Qi f5da1a9261 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	src/quick/items/qquickitemsmodule.cpp
	tests/auto/quick/rendernode/tst_rendernode.cpp

Change-Id: I90582df69feb95a4e4aafb0b9793c23714654f19
2016-10-20 08:28:16 +02:00
Allan Sandfeld Jensen f63ad7c63b Fix gcc6 build
Complete the patch for tautological-compare warnings after it was
merged form 5.6.

Task-number: QTBUG-56266
Change-Id: I39f25f429b90deb8d8830fb15f45ce29a5a4c51c
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
2016-10-16 19:07:00 +00:00
Simon Hausmann 0426400424 Merge remote-tracking branch 'origin/5.6' into 5.8
Change-Id: I175b27337b534c0b8f46a4a792d2c43cde73ffc4
2016-10-13 14:40:30 +02:00
Liang Qi b4cdfc4a12 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ib31008e593442ca5813fb14ae6b02f7ab2577395
2016-10-12 20:49:45 +02:00
Allan Sandfeld Jensen 376077a8e7 Fix developer-build with gcc 6
Locally suppress bogus tautological compare warnings.

Task-number: QTBUG-56266
Change-Id: Ic1b554982a778cdd89c8047483523c44d53bbadd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-10-10 04:41:42 +00:00
Erik Verbruggen 57c9d6969a QML: Also check for correct destroy() chaining
Check that the destroy() method of Heap::Base was called when a Managed
object needs destruction. This checks if a call to the parent's
destroy() method was accidentally omitted.

Change-Id: Id025ecd6d4744bf3eab23503fbe317ed2a461138
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-10-06 14:46:21 +00:00
Erik Verbruggen 3b14e2ffdd QML: Make Heap::Object and all subclasses trivial
GCC6 might dead-store-eliminate out our secret write to Base::mmdata,
because it expects all memory content to be "undefined" before
constructor calls. Clang might take the same approach if the constructor
of Heap::Object is removed.

By making these structs trivial, it also makes them memcpy-able.

Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-10-06 11:44:08 +00:00
Erik Verbruggen 64afa01c32 QML: Introduce destroy() on Base subclasses
This removes the destructors of subclasses of Base, making them nearly
trivial.

Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-10-05 13:15:18 +00:00
Erik Verbruggen c08423ac01 QML: Replace QPointer with a QQmlQPointer (which is trivial)
One of the steps needed to make QV4::Heap::structs trivial.

Change-Id: Ic4d73f15035af21c8a682aaad1ee68cdd91f8e7d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-27 08:37:39 +00:00
Erik Verbruggen 007ae316a6 QML: Unify property reads/writes and use accessors
Pass property reads/writes through utility functions in QQmlProperty,
which in turn will try to use accessors when available (and no
interceptors have to be called).

Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-25 09:26:38 +00:00
Erik Verbruggen 702c4247d7 V4: Pass scope around as parameters inside the runtime.
The implementation of many (or all) runtime functions consist of first
creating a QV4::Scope, which saves and restores the JS stack pointer.
It also prevents tail-calls because of that restoring behavior. In many
cases it suffices to do that at the entry-point of the runtime.

The return value of a JS function call is now also stored in the scope.
Previously, all return values were stored in a ScopedValue, got loaded
on return, and immediately stored in another ScopedValue in the caller.
This resulted in a lot of stores, where now there is only one store
needed, and no extra ScopedValue for every function.

Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-22 11:07:05 +00:00
Kevin Ottens 373c621bf4 Add QVector support to JS sequences
Change-Id: I731355aa1754721236f3711a65af4f96781cebc0
Task-number: QTBUG-51467
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-03 08:00:30 +00:00
Jani Heikkinen 45bd04ba73 Updated license headers
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)

Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-19 14:53:18 +00:00
Lars Knoll 13edffa303 Move remaining objects to new constructor syntax
Also disable the old way of constructing objects.

Change-Id: Ib4e69087cd563ae1481da116d6caf97876239798
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:13 +00:00