aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup defineOwnPropertyLars Knoll2018-06-261-5/+10
| | | | | | | | | | | | | | | | Make it a vtable method as required by the ES7 spec. Change all calls sites to call through the virtual function. Adjust ArgumentsObject and give it it's own defineOwnProperty implementation instead of hacking it into the base implementation. Move the array object specific handling into a reimplementation. Change-Id: I48c960c4c69f99b178628c94b4808be2bab0dccc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify deleteProperty and deleteIndexedProperty vtable methodsLars Knoll2018-06-261-11/+5
| | | | | Change-Id: I25245818c6ff2104642594476cb9684bac824f29 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Proxy support for prototype handlingLars Knoll2018-06-251-3/+10
| | | | | | | | | | | | | | Cleanup get/setPrototypeOf and fix some smaller incompatibilities in the default implementation for Object. Add the methods to the vtable and reimplement them according to spec for ProxyObjects. Clean up the Object.prototype.get/setPrototypeOf/__proto__ methods and fix a smaller bug in the Reflect API for those methods. Change-Id: I6e438753332ec4db963d6cdcf86f340ff212777a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Support preventExtensions in Proxy handlersLars Knoll2018-06-251-0/+4
| | | | | Change-Id: I03aaacc260bdb46eb09c597598a45fbb25d6d7b6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for isExtensible in proxy handlersLars Knoll2018-06-251-1/+4
| | | | | Change-Id: I580ff0ab33fa58bcd42f6cc500f4a20ee5b05e87 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add virtual interface for hasPropertyLars Knoll2018-06-251-2/+6
| | | | | | | This is required to correctly support Proxy Change-Id: I95ec17e919915290a05ad9501cd649452ab82135 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement a virtual interface for getOwnPropertyLars Knoll2018-06-251-15/+6
| | | | | | | | | | | | This is required to support Proxy properly, and at the same time fixes a couple of test failures. The new interface also replaces the old query and queryIndexed virtual interfaces, as those where doing a subset of what getOwnProperty does. Change-Id: I750e366b475ce971d6d9edf35fa17b7a2b07f771 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qv4arrayobject: Implement Array.prototype.fill according to ES7Robin Burchell2018-05-251-0/+17
| | | | | | Task-number: QTBUG-56824 Change-Id: Ib12b9fe5ebdd5375f17cf4927eb9b4e292731932 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Implement Symbol.species getter functionsLars Knoll2018-05-151-0/+2
| | | | | Change-Id: I18b3e382e679f95d7cb53b4ed03be2513ea0204b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix another ubsan warningLars Knoll2018-05-041-1/+1
| | | | | | | Don't call asReturnedValue() on something that might be null. Change-Id: I31ab7df7e353dee0718957ec0d5b4edcc72f7a56 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add attributes argument to defineDefaultProperty overloadLars Knoll2018-05-021-1/+1
| | | | | Change-Id: I34da7966125b892a9a106b1a4ca8552abad45cdb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup creation code for builtin functionsLars Knoll2018-05-021-6/+7
| | | | | | | | Centralize the code in FunctionObject::createBuiltinFunction and setup function names and length properties there. Change-Id: I21f1d42b475070ee091d96d97387149af1dc47f2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fixes when using getLength()Lars Knoll2018-05-021-1/+1
| | | | | | | Do some more bounds checking to avoid crashes. Change-Id: I44e838c3577a9176628aa5e382d712eac9800203 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add SymbolObject, well known symbols and fix most remaining issuesLars Knoll2018-05-021-10/+12
| | | | | | | | | Added SymbolObject, the equivalent to StringObject which was still missing so far. Added the predefined standard symbols, and fixed most test failures related to symbols. Change-Id: I1e28b439e7c4f5141b4a09bd8fb666c60691f192 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Change Objects vtable methods to take a StringOrSymbolLars Knoll2018-05-021-19/+19
| | | | | | | This is needed for symbol support. Change-Id: I83db21f232168710d18999fd97d912016e86d630 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>
* The length of array like objects can in some cases be 2^53 -1 in ES7Lars Knoll2018-05-021-4/+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>
* garbage collect InternalClassLars Knoll2018-04-121-1/+1
| | | | | | | | | | | | | | | | 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>
* Remove dependency from qv4heap_p.h onto qv4internalclass_p.hLars Knoll2018-04-121-1/+5
| | | | | | | | This is required to be able to turn the internal class into something that lives on the GC heap. Change-Id: Ie4318588d420743b1e1ab1cd596a1c9d153eb793 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-7/+7
| | | | | | | | | | | | | 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-2/+0
| | | | | Change-Id: If4748db470e053d0980700cedc33676359abb067 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Disentangle include dependencies around the write barrierLars Knoll2018-01-191-2/+2
| | | | | | | The write barrier header should have minimal dependencies. Change-Id: I071718c2fafe5020d1093ca3b363844f7a9b7b35 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of BuiltinFunctionLars Knoll2018-01-151-10/+0
| | | | | | | It's now unused. Change-Id: Id2941c212d488c9b0933fa06aac9922b9db13a05 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Raise minimum supported MSVC version to 2015Friedemann Kleint2018-01-061-1/+1
| | | | | | | | | | | | Remove code for older versions and streamline #ifdefs. Remove the helpers macros Q_STATIC_ASSERT_FOR_SANE_COMPILERS and V4_ASSERT_IS_TRIVIAL. Task-number: QTBUG-40658 Task-number: QTBUG-51673 Change-Id: Ifa4fab653b10ce7858739adef08364cddc6507cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert setters to use the id in InternalClassLars Knoll2017-11-271-5/+0
| | | | | Change-Id: I7f3acf96e998a41d60d33f98b243089b9ee40ff0 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Refactor getter lookupsLars Knoll2017-11-271-6/+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/+2
| | | | | | | | | | | | | | | 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>
* Allow tuning the amount of inline properties per object typeLars Knoll2017-11-151-0/+2
| | | | | | | | | Different JS objects need different amount of properties by default. Tune the amount of inline properties we pre-allocate by what's usually needed for the object. Change-Id: I2703d123939f9b7e3a06531361cbb6a3a3c04944 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Simplify inline gettersLars Knoll2017-11-141-0/+4
| | | | | | | 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-8/+5
| | | | | | | | 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>
* Get rid of the last usage of the V4_OBJECT macroLars Knoll2017-11-141-15/+0
| | | | | | | It's been deprecated for quite a long time. Change-Id: I075f8c0204edbadb7430ca6e380b2760e1775b4e Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert methods of RegExp to new calling conventionLars Knoll2017-11-131-0/+4
| | | | | Change-Id: Ie364357b5e1ecf09eb264181e11b0247b07fad6c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Introduce new calling convention for builtin functionsLars Knoll2017-11-131-0/+4
| | | | | | | 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-3/+3
| | | | | | | To make it consistent with the rest of the engine. Change-Id: I57b98fa26134f9864c663f47371ef3e9ca16ac9c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add functions pointers for call/construct to FunctionObjectLars Knoll2017-11-071-4/+0
| | | | | | | | This will allow us to avoid one level of indirection when calling js functions in the future. Change-Id: I814b72d18adb5a5580c11053e53b582549b629fc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Don't throw errors from the internal put methods anymoreLars Knoll2017-08-101-17/+4
| | | | | | | | 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 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-8/+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>
* Don't use the ISel's anymoreLars Knoll2017-06-221-0/+1
| | | | | | | | 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-19/+55
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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-4/+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>
| * Move the prototype into the internal classLars Knoll2017-05-191-2/+2
| | | | | | | | | | | | | | | | | | | | 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/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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-8/+8
| | | | | | | | | | Change-Id: I3f6ae59d01c7b6c898e98d3b6f65b84a19b8851a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Add ICs for String, MemberData and ArrayDataLars Knoll2017-05-191-3/+0
| | | | | | | | | | Change-Id: I43ddcb4842e501cbea8a950ab6ffa2d906014efd 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>
| * Optimize other lookupsLars Knoll2017-05-081-0/+4
| | | | | | | | | | | | | | | | | | 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-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>