aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-291-12/+1
|\ | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compilercontext.cpp src/qml/qml/qqmlmetatype.cpp Change-Id: I02e0216961b92ff68a3f91a70edc33fe9e8db147
| * Revert "Optimize some Lookups"Michal Klocek2019-04-241-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2beb77c81a1f3585c15099a09ba8b2192c6da824. To optimize lookup in case of heapObject we cast its value to Object. This unfortunately does not work well when the value type of heap object is actually a string. Task-number: QTBUG-75335 Change-Id: I55d7c9e0d41f3be617ca7141a4121de3a56f8eef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into HEADUlf Hermann2019-03-221-83/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4jithelpers.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtimeapi_p.h src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/qqmltypemodule_p.h Change-Id: If28793e9e08418457a11fc2c5832f03cab2fcc76
| * Fix lookups the transition between primitive strings and string objectsSimon Hausmann2019-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suppose we have function foo(x) { return x.constructor; } and we call it first with foo("hello") then the lookup will be initialized with a primitive getter from the prototype. When we subsequently call foo(new String("world")) then the primitiveGetterProto() will check that the provided object is of the same type as last time, which erroneously succeeds. Indeed, both are of Managed type. However now we're passing a full-fledged object, which is not a primitive anymore - hence the additional check to ensure that we fall back to the generic getter. Task-number: QTBUG-69898 Change-Id: I3c7a8384bfdf0e31b7c6247cce80fe7448b627b3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * Make object property lookup resolution virtualSimon Hausmann2019-03-151-74/+2
| | | | | | | | | | | | | | | | | | | | This allows sub-classes of Object to have their own lookup resolution and verification logic, instead of squeezing it all into qv4lookup.cpp. The typical fallbacks are still in qv4lookup.cpp though. Task-number: QTBUG-69898 Change-Id: I32a8884982b37e2065090666a7bf05b198f5b7fd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | V4: Change both setter0 lookup methods to reflect getter0Erik Verbruggen2019-03-011-8/+15
|/ | | | | | | | | | | | | | The setter0Inline would do the index to offset calculation each time it was called, while getter0Inline would do it once when creating the lookup. Same for setter0Memberdata. Both setters now mirror the behavior of their getter counterparts. However, getterTwoClasses is more sophisticated than setterTwoClasses, so there we still use the existing setter0setter0, but restore the uncorrected index back into the two-class-lookup. Change-Id: Ide29d0304e840b2e09d65bdfc216fa8da08d69dc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Differentiate between finding for get and set in InternalClassLars Knoll2018-09-271-5/+6
| | | | | | | | This is required, so we can get rid of the requirement that getter and setter live next to each other in the member data. Change-Id: I2ed57a171628af4dfecd1836d00e958c6bed9d4f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Refactor InternalClass::find()Lars Knoll2018-09-271-19/+19
| | | | | | | | | Specialize find() into several methods for different purposes. Prepares for further cleanups and being able to split up getter and setter for accessor properties. Change-Id: Id4ec5509ac1a1361e2170bbfc2347b89b520c782 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Optimize some LookupsLars Knoll2018-09-141-1/+12
| | | | | Change-Id: Ia8dfe95d6a51a8645ece983e050bf27d868715f8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix writing to properties of primitive dataLars Knoll2018-08-021-0/+3
| | | | | | | | In strict mode, this should throw a type error and not do an implicit toObject conversion. Change-Id: I7b8cdf1125978b9d9a047d9da84f23b547cb4a75 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rename IdentifierTable methodsLars Knoll2018-07-021-3/+3
| | | | | | | identifier -> asPropertyKey Change-Id: I4e6f33bdad12e901303ec6101dd2b8d6b0e99ac4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up the property key API in StringOrSymbolLars Knoll2018-07-021-5/+4
| | | | | | | | | | | | | | Get rid of makeIdentifier(), as toPropertyKey() will take care of it. Rename identifier() to propertyKey() and check that the key is valid. Remove String/StringOrSymbol::asArrayIndex(), we don't need it anymore. Change-Id: I3c490fabc1475c9ea288b49b1638b6fa1bc237b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Replace Identifier by PropertyKeyLars Knoll2018-07-021-4/+4
| | | | | | | | 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>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-1/+1
| | | | | | | | 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>
* Fix lookups of indexed propertiesLars Knoll2018-05-141-0/+23
| | | | | | | | These can now happen through destructuring expressions, so add proper support for those. Change-Id: I3fdd4e9903ab851a5c4f5c1b64ab4e991ba7d8c1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Partial Symbol supportLars Knoll2018-05-021-3/+4
| | | | | | | | | Added basic infrastructure to create symbols and convert them back to strings. In addition, storing and retrieving of symbol based properties in Objects works. Change-Id: I185f7aa46e7afa19db5a801102142892e03b7bf1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove String dependency from InternalClassLars Knoll2018-05-021-2/+4
| | | | | | | | This is required, so we can also use Symbols in the internal classes. Change-Id: I630e7aa7b8b16d5a94041f8d18515fd582f94264 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use Identifier by value and don't new them anymoreLars Knoll2018-05-021-4/+4
| | | | | Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Reorganize Lookup data structure to make marking fasterLars Knoll2018-04-121-49/+0
| | | | | | | | | | 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 <simon.hausmann@qt.io>
* Rename InternalClass::id to protoIdLars Knoll2018-04-121-19/+19
| | | | | | | | It really identifies the 'revision' of the prototype chain that is being used with this internal class. Change-Id: Id5829c055cde2c1a2ca1032a7e831b3f0428774e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* garbage collect InternalClassLars Knoll2018-04-121-2/+50
| | | | | | | | | | | | | | | | 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 <simon.hausmann@qt.io>
* Cleanup now unused code paths in qv4lookupLars Knoll2017-11-271-71/+0
| | | | | Change-Id: Ifd3fbc128f0ff30458912c65429bcf6f577204a0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert setters to use the id in InternalClassLars Knoll2017-11-271-71/+94
| | | | | Change-Id: I7f3acf96e998a41d60d33f98b243089b9ee40ff0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert global getters to use the id in internalclassLars Knoll2017-11-271-120/+30
| | | | | Change-Id: Id443245ee9f02af48abbf5ba4811ac69ad409059 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert primitive lookups to use the new ID in internal classLars Knoll2017-11-271-125/+58
| | | | | Change-Id: I1c2c3242f2a48e4e75b66b187127fcd362cd61c6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Refactor getter lookupsLars Knoll2017-11-271-158/+134
| | | | | | | | | | Use the new id of InternalClass to simplify out lookup code for getters. Now all lookups in the prototype chain can be done at the same speed independent of the depth within the prototype chain with only two checks. Change-Id: I7d8451cc54c0ac50c1bcb4ae3bf386fd5f2a84aa Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Simplify inline gettersLars Knoll2017-11-141-11/+13
| | | | | | | Precalculate the offset inside the object. Change-Id: I61faf463677fe9602fe235a39dcf9e16c5d013cd Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Further cleanup JSCallDataLars Knoll2017-11-071-5/+5
| | | | | | | Avoid allocations on the JS stack if possible Change-Id: I344cd6dceb6264314f9d22c94db22b22d1d24d14 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Simplify JSCallData constructionLars Knoll2017-11-071-8/+8
| | | | | Change-Id: Ic53532edae9a209aa7125af6f00a9d993d74f1a3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Get rid of JSCallData::call()Lars Knoll2017-11-071-21/+21
| | | | | Change-Id: I6b99e9a7102b3dcb6a7699f54b6456eba6248699 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Rename JSCall to JSCallDataLars Knoll2017-11-071-8/+8
| | | | | | | | 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>
* Always set the correct FunctionObject when calling JS functionsLars Knoll2017-09-021-24/+21
| | | | | | | | | 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>
* Move ScopedCallData and ScopedStackFrame into a separate fileLars Knoll2017-09-011-1/+1
| | | | | Change-Id: I9ae42aa7a811aa93fe0950725e9d253a0c5e8dba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/new-backendLars Knoll2017-08-221-2/+3
|\ | | | | | | Change-Id: Iff06429f948ac6cdec77a9e5bb8c5375c56fe705
| * Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-08-181-2/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/qml/qqmlcustomparser.cpp src/qml/qml/qqmlimport.cpp src/qml/qml/qqmlimport_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypenamecache.cpp src/qml/qml/qqmltypenamecache_p.h src/qml/qml/qqmltypewrapper.cpp src/qml/qml/qqmltypewrapper_p.h src/qml/qml/qqmlvmemetaobject.cpp src/qml/util/qqmladaptormodel.cpp Change-Id: Ic959d03e6f9c328fb02710d9abbb0f27cddde131
| | * Improve releasing of memory allocated from compilation unit stringsSimon Hausmann2017-08-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocate the strings in the compilation unit as regular strings, not as identifiers. We mark the runtimeStrings in the compilation unit, so when the unit is released as part of component cache trimming, those strings can also be collected. The JS object literal class keys have to remain identifiers though. However this is just a stop-gap as the real problem is that the identifier table can be triggered to grow without bounds. Task-number: QTBUG-61536 Change-Id: I7a2854b7fa9c9953348b5e34a31833f7be67cfbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Avoid creating a CallContext for simple functionsLars Knoll2017-08-101-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | This cuts out quite a bit of overhead when entering and leaving functions. Change-Id: I32670c98a4087ea3b2d45853d9cabff9066399e8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Don't throw errors from the internal put methods anymoreLars Knoll2017-08-101-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | Instead do it in the VME, where we can then easily separate into throwing and non throwing versions by bytecode. Change-Id: Ie63bd5b3610bb85f26fb8979179b2e239876cd97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Remove unused lookup typesLars Knoll2017-08-101-134/+0
| | | | | | | | | | | | | | | | | | | | | | | | The indexed getters and setters haven't been used for a while and don't offer any performance benefits currently. Change-Id: Ifd5e1fab934e6e9940c4f1ad67f8850f04597504 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Change function signatures for call/construct backLars Knoll2017-08-041-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Get rid of the compilation unit related members in ExecutionContextLars Knoll2017-08-031-7/+7
|/ / | | | | | | | | | | | | | | | | | | And change the signature for VME::exec to take the QV4::Function that should be executed. This is in preparation to being able to run functions that will not need to allocate an execution context on their own. Change-Id: I34538a8723006f4ec24583805e88a66e750100c3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-75/+197
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 lookups based on IC changesLars Knoll2017-05-191-23/+27
| | | | | | | | | | Change-Id: I1f4f4aaad0c8194bce2ebde4503df38cab0990a2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Move the prototype into the internal classLars Knoll2017-05-191-30/+30
| | | | | | | | | | | | | | | | | | | | 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>
| * Properly encapsulate all accesses to the vtableLars Knoll2017-05-191-2/+2
| | | | | | | | | | Change-Id: I3f6ae59d01c7b6c898e98d3b6f65b84a19b8851a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Optimize other lookupsLars Knoll2017-05-081-21/+49
| | | | | | | | | | | | | | | | | | Add some more optimized lookups for accessing properties stored inline or in the memberData. Change-Id: Id74901d1dd91fd60933bf164c2bf90fed86232e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
| * Re-add some inline property storageLars Knoll2017-05-081-19/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Implement a real write barrierLars Knoll2017-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | Implement a Steel write barrier for our objects. The barrier is interesting as it can also be used for incremental GC runs by simply turning the barrier on and leaving old objects marked as black. Change-Id: I0b273974d94a990dee3cd9298089b8b202c75bf2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Make writes to ArrayData write-barrier safeLars Knoll2017-03-091-2/+2
| | | | | | | | | | Change-Id: I2e46100fe72fd83b36b3195130eefce5289d1627 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-10/+10
| | | | | | | | | | | | | | | | 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>