Commit Graph

34 Commits

Author SHA1 Message Date
Liang Qi 7e609f6d10 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/qml/compiler/qqmltypecompiler.cpp
	src/qml/compiler/qv4isel_moth.cpp
	src/qml/compiler/qv4ssa_p.h
	src/qml/qml/qqmlobjectcreator.cpp

Change-Id: I8bb7fe773d657f908f20ee5e72c2b9bd643f6260
2016-08-17 10:57:38 +02:00
Liang Qi d54d28981c Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/qml/compiler/qv4isel_moth.cpp
	src/qml/compiler/qv4ssa_p.h
	tests/benchmarks/qml/qqmlimage/qqmlimage.pro
	tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp

Change-Id: Iad11ce7fdf0c6d200fdebc16a94081bd8069a87a
2016-08-13 00:41:58 +02:00
Liang Qi 5517c63c2e Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/qml/qml/qqmlcomponent.cpp
	tests/auto/quick/scenegraph/tst_scenegraph.cpp

Change-Id: Ibc811b95a57f175ca53337db7bbd1f575a745937
2016-08-09 10:28:48 +02:00
Simon Hausmann 68bfc9332c Fix crash with Component.onDestruction
A call to a handler of Component.onDestruction may end up causing WeakValues
such as QQmlData::jsWrapper to be set again, even though they've been set to
undefined in an earlier iteration of the loop that walks through the weak
references. That in turn may result in invalid object references to objects
that are scheduled for destruction by the collector.

So after calling all destroy handlers for QObjects, reset all of the weak
values again.

Task-number: QTBUG-54939
Change-Id: I00ebabb76274e296fb1bd90d8d3e21dbbb920b57
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-05 18:55:39 +00:00
Liang Qi 45f79dc7e5 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp
	src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h

Change-Id: I1e6a9424e7f87d9e4ac1ea387ec70e151106f1c7
2016-08-05 09:02:17 +02:00
Simon Hausmann 0a4cebe6d3 Fix recursion during aggressive GC
With aggressive GC enabled we may end up calling the GC recursively, which does
not work at all, so disable that.

Change-Id: I9ce0abbdb7b2bfa8499b33fd0be0d6e4a5212a15
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-08-04 06:21:40 +00:00
Ulf Hermann 901b975fb5 V4: Don't pass size and pointer through allocation trackers
By not relying on the return value of the macros we can #define them
away later, when compiling with -no-qml-debug

Change-Id: I24d50fa3f5d8e8765a42b050c81ddfae20f20a23
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-28 11:03:25 +00:00
Milian Wolff d453275a88 Add heaptrack support to qv4mm pool allocator.
When you build qtdeclarative with CONFIG+=heaptrack then the allocations
from the custom pool allocator can be traced with heaptrack. This works
similar to the existing valgrind support.

Change-Id: Ia988380415083aa1346c84c8c64b49ea3e17b7e2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-26 21:11:47 +00:00
Frank Meerkoetter e88500ff25 Increase test coverage for the V4 memory manager
This commit adds a small test that exercises a number of code paths
inside qv4mm.cpp which are normally gated via environment variables.

Change-Id: Ibe959387a9b86ce68df258513446d2165fe06ee2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-06-20 07:42:08 +00:00
Erik Verbruggen ce08000602 V4: tighten up various casts to check also check type.
All those type conversions assumed that the content of a Value was
either the requested type, or 0 (zero, a null pointer). Now, attempting
to convert e.g. undefined to a string will fail, instead of returning a
weird address.

Change-Id: I0f567cdcc9cc9728d019f17693f4a6007394a9c6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-08 08:04:53 +00:00
Erik Verbruggen 2cb3466baa V4: fix all pedantic warnings
- signed/unsigned conversions
- size conversions (i.e. int<->long)
- padding issues inside MemoryManager::Data

Change-Id: I3770de2c187d1520d98e2322d682b3ecc9a14671
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-26 08:59:25 +00:00
Erik Verbruggen 5f3b1e8125 V4: Get more code inlined in the MemoryManager.
Change-Id: I7cf6c5d3458b0c43283e63a7300ee9965ba803fb
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
2016-05-25 08:22:40 +00:00
Liang Qi 1e421097f0 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: Iec1b2de53c275996364c4bab0123ccb3e6e9895e
2016-01-29 13:01:22 +01:00
Jian Liang 3cc589c983 Make sure we destroy all QV4::QObjectWrapper objects
Delay freeing QObjectWrapper Value to MemoryManager::sweep() to make sure
we can destroy all QObjectWrapper objects.
We also keep track of QObjectWrapper in QV4::Heap::ModelObject to make
sure we destory them in QV4::MemoryManager::sweep()

Change-Id: I3a8a3b07faab1f88c2eb746f68aa8d9584b40026
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-22 14:07:19 +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
J-P Nurmi 9c4621217f Revert "Fix QtSharedPointer::ExternalRefCountData object leaks"
This reverts commit 839d2d3e23, which has
been causing crashes in qtquickcontrols2 auto tests and making it nearly
impossible to integrate anything over the past few days.

Change-Id: I570b286a067aae5e3c2d8c56ad601e1a6cb58c20
Task-number: QTBUG-50134
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 18:19:57 +00:00
Jian Liang 839d2d3e23 Fix QtSharedPointer::ExternalRefCountData object leaks
Call destroyObject() for every QV4::Heap::QObectWrapper object in heap in
QV4::MemoryManager::sweep() to make sure the QPointer object contained in
QV4::Heap::QObjectWrapper is properly destructed.
We also keep track of QObjectWrapper in QV4::Heap::ModelObject to make
sure we destory them in QV4::MemoryManager::sweep()

Change-Id: I3b3e96cfc300c2e21ab691762879ac2970afa90c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-18 15:52:43 +00:00
Friedemann Kleint 8848abe69f QML: Sanitize reading environment variables.
Where possible, use qEnvironmentVariableIsSet()/
qEnvironmentVariableIsEmpty() instead of checking on the
return value of qgetenv().
Where the value is required, add a check using one of
qEnvironmentVariableIsSet()/Empty().

Change-Id: Ia8b7534e6f5165bd8a6b4e63ccc139c42dd03056
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-10-22 12:40:18 +00:00
Lars Knoll d5d9c3097a Improve algorithm to handle GC of Strings
The old algorithm could lead to excessive garbage collection
in cases where lots of strings are being created.

The new algorithm is a bit more agressive in doubling the GC limit
for string data. This doubles the performance of both the v8 regexp
and splay benchmarks.

Change-Id: I2b5cd27c14410b033038a409d5ae03c9636d4f71
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-25 08:39:40 +00:00
Lars Knoll a8ccf32793 Cosmetic improvements to marking of objects during GC
Change-Id: I79a7093c7086ea7f34252f097f18fe7c835053aa
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-25 08:39:20 +00:00
Lars Knoll bf8403d8d4 Avoid a function call when allocation new objects
Change-Id: I5f30d4fc3901fcd77aba4e7601586aa34cc0f5d2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 08:20:15 +00:00
Frank Meerkoetter 884097f463 QV4_MM_STATS was missing largeItem details
The output of QV4_MM_STATS was only reporting the items allocated on the
JS HEAP. It was missing out on the LargeItems which are allocated on
the C++ heap.

Change-Id: Ife3d7afd769beb31afd1ed681d503f9811b03b96
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-22 07:12:55 +00:00
Lars Knoll 830376c962 Rename currentExecutionContext to currentContext
Now that the other method is gone, let's use
the shorter currentContext

Change-Id: I2a6fb3b77f83a1ffdf314ad29081e303d17030ed
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:26 +00:00
Lars Knoll 3a8d6123d1 Store the stack of executioncontext's on the JS stack
This saves one pointer per allocated execution context.
Now every execution context that is pushed, allocates two
Values on the js stack. One contains the context itself, the
other one the offset to the parent context.

Things are a bit tricky for with and catch scopes, as those
are called from the generated code, and can't open a Scope
anymore. In addition, all methods iterating over the js
stack frames need to work with ExecutionContext pointers,
not ScopedContext's.

Change-Id: I6f3013749d4e73d2fac37973b976ba6029686b82
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:16 +00:00
Lars Knoll 7dab89a65e Cleanup the ExecutionContextSaver
Always operate on the current context (as that's what we do
in practice anyway).

Change-Id: I4171207a7a86e69aa685754956c0764ac6e152a7
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-09-15 07:37:08 +00:00
Simon Hausmann 4876ea6a18 Fix performance of ListModel::get()
When called, the function would return a full-fledged QObject that maps the
list element addressed. It would contain a _copy_ of all values in the list
item and it would create a new meta-object for each list element.

This function exists for the JavaScript API, and therefore we now return a much
more lightweight object. For compatbility reasons it still has to be a QObject,
but the meta-object of it is created on-demand, i.e. only when accessing
properties from the C++ side or when connecting to the changed signal of a
property. Otherwise the JavaScript wrapper will return the live values from the
model without copying them.

Change-Id: Iabf3ca22192d2aee06ae9d4b4cfb2fcde2a021b1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Spencer Schumann <spencer.schumann@echostar.com>
2015-08-19 05:03:50 +00:00
Ulf Hermann eb30e3d7ee Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	src/qml/debugger/qv4debugservice.cpp
	src/qml/jsruntime/qv4value_inl_p.h
	src/qml/jsruntime/qv4value_p.h
	src/qml/memory/qv4mm.cpp
	src/qml/memory/qv4mm_p.h
	src/qml/qml/qqmlnotifier_p.h
	src/qml/qml/qqmlproperty.cpp
	src/quick/items/qquickflickable.cpp
	src/quick/items/qquicktextedit.cpp
	tests/auto/quick/qquickwindow/BLACKLIST

The extra changes in qqmlbinding.cpp are ported from changes to
qqmlproperty.cpp that occurred in parallel with writeBinding() being
moved to qqmlbinding.cpp.

Change-Id: I16d1920abf448c29a01822256f52153651a56356
2015-08-18 10:29:47 +02:00
Frank Meerkoetter 92624025ea Do not sort the vector of chunks
I don't see why the vector needs to be sorted by the base()
addresses of the contained PageAllocations.

Change-Id: I31946a50075c64d01c6de98964ea42ebfc936c68
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-11 20:51:00 +00:00
Lars Knoll c1667cd727 destruct qobject wrappers before sweeping the GC heap
The wrappers emit a destroyed signal, and it's important
that the GC heap is in a well defined state when these signals
are emitted.

Change-Id: I423c4241b1e2fd3de727277d26bbe64f08862193
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-10 07:24:36 +00:00
Lars Knoll 415f55d140 Encapsulate and protect all accesses to the vtable of Heap objects
This is required, so we can safely access the vtable even while
we're marking objects during GC.

Change-Id: I34f56b61b4bca0d0742faf607eb5ab8b2c30685e
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-08-10 07:24:32 +00:00
Simon Hausmann 9556f6d075 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/qml/jsruntime/qv4engine_p.h
	src/quick/items/qquickitemsmodule.cpp
	src/quick/items/qquicktext.cpp
	src/quick/util/qquickpixmapcache.cpp
	tests/auto/quick/qquickwindow/tst_qquickwindow.cpp

Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
2015-06-04 10:28:48 +02:00
Sérgio Martins a8d532eb1d Fix build with QT_STRICT_ITERATORS
Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-15 19:45:46 +00:00
Lars Knoll fc5a11aadc Get rid of asManaged()
Change-Id: I853417fdf1cc339f7d43a006c20e1626b6bfb288
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-21 13:01:41 +00:00
Lars Knoll feebac8e70 Move memory management related functionality into it's own folder
Start moving the memory related functionality into it's own folder.
This will simplify refactoring of the GC related functionality later
on.

Change-Id: I70ec6f512af7a7897625afb84d914c17572b0ccd
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-03-02 16:34:16 +00:00