aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4internalclass.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace Identifier by PropertyKeyLars Knoll2018-07-021-24/+24
| | | | | | | | Change all uses of Identifier to use the new PropertyKey class and get rid of Identifier. Change-Id: Ib7e83b06a3c923235e145b6e083fe980dc240452 Reviewed-by: Simon Hausmann <[email protected]>
* Cleanups in the Identifier APILars Knoll2018-07-021-4/+4
| | | | | | | | | | Rename from/asHeapObject to from/asStringOrSymbol and fix the signature. Add a isStringOrSymbol() method and redefine isValid() to also include array indices. Change-Id: Ic8272bfbe84d15421e2ebe86ddda7fdaa8db4f3e Reviewed-by: Simon Hausmann <[email protected]>
* Add support for ReflectLars Knoll2018-06-211-1/+1
| | | | | | | | Implemented all methods in Reflect, only some smaller bugs left in there. Change-Id: I53d2304d0e59566aec64e200cd995e02afcfc33e Reviewed-by: Simon Hausmann <[email protected]>
* Garbage collect identifiersLars Knoll2018-05-021-2/+8
| | | | | | | | | | | | | | | | | | | | | Implemented by storing a backpointer to the Heap object in the identifier. Since identifiers now point back to their originating String or Symbol, we can now easily mark all identifiers that are still in use and collect those that aren't. Since Identifiers are 64bit also add support for holding an array index in there. With that an identifier can describe any kind of property that can be accessed in an object. This helps speed up and simplify some code paths. To make this possible, we need to register all IdentifierHash instances with the identifier table, so that we can properly mark those identifiers. Change-Id: Icadbaf5712ab9d252d4e71aa4a520e86b14cd2a0 Reviewed-by: Simon Hausmann <[email protected]>
* Remove String dependency from InternalClassLars Knoll2018-05-021-25/+9
| | | | | | | | This is required, so we can also use Symbols in the internal classes. Change-Id: I630e7aa7b8b16d5a94041f8d18515fd582f94264 Reviewed-by: Simon Hausmann <[email protected]>
* Use Identifier by value and don't new them anymoreLars Knoll2018-05-021-26/+26
| | | | | Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <[email protected]>
* Turn Identifier into a simple integerLars Knoll2018-05-021-3/+3
| | | | | | | | | | Add a reverse mapping table to the IdentifierHash to avoid having to store a hash value inside the identifier. This makes it possible to then use the identifiers value based and not new them on the heap anymore. Change-Id: If1f177588ea104565c6e3add49c70534a6c7dcb8 Reviewed-by: Simon Hausmann <[email protected]>
* Fix removal of members from the InternalClassLars Knoll2018-04-251-11/+22
| | | | | | | | | | | | Removing identifiers from the propertyhash could cause subtle issues if there was an identifier that hashed to the same value as the identifier being removed stored in the hash afterwards. This identifier could end up in a state where it could not be found anymore. Amends ea164ca4a8ec1e5c568ab82c0c4256a841f77bf0 Change-Id: I2881865ee83833b6364d9be55579b8fc7d7c5016 Reviewed-by: Simon Hausmann <[email protected]>
* Reorganize Lookup data structure to make marking fasterLars Knoll2018-04-121-3/+3
| | | | | | | | | | Do this by always using odd numbers for protoId's, and putting those into the same place as the InternalClass pointers. That makes it possible to quickly check whether the lookup contains a pointer to a valid heap object. Change-Id: I330017b26c090b4dcbbcce1a127dca7ba7e148d1 Reviewed-by: Simon Hausmann <[email protected]>
* Rename InternalClass::id to protoIdLars Knoll2018-04-121-7/+7
| | | | | | | | It really identifies the 'revision' of the prototype chain that is being used with this internal class. Change-Id: Id5829c055cde2c1a2ca1032a7e831b3f0428774e Reviewed-by: Simon Hausmann <[email protected]>
* garbage collect InternalClassLars Knoll2018-04-121-101/+125
| | | | | | | | | | | | | | | | Internal classes are now allocated and collected through the GC. As they are important to the deletion of other objects (because of the vtable pointer living inside the internal class), they need to get destroyed after regular objects have been sweeped. Achieve this by using a separate block allocator for internal class objects. Our lookups do often contain pointers to internal classes, so those need to be marked as well, so we don't accidentally collect them. Change-Id: I4762b054361c70c31f79f920f669ea0e8551601f Reviewed-by: Simon Hausmann <[email protected]>
* Better encapsulation for EngineBase::internalClassLars Knoll2018-04-121-2/+2
| | | | | | | | Turn it into a method instead of accessing the array directly to simplify refactoring. Change-Id: I197b56c8f58cfdfd294f429e6b15268c755f9837 Reviewed-by: Simon Hausmann <[email protected]>
* InternalClass: Unify handling of sealed and frozen classesLars Knoll2018-04-121-30/+41
| | | | | | | | Unify the handling of sealed and frozen classes, and access them through the transition vector. Change-Id: I710cae04d717f42a8b8d4057dd1c60293043725b Reviewed-by: Simon Hausmann <[email protected]>
* Remove the pool allocator from InternalClassLars Knoll2018-04-121-23/+13
| | | | | | | | Makes it easier to transition it over to be controlled by the GC. Change-Id: I6bea738b3852abfc7870b71e639efc595eeb28fc Reviewed-by: Simon Hausmann <[email protected]>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-271-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/parser/qqmljslexer.cpp src/qml/qml/v8/qv8engine.cpp src/qml/util/qqmladaptormodel_p.h src/quick/items/qquickanimatedsprite.cpp tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
| * use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-151-0/+3
|\| | | | | | | Change-Id: I2d4c012c8ca578f90d7eb56dbc6b306ac7cbb841
| * Clear the last value when removing propertiesErik Verbruggen2018-02-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | When we remove a property from an object, we shrink the used entries by one (or 2 when an accessor is defined) by moving subsequent entries "down" over the removed entry. We also have to set the last entry (or 2) to Undefined, otherwise any heap objects referenced there would be retained. Task-number: QTBUG-66090 Change-Id: I75905fafd0d88891820d894a869b9714bc9807e0 Reviewed-by: Lars Knoll <[email protected]>
* | Change creation of new internal classesLars Knoll2018-02-091-135/+191
|/ | | | | | | | | | | | So far we often began with the empty class again when creating new internal classes. This allowed for multiple paths through the internal class hierarchy ending up at the same internal class object. But to be able to efficiently garbage collect internal classes, we need to have only one path to each instance of an internal class. Change-Id: Ic6c1f2b3d021e92b44f76a04a8886820e63e8f26 Reviewed-by: Simon Hausmann <[email protected]>
* Add a unique id to InternalClass that describes it's total stateLars Knoll2017-11-271-2/+60
| | | | | | | | | | | | | | | So far the InternalClass only did describe the state of the class itself, but it wouldn't change if some of the underlying objects in the prototype chain changed. This now fixes that and introduces a unique ID that completely describes the state of the object including all it's prototypes. This opens up for optimizing lookups down to one branch and a load, independent of the depth of the value inside the prototype chain. Change-Id: I0787e0e4710f2f6703b1d5e35996124b3db2d2da Reviewed-by: Erik Verbruggen <[email protected]>
* 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 <[email protected]>
| * 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 <[email protected]>
| * 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 <[email protected]>
| * 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 <[email protected]>
| * 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 <[email protected]>
| * Properly encapsulate all accesses to the vtableLars Knoll2017-05-191-2/+2
| | | | | | | | | | Change-Id: I3f6ae59d01c7b6c898e98d3b6f65b84a19b8851a Reviewed-by: Simon Hausmann <[email protected]>
| * 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 <[email protected]>
| * 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 <[email protected]> Reviewed-by: Robin Burchell <[email protected]>
* | 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 <[email protected]>
* | 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* | 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 <[email protected]> Reviewed-by: Simon Hausmann <[email protected]>
* | | 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 <[email protected]>
* | | 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 <[email protected]>
* / 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* Encapsulate the remaining direct accesses to Object::memberDataLars Knoll2015-09-151-4/+18
| | | | | Change-Id: I17f202cf58dc355524b89a456e6722d41e444ca1 Reviewed-by: Simon Hausmann <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* QV4::InternalClass: Fix a memory leak.Robin Burchell2015-01-201-2/+2
| | | | | | | | Accidentally introduced in 6421f275286b3238fe1a7a5e909225251f3e8dbf. Change-Id: I45d121a661ba403d1d4573f98fe0944f05319290 Done-by: Slava Monich <[email protected]> Reviewed-by: Lars Knoll <[email protected]>
* 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 <[email protected]>