aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make Array.prototype.concat comply better with the specLars Knoll2018-07-301-0/+27
| | | | | | | | There are still some failures in the test cases, but at least less than before. Change-Id: I5bad4ddb1e9d6fe120e981f806a6d986fd43b64d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for new.targetLars Knoll2018-07-031-1/+1
| | | | | | | | | Support the new.target meta property in the codegen, and add support for passing the newtarget into the constructor vtable methods and the execution context. Change-Id: I62ea58e5e92d894035a76e35776203e9837c383b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prefix vtable methods with virtualLars Knoll2018-07-031-19/+19
| | | | | | | | | Turns out that the overloading of vtable methods and regular ones is problematic in some cases. So let's rather make it explicit which methods are part of the vtable, and which aren't. Change-Id: Ifee32a26104d30f3c82bca8b5a9cdea2d4f4f526 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify the managed and object vtablesLars Knoll2018-07-031-6/+5
| | | | | | | | | | Allow for nullptr entries in the vtable. To nevertheless get some decent error checking if one of the methods is reimplemented, use a base class for Managed that contains a full set of the vtable entries all being nullptr's. Change-Id: Ibc53973b539f87331e8e465a6c44436a30acbefd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up the property key API in StringOrSymbolLars Knoll2018-07-021-10/+9
| | | | | | | | | | | | | | 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-12/+12
| | | | | | | | 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>
* Cleanups in the Identifier APILars Knoll2018-07-021-6/+6
| | | | | | | | | | 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 <simon.hausmann@qt.io>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-16/+13
| | | | | | | | 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>
* Unify put and putIndexedLars Knoll2018-07-021-131/+66
| | | | | | | | | | Pass an Identifier through those virtual methods to unify the string and integer based versions. Also add the receiver that's required in ES7 Change-Id: I4e7f01b4c97cc80bcb3c485f6343f28213dc9e6b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup defineOwnPropertyLars Knoll2018-06-261-113/+107
| | | | | | | | | | | | | | | | 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-26/+14
| | | | | Change-Id: I25245818c6ff2104642594476cb9684bac824f29 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move special handling of getOwnProperty for StringObject where it belongsLars Knoll2018-06-261-8/+0
| | | | | | | | Move the code into a virtual method of StringObject, bringing us closer in line with the ES7 spec. Change-Id: Iaf460f5a5517fe059a30be8c403d71625453b80a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.11' into dev" into ↵Liang Qi2018-06-251-5/+2
|\ | | | | | | refs/staging/dev
| * Merge remote-tracking branch 'origin/5.11' into devUlf Hermann2018-06-251-5/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/quick/handlers/qquickhandlerpoint.cpp src/quick/handlers/qquicksinglepointhandler.cpp tests/auto/qml/ecmascripttests/test262 Change-Id: I8908ec8c6116ca626fbd269af7625d4c429429ca
| | * revert change 353164263c55825a0ec72d30128c50560c626334Lars Knoll2018-06-191-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change was too aggressive in trying to avoid marking the array data. We didn't catch all cases where on could be inserting a GC controlled object into the array data. Let's be safe and always mark the content of array data objects. Task-number: QTBUG-68894 Change-Id: Ifbb628be898c0903596b1a483212384295b01df5 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Add Proxy support for prototype handlingLars Knoll2018-06-251-19/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | Change-Id: I03aaacc260bdb46eb09c597598a45fbb25d6d7b6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add support for isExtensible in proxy handlersLars Knoll2018-06-251-0/+5
| | | | | | | | | | | | | | | Change-Id: I580ff0ab33fa58bcd42f6cc500f4a20ee5b05e87 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add virtual interface for hasPropertyLars Knoll2018-06-251-32/+15
| | | | | | | | | | | | | | | | | | | | | 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-107/+39
|/ / | | | | | | | | | | | | | | | | | | | | | | 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>
* | skip Symbol properties in for-in loopsLars Knoll2018-06-041-1/+2
| | | | | | | | | | Change-Id: Id161269329d3cd34357580730999e4dee5b0135f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix Object::defineAccessorPropertyLars Knoll2018-06-041-3/+16
| | | | | | | | | | | | | | | | Create setter and getter functions with proper names and make the property configurable to be compliant with the ES7 spec. Change-Id: I13b24f540fdd3261cf29b660aa3393d661acacfd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement Symbol.species getter functionsLars Knoll2018-05-151-0/+10
| | | | | | | | | | Change-Id: I18b3e382e679f95d7cb53b4ed03be2513ea0204b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add attributes argument to defineDefaultProperty overloadLars Knoll2018-05-021-2/+2
| | | | | | | | | | Change-Id: I34da7966125b892a9a106b1a4ca8552abad45cdb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Cleanup creation code for builtin functionsLars Knoll2018-05-021-18/+8
| | | | | | | | | | | | | | | | 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>
* | Don't use stringForId() anymoreLars Knoll2018-05-021-1/+1
| | | | | | | | | | | | | | | | The identifier has a backpointer to it's heap object, which could also be a symbol. Change-Id: I976db1424ec66f8e41e6ce4d76620c6b57d94a62 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add SymbolObject, well known symbols and fix most remaining issuesLars Knoll2018-05-021-11/+16
| | | | | | | | | | | | | | | | | | 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>
* | Garbage collect identifiersLars Knoll2018-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <simon.hausmann@qt.io>
* | Change Objects vtable methods to take a StringOrSymbolLars Knoll2018-05-021-12/+13
| | | | | | | | | | | | | | This is needed for symbol support. Change-Id: I83db21f232168710d18999fd97d912016e86d630 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | 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>