aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stringobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace all includes of windows.h with qt_windows.hUlf Hermann2021-10-251-1/+1
| | | | | | | We don't want min and max to be macros. Change-Id: Ifa79eaecf00c9f8b9c61494aa9d883eebfdabc65 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QV4::Scope::hasException() where applicableUlf Hermann2021-06-301-4/+4
| | | | | | | It is shorter and encapsulates the exception handling a bit. Change-Id: I8e2dc0eb3b930e222b8cb4852b73d99ca18a0379 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QV4 Engine: Remove MSVC special casingFabian Kosmale2020-12-101-2/+2
| | | | | | | | | | This patch removes a workaround for old versions of MSVC; we should be able to rely on the standard library nowadays. Original-patch-by: Alexander Neumann Fixes: QTBUG-89203 Change-Id: I8047565000fc7e4e3b8ac28584ff4a479b648274 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* V4 string object: Avoid some compile warningsUlf Hermann2020-11-091-2/+2
| | | | | | | | Assigning a plain char to QChar is deprecated. What we want here is the special Null character, though. Change-Id: I0f3cd56c8820fdf5afa40cf608e738e04163680a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qtdeclarative: finish fixing compilation with explicit QChar(int)David Faure2020-11-071-3/+3
| | | | | Change-Id: Idb26e2df6d4fe8940db57066a30fa8c243f6d2c9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Do not write the 0 terminator for QStringLars Knoll2020-09-151-2/+0
| | | | | | | | | | | | | QString does this for us in any case, and writing there was always undefined behavior. This is causing problems after an optimization in QString, where creating a QString with size 0 will avoid any memory allocation and simply point to the (readonly) _empty member in QString. Change-Id: I0516dc2e8672b8290efa891bd9b5486dac8021b6 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-8/+8
| | | | | | | | Task-number: QTBUG-84319 Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Check in even more places for exceptionsFabian Kosmale2020-04-211-1/+2
| | | | | | | | | Amends commit 4c5ed04e64ea9ac0038ae30e1189cfe745b29bd9 Task-number: QTBUG-83384 Pick-to: 5.15 5.12 Change-Id: I0918c27dfa73dff83cbf0f58b41ce8620dff8a0a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4: Check for exceptions before we use the result of a JS callUlf Hermann2020-01-231-1/+1
| | | | | | | | If the call resulted in an exception the return value is undefined. Task-number: QTBUG-81581 Change-Id: Ibfdd5e1229cf5437f270232d3b1a91308adeec72 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Split compiler and runtime more clearlyUlf Hermann2019-07-111-1/+1
| | | | | | | | Provide different export macros and different top level headers for each, don't include runtime headers from compiler sources. Change-Id: I7dc3f8c95839a00a871ba045ec65af87123154be Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-181-2/+1
|\ | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlimport.cpp Change-Id: I6add6267297ea50a646d43d212027a168dca8916
| * Fix string replacement with invalid capturesUlf Hermann2019-04-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | If we have a theoretically valid capture reference that just didn't capture anything in this match, we don't want to treat it as literal. Only capture references that clearly are outside the range of things we can possibly capture with this expression should be treated as literal strings. Change-Id: Iab0bf329d11a6b9e172aa662f11751d86cfc26a6 Fixes: QTBUG-75121 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Don't use UINT_MAX as invalid array index in PropertyKeyUlf Hermann2019-04-161-7/+8
|/ | | | | | | | | | | Technically UINT_MAX is actually a valid array index, although that is an academic problem right now. However, we do have a method isArrayIndex() and should just use that to determine if a PropertyKey is an array index. Fixes: QTBUG-73893 Change-Id: I302e7894331ed2ab4717f7d8d6cc7d8974dabb4e Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Don't keep raw pointers to SparseArrayNodeUlf Hermann2019-03-141-1/+1
| | | | | | | | | | | | The nodes are owned by the SparseArrayData and will be freed whenever an item is deleted from the array. Therefore, we have to look up the node for each iteration. This is slightly slower, but at least it doesn't crash. Fixes: QTBUG-74188 Change-Id: Id24324a8c83b00b3ad1212cdaabccabd6c8a999f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Bring behavior of String.replace() in line with other enginesLars Knoll2019-01-251-14/+25
| | | | | | | | | | | | | | | | "x".replace("x", "$1") gives "$1" in both JSC and V8, as there are no captures that could be used as a replacement for $1. Implement the same behavior as it's the most logical thing to do (even though it's undefined according to the spec). Two digit captures ($nm) work in a way that they get applied if $nm captures exist. If there are less than nm but more than n captures available $n is replaced by the n'th capture and m is copied over verbatim. Change-Id: I8b5f576f2c42c8334859ab7854dcdf07104dd35b Fixes: QTBUG-73152 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Ensure our builtin constructors are subclassableLars Knoll2018-11-221-2/+8
| | | | | | | | | Respect the newTarget passed into those constructors and make sure we set up the proto chain correctly. Change-Id: I3d12c7dbef4b33660a6715d73e9fb0f89105167a Fixes: QTBUG-71138 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* INTEGRITY: Fix build failures on 64-bit ARMPasi Petäjäjärvi2018-10-221-2/+2
| | | | | Change-Id: I44a90dec16dc1421a32a7770b353a4df14c057f9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make Object::getOwnProperty() constLars Knoll2018-09-231-3/+3
| | | | | | | | Object::getOwnProperty never modifies the object, so make it a const member function. Change-Id: I175bb45d61a66a1d9f577c087129562d44d62e17 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-22/+22
| | | | | | | | | | | | Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix ownKey iteration over Proxy objectsLars Knoll2018-09-091-1/+2
| | | | | Change-Id: I045a4844c06df9232cc8b04485ab0a39bb990e3f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix some details in RegExp handlingLars Knoll2018-08-151-1/+4
| | | | | Change-Id: If9f7c07ea657ba8503b9188a7b77e301f23423ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.prototype.match as per ES7 specLars Knoll2018-08-151-29/+17
| | | | | | | The implementation is supposed to call arg[Symbol.match]. Change-Id: Ia8028d259e152b1e65eb6b0e817ef60bdc0d37e2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.rawLars Knoll2018-08-061-0/+42
| | | | | Change-Id: I331fd4d114f68fb5cb71186813f851af25539ffa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement ObjectIterator using the new iteration mechanismLars Knoll2018-08-021-29/+0
| | | | | | | And with that get rid of the old advanceIterator methods. Change-Id: I969fa89d25df8992a4b08c8c081b91c92ffdfddd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce a new mechanism to iterate over object propertiesLars Knoll2018-08-021-11/+45
| | | | | | | | | | | | | | | | | The old advanceIterator schema was extremely ugly and in addition not flexible enough to support the requirements for Proxy.ownKeys and some of the methods in Object Implemented a new scheme through a OwnPropertyKeys method in the Object VTable that creates and returns an iterator object. Ported QJSValueIterator and for-in to use the new mechanism. There's still many places where we use the old ObjectIterator (that relies on advanceIterator). Those will be ported in subsequent commits. Change-Id: I091a9bea9ff6b2b63630cc336814700757a718be Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for new.targetLars Knoll2018-07-031-2/+2
| | | | | | | | | 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-9/+9
| | | | | | | | | 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>
* Replace Identifier by PropertyKeyLars Knoll2018-07-021-3/+3
| | | | | | | | 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 deleteProperty and deleteIndexedProperty vtable methodsLars Knoll2018-06-261-9/+9
| | | | | Change-Id: I25245818c6ff2104642594476cb9684bac824f29 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move special handling of getOwnProperty for StringObject where it belongsLars Knoll2018-06-261-0/+20
| | | | | | | | 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>
* Fix length properties of global constructorsLars Knoll2018-06-251-1/+1
| | | | | Change-Id: I4e9e1635f404082b0e8b333dc13a33d27e4f4b50 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement a virtual interface for getOwnPropertyLars Knoll2018-06-251-2/+1
| | | | | | | | | | | | 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>
* Implement String.prototype.padEnd/padStartLars Knoll2018-05-231-0/+84
| | | | | Change-Id: I3ff082fd2d7764f87dd079901750fe668f553521 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.prototype.normalizeLars Knoll2018-05-231-0/+28
| | | | | Change-Id: Ic018606ddb92772705bbb06aaed07722827737ea Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.fromCodePointLars Knoll2018-05-151-12/+42
| | | | | | | And add a zero termination in String.fromCharCode. Change-Id: Id86b9e35bfbf2e41f3a461d7b8f4c108df30f741 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement String.prototype.codePointAtLars Knoll2018-05-151-0/+24
| | | | | Change-Id: I30f19d750ee4cde767912c87bbc53d3abc0f6bb5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Avoid accessing an object with this == nullptrLars Knoll2018-05-041-0/+1
| | | | | | | | | Get rid of a circular dependency when initializing StringObject.prototype, by setting it's string value later during the initialization process. Change-Id: I5bdaff3936c1f8af12c4d53f95747b8aa43f4ef6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement StringIteratorLars Knoll2018-05-021-0/+15
| | | | | | | | Add support for String.prototype[Symbol.iterator] and the StringIterator object. Change-Id: I72c4f988e4f363be1af51f9cc5f8e83af43cd151 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fixes to symbol handling in StringObject and toString()Lars Knoll2018-05-021-24/+21
| | | | | Change-Id: I0990e9610a3200502719191fa0a4174ba9ee1903 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Partial Symbol supportLars Knoll2018-05-021-3/+11
| | | | | | | | | 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>
* Fix JIT build on INTEGRITY ARM64Kimmo Ollila2018-04-261-2/+2
| | | | | | | | | | | -typedef "Jump" may not be used in an elaborated type specifier -explicit specialization of function must precede its first use -"Value" is ambiguous Change-Id: Ic15c196f1b33211cd3f2f25a54ba478747336fe4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-3/+3
| | | | | | | | | | | | | 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>
* Fix a couple of places where we'd free used objectsLars Knoll2018-01-261-3/+4
| | | | | | | | Make sure all our JS objects are referenced from the JS stack before calling into the memory manager. Change-Id: I88d622d37b9d6cfc19db4045ebd3fadc5bb4cabe Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce a SubString String typeLars Knoll2018-01-191-3/+13
| | | | | | | | Use it in regexp matching. There's probably other places where we should use this as well. Change-Id: Ie2774acff0a5ec7b1c26c564fa40e65fecea29d4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split up String type into a regular and a ComplexStringLars Knoll2018-01-191-1/+1
| | | | | | | | Saves some memory for many cases, and will allow re-using the String itself as an identifier Change-Id: I462d63bc6f113dff1dce0de28ee4eea3949a4b95 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Convert String methods to new calling conventionLars Knoll2017-11-131-139/+123
| | | | | Change-Id: I6de932817fc26c7a35b004926cd3ca84e42272ad Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Convert methods of RegExp to new calling conventionLars Knoll2017-11-131-2/+2
| | | | | Change-Id: Ie364357b5e1ecf09eb264181e11b0247b07fad6c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Change signature for call/callAsConstructorLars Knoll2017-11-071-8/+8
| | | | | Change-Id: I159b57acc7a2133ef1ad545aa84e792c63449a57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename the construct 'virtual' method to callAsConstructorLars Knoll2017-11-071-2/+2
| | | | | | | 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-1/+1
| | | | | | | Avoid allocations on the JS stack if possible Change-Id: I344cd6dceb6264314f9d22c94db22b22d1d24d14 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>