aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mm.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use QElapsedTimer instead of QTime to measure elapsed timeMilian Wolff2016-10-051-5/+4
| | | | | | | | | Getting the current time from QTime is expensive as it adheres to the locale timezone. To measure elapsed time in a code block, using the monotonic QElapsedTimer is much faster. Change-Id: Ibea390d7bc5270a20cf35111dfc919e37be7001e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix crash with Component.onDestructionSimon Hausmann2016-08-051-1/+12
| | | | | | | | | | | | | | | 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>
* Fix recursion during aggressive GCSimon Hausmann2016-08-041-0/+3
| | | | | | | | 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>
* Make sure we destroy all QV4::QObjectWrapper objectsJian Liang2016-01-221-2/+15
| | | | | | | | | | 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>
* Revert "Fix QtSharedPointer::ExternalRefCountData object leaks"J-P Nurmi2015-12-231-9/+2
| | | | | | | | | | This reverts commit 839d2d3e2368bc8e107d22203b0611c852f54319, 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>
* Fix QtSharedPointer::ExternalRefCountData object leaksJian Liang2015-12-181-2/+9
| | | | | | | | | | | 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>
* QML: Sanitize reading environment variables.Friedemann Kleint2015-10-221-15/+34
| | | | | | | | | | | 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>
* Improve algorithm to handle GC of StringsLars Knoll2015-09-251-6/+7
| | | | | | | | | | | | 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>
* Cosmetic improvements to marking of objects during GCLars Knoll2015-09-251-2/+2
| | | | | Change-Id: I79a7093c7086ea7f34252f097f18fe7c835053aa Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Avoid a function call when allocation new objectsLars Knoll2015-09-221-24/+22
| | | | | Change-Id: I5f30d4fc3901fcd77aba4e7601586aa34cc0f5d2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QV4_MM_STATS was missing largeItem detailsFrank Meerkoetter2015-09-221-0/+5
| | | | | | | | | 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>
* Rename currentExecutionContext to currentContextLars Knoll2015-09-151-1/+1
| | | | | | | | Now that the other method is gone, let's use the shorter currentContext Change-Id: I2a6fb3b77f83a1ffdf314ad29081e303d17030ed Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Store the stack of executioncontext's on the JS stackLars Knoll2015-09-151-3/+3
| | | | | | | | | | | | | | | | 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>
* Cleanup the ExecutionContextSaverLars Knoll2015-09-151-1/+1
| | | | | | | | 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>
* Fix performance of ListModel::get()Simon Hausmann2015-08-191-4/+2
| | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.5' into 5.6Ulf Hermann2015-08-181-7/+41
| | | | | | | | | | | | | | | | | | | | 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
* Do not sort the vector of chunksFrank Meerkoetter2015-08-111-1/+0
| | | | | | | | 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>
* destruct qobject wrappers before sweeping the GC heapLars Knoll2015-08-101-28/+15
| | | | | | | | | 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>
* Encapsulate and protect all accesses to the vtable of Heap objectsLars Knoll2015-08-101-7/+7
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-041-1/+1
| | | | | | | | | | | 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
* Fix build with QT_STRICT_ITERATORSSérgio Martins2015-05-151-1/+1
| | | | | Change-Id: I3df6ac107cb46b3a1b15b80f39d7c6015adcd9ac Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of asManaged()Lars Knoll2015-04-211-2/+2
| | | | | Change-Id: I853417fdf1cc339f7d43a006c20e1626b6bfb288 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move memory management related functionality into it's own folderLars Knoll2015-03-021-0/+617
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>