aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4internalclass.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-13/+119
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4argumentsobject.cpp src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4errorobject.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4managed.cpp src/qml/jsruntime/qv4managed_p.h src/qml/jsruntime/qv4object.cpp src/qml/jsruntime/qv4object_p.h src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4heap_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/memory/qv4mmdefs_p.h src/quick/scenegraph/util/qsgdistancefieldutil.cpp src/quick/scenegraph/util/qsgdistancefieldutil_p.h tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7ed925d4f5d308f872a58ddf51fdce0c8494ec9c
| * Optimize marking of prototypes in the InternalClass treeLars Knoll2017-05-191-16/+16
| | | | | | | | | | | | | | | | | | There's no need to iterate over all internal classes, as prototype changes always happen in the first or second level of the tree. Change-Id: I99bf11a6cd238286c1547922d61ab47319b6eb97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Optimize lookups in the internalClassLars Knoll2017-05-191-9/+0
| | | | | | | | | | | | | | | | Inline the version taking an identifier, and use that one where it makes sense. Change-Id: I414c5999e61cdba219ecd1080957f3037dfebc1b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Move the prototype into the internal classLars Knoll2017-05-191-1/+52
| | | | | | | | | | | | | | | | | | | | This saves another pointer on all Objects. Currently introduces a slight performance regression on some of the v8 benchmarks, that needs addressing. Change-Id: I87de8e1d198d2683f4e903c467ce2a60ba542243 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Move the internalClass field from Heap::Object to Heap::BaseLars Knoll2017-05-191-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | And do not store the vtable in Heap::Base anymore. This change makes the internal class the main distinguishing feature of all garbage collected objects. It also saves one pointer on all Objects. No measurable impact on runtime performance. Change-Id: I040a28b7581b993f1886b5219e279173dfa567e8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Add support for storing the Vtable in the InternalClassLars Knoll2017-05-191-8/+44
| | | | | | | | | | | | | | | | | | Prepare for moving the vtable pointer into the internalClass. This adds the required infrastructure to InternalClass, so it can store a vtable pointer and properly handles vtable changes. Change-Id: I688fee1647268dd185d0f9636ab5b3390465daca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Properly encapsulate all accesses to the vtableLars Knoll2017-05-191-2/+2
| | | | | | | | | | Change-Id: I3f6ae59d01c7b6c898e98d3b6f65b84a19b8851a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Move the list of default internal classes into EngineBaseLars Knoll2017-05-191-4/+4
| | | | | | | | | | | | | | | | And store them in an enumerated array. This will simplify upcoming changes. Change-Id: I82eac03b9f6264843ae625e36e150464fe08be9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Re-add some inline property storageLars Knoll2017-05-081-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that not using any inline property storage comes at a relatively high price in terms of memory consumption, as we always need to also create a memberData for any object. This avoids the memberData creation in quite a few cases, as we use the additional padding we have up to the 32 byte boundary given by the memory manager to store some property data. This complicates property access somewhat. To avoid performance regressions because of this, add specialized QV4::Lookup functions that optimize for properties that are inline or in the memberData struct. Change seems to be performance neutral on v8-bench on x86_64, but reduces peak memory usage when running the benchmark by around 20%. Change-Id: I0127d31a2d6038aaa540c4c4a1156f45ca3b7464 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Separate the stack used for GC from the regular JS stackLars Knoll2017-04-071-2/+2
| | | | | | | | | | | | | | | | This is required to be able to implement concurrent or incremental garbage collection. Change-Id: Ib3c5eee3779ca2ee08a57cd3961dbcb0537bbb54 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-23/+3
|/ | | | | | | | This is required, so we only have to add the write barrier in one place. Change-Id: I4e8bde823b30ad18f043312ac3f1ed46597b91a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the inline member data in ObjectLars Knoll2017-01-251-29/+3
| | | | | | | | | | | | | | | Instead allocate a MemberData at the same time as the object if required. Turns out this is faster now, and significantly simplifies some of our internal logic to access member properties. In addition, we can properly setup the inline member size to use the full extent of the memory reserved by the memory manager. This avoid some needless reallocations of MemberData objects. Change-Id: I36daeeaf6df16f2268103662fc78d600b4058ef8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.8Simon Hausmann2016-10-131-4/+8
|\ | | | | | | Change-Id: I175b27337b534c0b8f46a4a792d2c43cde73ffc4
| * Fix corruption when adding or changing properties of JS objectsArnaud Vrac2016-10-101-4/+8
| | | | | | | | | | | | | | | | | | | | Commit 833c99db20 introduced this regression by only moving part of the value data to the proper offset. Task-number: QTBUG-53261 Change-Id: I11241c57057a57794bc3ca60ee437206e524f355 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-021-4/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickshadereffect.cpp 5.7 had a bug-fix in code dev has replaced wholesale. src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h One side changed a method's signature; the other side renamed a method declared adjacent to it and changed some code using it, moving some from the public class to its private partner. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side added a blank line before a comment the other re-wrote. Kept the re-write, killed the stray blank. .qmake.conf Ignore 5.7's change to MODULE_VERSION. src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmlpropertyvalidator.cpp 5.7 changed code in the former that dev moved to the latter. Reflect 5.7's changes there, adapted to dev's form. src/qml/qml/qqmlobjectcreator.cpp One side added new QVariant types; the other changed how it handled each type of QVariant (without git seeing any conflict); adapted the new stanzas to work the same as the transformed ones. tests/manual/v4/test262 dev had a broken sha1 for it; so used 5.7's 9741ac4655808ac46c127e3d1d8ba3d27ada618e Change-Id: I1fbe2255b97d6ef405cdd1d0cea7fab8dc351d6f
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-151-4/+4
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quick/demos/photoviewer/deployment.pri One side made it redundant; the other removed part of it; remove it all ! src/quick/scenegraph/util/qsgatlastexture.cpp One side changed a preprocessor condition, the other a code condition, on adjacent lines; keep both changes. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side changed a condition, the other the content of its block; keep both. Change-Id: Idb8937f92a7edb28212449dfe0c5cfdb8e6de986
| | * Fix logic bug when deleting properties of JS objectsLars Knoll2016-07-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code used the size of the internal class in an inconsistent way. It should simply compute and work with the old internal class size, as that reflects the old object layout. [ChangeLog][QtQml] Fix assertion when deleting properties of JS objects Task-number: QTBUG-54589 Change-Id: Ie3db70437e780215d08a1a96491db75f8b859754 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Allow for inlining InternalClass::findErik Verbruggen2016-07-151-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | This method is used in ExecutionEngine::getProperty, which is called quite often. Change-Id: Ide49d158005ef1d9f51d1e734cf9e3b19f52cf26 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4: Replace QList with std::vector in InternalClass::destroy()Erik Verbruggen2016-05-121-7/+9
|/ / | | | | | | | | | | | | | | | | This nearly halves the number of instructions in the benchmark librarymetrics_performance instantiation #060: it goes from 23M to 17M for 23 iterations. Change-Id: Icc3cebc19998b67b95e6642b1daa1b2371cdecd2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* / Updated license headersJani Heikkinen2016-01-191-14/+20
|/ | | | | | | | | | | 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>
* Speed up QQmlEngine constructorLars Knoll2015-09-251-7/+13
| | | | | | | | | | | | | | | | Freezing the global object using a script is pretty slow, esp. given that the script needs to be compiled as well. Rather do it programmatically. The old code actually had a bug that would only cause the global object to be frozen, not it's children. The new code fixes this, but doesn't completely freeze the objects. Instead it makes all the existing properties of the global object and it's children readonly, but still allows extending existing objects with new properties. Change-Id: I0d7331cdc89a0ac717b8ed3b1a490b2a3742de02 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Inline property data into the objectLars Knoll2015-09-221-2/+34
| | | | | | | | | | | | Append the part of the objects property data that is known ad instantiation time to the object itself and by that avoid creating a separate MemberData. Saves some memory and should speed up object creation. Currently implemented only for Object and ArrayObject. Change-Id: I7693bf2f3a28fb718522398ebb94ac115e021fa4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Encapsulate the remaining direct accesses to Object::memberDataLars Knoll2015-09-151-4/+18
| | | | | Change-Id: I17f202cf58dc355524b89a456e6722d41e444ca1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* CleanupsLars Knoll2015-09-151-7/+8
| | | | | | | | | | | There's only one place where we need to resize our member data, namely when we call setInternalClass() on an object. In addition, encapsulate the access to the memberdata better in preparation for inline property data later on. Change-Id: Ia34d0253d5d1792f1d7c4981556d78375fa7a755 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* V4: Fix use of uninitialized field.Erik Verbruggen2015-06-081-4/+1
| | | | | | | | | | | | Valgrind pointed out that Transition::id was used in a conditional jump or move. Fixes regressions of the following tests on OSX: ch15/15.2/15.2.3/15.2.3.12/15.2.3.12-2-1 in non-strict mode ch15/15.2/15.2.3/15.2.3.12/15.2.3.12-2-2 in non-strict mode ch15/15.2/15.2.3/15.2.3.12/15.2.3.12-3-28 in non-strict mode Change-Id: Ia959ff6f9fdac8d4cb37f54f670fdff4c8ba9a67 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Remove the remaining bit of code that use the vtable in the internalClassLars Knoll2015-01-211-47/+5
| | | | | Change-Id: Ia52f0e6db325aab37477d455f163487b319dce29 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix a bug in removeMember causing a duplicate transition with an 0 lookup.Robin Burchell2015-01-201-3/+8
| | | | | | | | | | | We shouldn't have taken a copy here. I'm not sure why I did that. Also sprinkle Q_ASSERT fairydust around to try ensure that this doesn't happen again. This was exposed when we started trying to delete the transitions again, which were leaked in 6421f275286b3238fe1a7a5e909225251f3e8dbf. Change-Id: Id9272db7f1863d1ccc5b1f48b6382c68ae0da9da Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QV4::InternalClass: Fix a memory leak.Robin Burchell2015-01-201-2/+2
| | | | | | | | Accidentally introduced in 6421f275286b3238fe1a7a5e909225251f3e8dbf. Change-Id: I45d121a661ba403d1d4573f98fe0944f05319290 Done-by: Slava Monich <slava.monich@jolla.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move extensible into the internal classLars Knoll2015-01-121-0/+26
| | | | | | | | With this, we can now save one pointer per Heap object. Change-Id: I7f69193ff51c9fd9c5dbfba90aa1ebb3f93da2e6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Replace InternalClass transitions hash with a sorted vector.Robin Burchell2015-01-091-34/+41
| | | | | | | | | | | | | | | | | | | | | | | | | In a reasonable test application, there were some 1697 transition entries. Out of these, 1663 of them had only a single item. The remainder, with the exception of three, had <10 items. Only one of these had a count of >50 items (86). As can be seen, most of the time, transitions is usually quite sparsely populated, so using a hash is a large amount of overhead considering there's just a few elements. For the times when it isn't, the vector being sorted should help take care of that. Since transitions are never removed, we can use a similar trick to ba690fb73864915b4a35bbec5b7dc134ff1dafd0 and use a sorted vector to store them. Compared to the hash approach, this saved ~412kb according to malloc_stats on a reasonably comprehensive test application. Coincidentally, this also improved v8bench for me by ~10%. Note that this undoes 132cdfa69cae45d0c02ea715ce58722bbcd57e73, but the expectation is that the fewer allocations done by using a vector will outweigh the need to reserve any specific allocation initially. Change-Id: Iec57a7db7e9a60347c9683b1cb1598f6d9c866f7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QV4::InternalClass: reserve space for transitions.Robin Burchell2014-12-311-0/+2
| | | | | | | Profiling of allocations shows that this is one of the most frequent allocators. Change-Id: Iae0350c61bfe37381577642b9a93064377f45c1d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move prototype back from the vtable into ObjectLars Knoll2014-12-111-61/+5
| | | | | | | | This is the only way we can support a GC that moves objects around in memory. Change-Id: I1d168fae4aa9f575b730e469e762bc5b5549b886 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-091-18/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4globalobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/quick/items/qquicktext_p.h src/quick/items/qquicktextedit_p.h src/quick/items/qquicktextinput_p.h Change-Id: If07e483e03197cb997ef47a9c647a479cdb09f4c
| * Avoid stack overflow when destroying InternalClassUlf Hermann2014-11-061-18/+17
| | | | | | | | | | | | | | | | | | If there are deep object hierarchies connected to an InternalClass the recursive nature of the destroy() method could lead to a stack overflow. By changing the recursion into an iteration this is avoided. Change-Id: I6667f268a366749c2dbc5f7147882388f192a9c5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Remove two reinterpret_casts in ObjectLars Knoll2014-11-221-3/+3
| | | | | | | | | | Change-Id: I921cd8129acb47cffd58be9551a6925c4f296d41 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Changed InternalClass to store Identifier* instead of String*Simon Hausmann2014-11-211-20/+28
| | | | | | | | | | | | | | | | | | All members are identifiers anyway, so this gets rid of a ### and also simplifies some of the call sites by removing the need for a scoped string. Change-Id: Ic6b550cdb97afa5a4b0fa7e9b13e7768ed3f6bd8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Ported ExecutionEngine::newString and newIdentifier to Heap::StringSimon Hausmann2014-11-121-1/+2
| | | | | | | | | | | | | | | | | | | | Avoid the use of Returned<String> for newString and changed the identifier table to use Heap::String. This required moving some code back into Heap::String, but that's code that doesn't call back into the GC, so allocations and therefore future object moves aren't possible. Change-Id: I1dca3e9c12a9c56f09419af8cc8cba39fe04f720 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of Members and directly store MemberData::Data pointersLars Knoll2014-11-071-3/+3
|/ | | | | | | And do the same change for ArrayData. Change-Id: Ia1ae56bd0ff586c9b987e15af7a53f395a37054a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Get rid of StringRefLars Knoll2014-07-221-15/+0
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert String to the new storage layoutLars Knoll2014-07-221-6/+6
| | | | | Change-Id: Ifa9aac63fdb270fb449f11832a1792caeb6c6724 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move object data into internal structureLars Knoll2014-07-221-3/+3
| | | | | Change-Id: I1fcccd535ed356e736468337bd450270cd290044 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move string data into subclassLars Knoll2014-07-221-6/+6
| | | | | Change-Id: I95dcdda8c68e2a5c36244798c8c10dcfdd69d2c2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-19/+19
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix marking of prototype objects in internal class poolSimon Hausmann2014-04-281-11/+19
| | | | | | | | | | As per reported bug, we have to protect ourselves against potential loops and can mark the internal classes much simpler by just walking through the memory pool they were allocated in. Task-number: QTBUG-38299 Change-Id: I3ae96e8082e76d06f4321c5aa6d2e9645d2830a0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix marking of prototype objects in chainSimon Hausmann2014-04-071-9/+6
| | | | | | | | | | | | | | | | With a real prototype chain it can happen that an internal class' prototype's class itself has a prototype. Therefore the first transition on the empty class is a PrototypeChange one, but the class the transition leads to may have PrototypeChange transitions itself, which weren't marked. There are multiple solutions to this, but this patch is the minimal fix by recursing fully through the internal class tree. That way it's easier to back-port the fix also into 5.2.x based branches. Task-number: QTBUG-37834 Change-Id: I901b13a2663fbad5844003ca5752f2f304de320c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Garbage collect member dataLars Knoll2014-04-041-3/+3
| | | | | | | | Move the allocated member data into the garbage collected area, so that we can avoid using malloc/free for it. Change-Id: I20625efa67ecd60238568742b74854b0c8cb2e3e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use an array of Value's for Object::memberDataLars Knoll2014-03-071-3/+7
| | | | | | | | | | This cuts the memory required to store properties in an object in half for the common case. Accessor properties require two slots inside memberData, but data properties only one. Change-Id: I0bab1b88ca9ed5930abf065c77c89985b9ed5320 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Reserve a double slot for accessor propertiesLars Knoll2014-03-071-32/+95
| | | | | | | | | | Reserve two slots in the internal class for accessor properties. This opens up reducing the default storage required per data property to one Value. In practice this implies cutting the required memory in half. Change-Id: Ifed897852bbdfd810018f0d6b049fca6690ead2c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>