aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* | Remove String dependency from InternalClassLars Knoll2018-05-021-4/+5
| | | | | | | | | | | | | | | | This is required, so we can also use Symbols in the internal classes. Change-Id: I630e7aa7b8b16d5a94041f8d18515fd582f94264 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Unify MemberData::Index and ArrayData::IndexLars Knoll2018-05-021-5/+5
| | | | | | | | | | | | | | | | Both classes basically did the same thing. Unify them in a new PropertyIndex class. Change-Id: Ieb6fb670e4d204bf20ee4c0b70b4381c95c6268e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Use Identifier by value and don't new them anymoreLars Knoll2018-05-021-8/+8
| | | | | | | | | | Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | The length of array like objects can in some cases be 2^53 -1 in ES7Lars Knoll2018-05-021-6/+4
| | | | | | | | | | | | | | | | | | Add a Value::getLength(), that converts a Value to a length bound between 0 and 2^53-1 as per ES7 spec. Use the extended range in Array.prototype.splice and map to fix hanging test cases. Change-Id: If9280d501423cfc10a60abd4e8aa30521d2a7bca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-181-3/+1
|\| | | | | | | Change-Id: I4a9c7802c180757e70fa4dd16df3287104a088bc
| * Remove a bogus assertLars Knoll2018-04-161-3/+1
| | | | | | | | | | | | | | | | | | It's actually possible to have oldLength != 0 and no arrayData in this code path if someone redefines the length property of the JS array. Change-Id: Ib699425b95fa1e1981483ccb2b2babd476b86f60 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | garbage collect InternalClassLars Knoll2018-04-121-8/+9
|/ | | | | | | | | | | | | | | | 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>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-12/+12
| | | | | | | | | | | | | 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 <simon.hausmann@qt.io>
* Remove unused methodLars Knoll2018-01-191-5/+0
| | | | | Change-Id: If4748db470e053d0980700cedc33676359abb067 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the freeList from Heap::ArrayData to SparseArrayLars Knoll2018-01-151-1/+0
| | | | | | | It's only used for sparse arrays, so the data should live there. Change-Id: I9ca04c73dd2dbebf459ee64c164a69681623a351 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of BuiltinFunctionLars Knoll2018-01-151-46/+4
| | | | | | | It's now unused. Change-Id: Id2941c212d488c9b0933fa06aac9922b9db13a05 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert setters to use the id in InternalClassLars Knoll2017-11-271-54/+0
| | | | | Change-Id: I7f3acf96e998a41d60d33f98b243089b9ee40ff0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Refactor getter lookupsLars Knoll2017-11-271-54/+0
| | | | | | | | | | 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>
* Add a unique id to InternalClass that describes it's total stateLars Knoll2017-11-271-0/+7
| | | | | | | | | | | | | | | 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 <erik.verbruggen@qt.io>
* Speed up Object::internalGet()Lars Knoll2017-11-151-4/+3
| | | | | | | There's no need for a scope here. Change-Id: I7e4ed199df632293b6a010c1fa7662a5446b73ee Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Avoid marking on simple array data'sLars Knoll2017-11-141-2/+5
| | | | | | | Speeds up things by 2-3%. Change-Id: Ib17ab126cf91ce48a0ced7dd7b06c4f7f0a70a3b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Simplify inline gettersLars Knoll2017-11-141-2/+3
| | | | | | | Precalculate the offset inside the object. Change-Id: I61faf463677fe9602fe235a39dcf9e16c5d013cd Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Bring back markObjects(), this time generatedLars Knoll2017-11-141-2/+11
| | | | | | | | Doing the marking of objects in a function instead of using the table seems to be somewhat faster. Change-Id: I9ec00cc0264f9a15c69b285db493bee31d99bf96 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert methods of RegExp to new calling conventionLars Knoll2017-11-131-0/+23
| | | | | Change-Id: Ie364357b5e1ecf09eb264181e11b0247b07fad6c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Introduce new calling convention for builtin functionsLars Knoll2017-11-131-0/+21
| | | | | | | And implement Function.apply()/call() with it. Change-Id: I028c82d5f9adfd23328d669db1adccec9de5824c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Change signature for call/callAsConstructorLars Knoll2017-11-071-4/+4
| | | | | Change-Id: I159b57acc7a2133ef1ad545aa84e792c63449a57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename the construct 'virtual' method to callAsConstructorLars Knoll2017-11-071-1/+1
| | | | | | | To make it consistent with the rest of the engine. Change-Id: I57b98fa26134f9864c663f47371ef3e9ca16ac9c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Further cleanup JSCallDataLars Knoll2017-11-071-4/+4
| | | | | | | 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-4/+4
| | | | | Change-Id: Ic53532edae9a209aa7125af6f00a9d993d74f1a3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Get rid of JSCallData::call()Lars Knoll2017-11-071-15/+15
| | | | | Change-Id: I6b99e9a7102b3dcb6a7699f54b6456eba6248699 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Rename JSCall to JSCallDataLars Knoll2017-11-071-4/+4
| | | | | | | | 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-17/+17
| | | | | | | | | 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-0/+1
| | | | | Change-Id: I9ae42aa7a811aa93fe0950725e9d253a0c5e8dba Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Avoid creating a CallContext for simple functionsLars Knoll2017-08-101-2/+2
| | | | | | | | 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 exceptions in Object::delete(indexed) anymoreLars Knoll2017-08-101-4/+0
| | | | | Change-Id: I8613ab21eb1435903e2a8514c21fe51f4a305a2f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't throw errors from the internal put methods anymoreLars Knoll2017-08-101-49/+31
| | | | | | | | 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>
* Don't throw from within defineOwnPropertyLars Knoll2017-08-101-27/+11
| | | | | | | | | There's no need to to this there, rather throw from the places we call those methods. This also removes some more places where we access the strictMode flag of the context. Change-Id: I4bebc9d3c242850f06230d9116479a85a944dca3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-6/+6
| | | | | | | | Allow for faster calling of builtins, and completely avoid scope creation in many cases. Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Change function signatures for call/construct backLars Knoll2017-08-041-9/+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-2/+2
| | | | | | | | | | 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>
* Don't use the ISel's anymoreLars Knoll2017-06-221-2/+0
| | | | | | | | Move the code that generates the CompilationUnit over to Codegen, and don't use the ISel's at all anymore when compiling JS/QML. Change-Id: Iba89082c386c3d3fd58ac25a4651c5d39178cc5c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-66/+67
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Move the engine() accessor from Object to ManagedLars Knoll2017-05-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | We can easily do this now that Managed has a pointer to an internal class (which always has a back pointer to the ExecutionEngine). Remove the extra engine pointer from ExecutionContext, and clean up tow methods in String. Change-Id: I98d750b1afbdeadf42e66ae0c92c48db1a7adc31 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
| * Get rid of the old way of defining builtin functionsLars Knoll2017-05-191-40/+0
| | | | | | | | | | | | | | | | | | | | The old calling convention used for builtin functions is very inefficient. It was still being used in a few places. Clean those up and convert them to the new and much more effiecient calling convention. Change-Id: I6b769c6185df7e9be1e80709330fc1ca868576c1 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
| * Optimize lookups in the internalClassLars Knoll2017-05-191-8/+22
| | | | | | | | | | | | | | | | 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>
| * Optimize lookups based on IC changesLars Knoll2017-05-191-0/+2
| | | | | | | | | | Change-Id: I1f4f4aaad0c8194bce2ebde4503df38cab0990a2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Move the prototype into the internal classLars Knoll2017-05-191-8/+7
| | | | | | | | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Properly encapsulate all accesses to the vtableLars Knoll2017-05-191-3/+3
| | | | | | | | | | Change-Id: I3f6ae59d01c7b6c898e98d3b6f65b84a19b8851a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Optimize other lookupsLars Knoll2017-05-081-1/+1
| | | | | | | | | | | | | | | | | | 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-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Make writes to ArrayData write-barrier safeLars Knoll2017-03-091-3/+4
| | | | | | | | | | Change-Id: I2e46100fe72fd83b36b3195130eefce5289d1627 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-8/+8
| | | | | | | | | | | | | | | | 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 methods returning a pointer to a Property structureLars Knoll2017-03-091-15/+11
| | | | | | | | | | | | | | Those are unsafe to use when we introduce write barriers. Change-Id: I686b3544437fc344d14f3561173521600ecb77a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Change getValueOrSetter to be write barrier friendlyLars Knoll2017-03-091-44/+50
| | | | | | | | | | | | | | | | Don't return a naked pointer into the heap, as this makes it impossible to track where and when we're writing into it. Change-Id: I2b9b81779ef8e9fb7a643ddda82aa6af8af459a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>