aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Support QRegularExpression on the same level as QRegExpUlf Hermann2019-03-201-0/+36
| | | | | | | | | | | | | | | | | QRegularExpression is the recommended way to do regular expressions nowadays. Support assignment of JavaScript regular expressions to QRegularExpression properties of QObjects and the other way around. QJSValue::toVariant() will create a QRegularExpression from a JavaScript RegExp by default now. [ChangeLog][QtQml][Important Behavior Changes] QRegularExpression is now supported the same way QRegExp is in QML. QJSValue::toVariant() creates a QRegularExpression variant rather than a QRegExp one from a JavaScript regular expression now. Fixes: QTBUG-73429 Change-Id: I301a02771cd17903406c2bc5c7aaeca6cce629f0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* When matching RegExps catch JIT failuresUlf Hermann2019-01-091-3/+5
| | | | | | | | | | | | | The Yarr JIT can generate code that fails to evaluate the RegExp at runtime. In that case we need to fall back to the interpreter. Also, don't needlessly cast the unsigned return value of RegExp::match to signed int before range-checking it. And fix some typos in the comments for the disassembler dumps. Fixes: QTBUG-72879 Change-Id: Ic8f80c076d6461d714816a9f66e1cac1d9b0c7a8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Ensure our builtin constructors are subclassableLars Knoll2018-11-221-1/+7
| | | | | | | | | 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-7/+7
| | | | | Change-Id: I44a90dec16dc1421a32a7770b353a4df14c057f9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-20/+20
| | | | | | | | | | | | 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 bugs in ArrayBuffer.prototype.sliceLars Knoll2018-08-231-21/+1
| | | | | Change-Id: I6de8031a04c372a5309a878811da55b93b53da3d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement RegExp.prototype[Symbol.split]Lars Knoll2018-08-151-13/+130
| | | | | Change-Id: Ia5ed7afc67122f4d70bf2e0169537f936df036a9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix spec compliance for the RegExp constructorLars Knoll2018-08-151-31/+70
| | | | | Change-Id: I767b27faab912e91962797ca154d929473113cc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix some details in RegExp handlingLars Knoll2018-08-151-9/+28
| | | | | Change-Id: If9f7c07ea657ba8503b9188a7b77e301f23423ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement RegExp.prototype[Symbol.replace]Lars Knoll2018-08-151-15/+124
| | | | | Change-Id: I5a2c9cb1e9dcca664526b3949671d72d2ffee427 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement RegExp.prototype[Symbol.search]Lars Knoll2018-08-151-0/+35
| | | | | Change-Id: Ie966628d020eb010eb5ecc3279fed2b002975728 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve RegExp.prototype[Symbol.match] implementationLars Knoll2018-08-151-15/+52
| | | | | Change-Id: Id632a4f4648f68f3b46d31f84e4ee05c86391f3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup RegExpObjectLars Knoll2018-08-151-64/+167
| | | | | | | | | | | Move properties from RegExpObject to getters in RegExp.prototype to be compliant with the JS spec. Implement support for the sticky flags ('y') and correctly parse the flags in the RegExp constructor. Change-Id: I5cf05d14e8139cf30d46235b8d466fb96084fcb7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Partial implementation of RegExp.prototype[Symbol.match]Lars Knoll2018-08-151-46/+91
| | | | | Change-Id: Id94c3cc25835b53bae08713cdd8f2e384d907690 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable the Yarr JIT for regexps with nested parenthesisLars Knoll2018-08-111-0/+3
| | | | | Change-Id: I4e7a44ae2b5759febec6f83ab9fa85612515ab04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable unicode regular expressionsLars Knoll2018-08-101-0/+3
| | | | | | | Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 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-3/+3
| | | | | | | | | 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 get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-3/+3
| | | | | | | | 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>
* The length property of RegExp should be configurableLars Knoll2018-06-041-1/+1
| | | | | Change-Id: Ie19dc556d13081a1b750695e81d6b4e5a6b3afac Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement Symbol.species getter functionsLars Knoll2018-05-151-0/+1
| | | | | Change-Id: I18b3e382e679f95d7cb53b4ed03be2513ea0204b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of some includes that aren't requiredLars Knoll2018-04-251-4/+0
| | | | | Change-Id: I1d9e8922130553acf2bf8fe5a88f209aec90c1fb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Better encapsulation for EngineBase::internalClassLars Knoll2018-04-121-1/+1
| | | | | | | | Turn it into a method instead of accessing the array directly to simplify refactoring. Change-Id: I197b56c8f58cfdfd294f429e6b15268c755f9837 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up Engine::newObject/newArrayObjectLars Knoll2018-04-121-1/+1
| | | | | | | They don't need a prototype argument neither anymore. Change-Id: I80fa99cb382e8dca4cfa51fdd87b4c9b0f59573a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-19/+19
| | | | | | | | | | | | | 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>
* Introduce a SubString String typeLars Knoll2018-01-191-2/+2
| | | | | | | | 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>
* Convert methods of RegExp to new calling conventionLars Knoll2017-11-131-21/+18
| | | | | Change-Id: Ie364357b5e1ecf09eb264181e11b0247b07fad6c Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Change signature for call/callAsConstructorLars Knoll2017-11-071-9/+9
| | | | | 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>
* Simplify JSCallData constructionLars Knoll2017-11-071-1/+1
| | | | | Change-Id: Ic53532edae9a209aa7125af6f00a9d993d74f1a3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Get rid of JSCallData::callAsConstructor()Lars Knoll2017-11-071-3/+3
| | | | | Change-Id: I7c7a69791e98ba0ce82b4d23785fc12a510c449e Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Rename JSCall to JSCallDataLars Knoll2017-11-071-1/+1
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/dev' into HEADLars Knoll2017-10-221-9/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4isel_moth_p.h src/qml/compiler/qv4ssa.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm_p.h src/qml/jit/qv4regalloc.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexp.cpp src/qml/jsruntime/qv4regexp_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp tests/auto/qml/qml.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
| * Merge remote-tracking branch 'origin/5.9' into 5.10Lars Knoll2017-09-201-9/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4regexpobject_p.h src/qml/types/qqmllistmodel.cpp src/quick/items/qquickanimatedimage_p.h src/quick/scenegraph/qsgrenderloop.cpp tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp Change-Id: If20ef62b2c98bdf656cb2f5d27b1897b754d3dc0
| | * Fix reuse of regexp objects by regexp literalsAllan Sandfeld Jensen2017-09-081-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accoding to the standard the regexp objects created by literals should be separate objects as if calling new. We were violating that by caching the same object for every instance of a literal. This also fixes a problem with leaking values of lastIndex between separate instances of the same global regexp literal. Task-number: QTBUG-62175 Change-Id: Ib22e9ee68de1d1209fbd4212e72f576bc059d245 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Change CallData::argc to be a QV4::ValueErik Verbruggen2017-09-191-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of mimicking a Value. This makes sure that argc now stays correct even when anything on Value changes. Most of the change is mechanical: replace callData->argc by callData->argc(). Change-Id: I521831ae1ffb3966bad6589c18d7a373e13439d7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Optimize String.match()Lars Knoll2017-09-151-1/+47
| | | | | | | | | | | | | | | Change-Id: Idbf2b45a35c1bd1a843e8d01a3ea2f5157291033 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Always set the correct FunctionObject when calling JS functionsLars Knoll2017-09-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-28/+36
| | | | | | | | | | | | | | | | | | | | | | | | 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-25/+16
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Remove now unused filesLars Knoll2017-06-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove all files from the old compiler pipeline that are now unused. This includes the whole IR, JIT code generation, and the old Moth Isel. Change-Id: I50d06abfbcf0e9755a54ed94638f8bb74f9512b1 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-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 list of default internal classes into EngineBaseLars Knoll2017-05-191-1/+1
| | | | | | | | | | | | | | | | And store them in an enumerated array. This will simplify upcoming changes. Change-Id: I82eac03b9f6264843ae625e36e150464fe08be9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Smaller cleanupLars Knoll2017-03-091-2/+2
| | | | | | | | | | Change-Id: I68de47784c41b7aa2da5334c6a7f470d1180b752 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-17/+11
| | | | | | | | | | | | | | | | 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>
* | Add a set() method to HeapValue as wellLars Knoll2017-03-091-2/+2
| | | | | | | | | | | | | | | | And use it instead of simply assigning to it, so we can add a write barrier later on. Change-Id: I31c0d0b20ed5d37fee046aa02af17875679b22bf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Make all write operations to Pointer<> types go through a set() methodLars Knoll2017-03-091-7/+8
| | | | | | | | | | | | | | | | The new set() method also taked an ExecutionEngine pointer. This makes it trivial to now add a write barrier for those operations. Change-Id: I321eccfe6fb279cc240b5c84910e6854f71759f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | New mark table implementationLars Knoll2017-03-091-18/+0
|/ | | | | | | | | | | | | | | | | | | Automatically generate a table containing the data where JS Values and pointers are in objects in the JS heap. This will allow making the GC mark phase a lot more efficient. A bit of a special hack is currently required for MemberData and ArrayData, as they have a variable length, and we need to read the size from the object. We keep backwards compatibility with the old markObjects() functions for now (calling them if they are defined). Some further work on QV4::String and in a few other places is required before we can get remove the compatibility. Change-Id: I78528ace67e886bdbe4a4330c9677c7fc9f08a33 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>