aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexp.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When matching RegExps catch JIT failuresUlf Hermann2019-01-091-17/+43
| | | | | | | | | | | | | 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>
* Implement RegExp.prototype[Symbol.replace]Lars Knoll2018-08-151-0/+54
| | | | | Change-Id: I5a2c9cb1e9dcca664526b3949671d72d2ffee427 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup RegExpObjectLars Knoll2018-08-151-19/+34
| | | | | | | | | | | 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>
* Enable the Yarr JIT for regexps with nested parenthesisLars Knoll2018-08-111-1/+7
| | | | | Change-Id: I4e7a44ae2b5759febec6f83ab9fa85612515ab04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Enable unicode regular expressionsLars Knoll2018-08-101-3/+6
| | | | | | | Add support for the 'u' flag for regular expressions. Change-Id: I409054eaa9c50183619752d14f2638f5a38c0ea7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Update Yarr to the latest version from WebKitLars Knoll2018-08-101-7/+15
| | | | | | | | | | | Updated Yarr to a to commit 4d2a53d60487cb1f8b2a9a1e9f684af336fd7d2c in WebKit. Adjusted the yarr code base to work with our older version of wtf and masm. Change-Id: I04b4593ece051e1d7aa087b87aa08c92595d1098 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Q_UNUSED(engine) to fix build on iOSShawn Rutledge2018-03-161-0/+2
| | | | | Change-Id: I47e84ee2c3f36dae9354e54b68ac60001703bf3d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-2/+2
| | | | | | | | | | | | | 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 crashes on WinRT when allocation of executable memory is disabledSimon Hausmann2018-02-091-3/+3
| | | | | | | | | | This regressed in commit b56f7d6f79b0de73c405b1503bfeb71ef5caf58f. We need to choose the YARR JIT (as well as the regular JIT) only if we can allocate executable memory. Change-Id: I150238fda7b3699cb1d7ffedeeed3c6f3f54132b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/dev' into HEADLars Knoll2017-10-221-4/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+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>
* | | Don't compile both bytecode and JIT code for regexpsLars Knoll2017-08-291-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | Usually one of the two is sufficient :) Change-Id: Ib7ec021411839578c8dd0d7b50d9ec91460c4670 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Re-enable the YarrJITErik Verbruggen2017-08-281-1/+1
|/ / | | | | | | | | | | | | This makes a huge difference for regexp evaluation. Change-Id: I6b466f60280583c85d34be8734e8fef209b7b989 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* / New mark table implementationLars Knoll2017-03-091-6/+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>
* QML: Also check for correct destroy() chainingErik Verbruggen2016-10-061-0/+1
| | | | | | | | | Check that the destroy() method of Heap::Base was called when a Managed object needs destruction. This checks if a call to the parent's destroy() method was accidentally omitted. Change-Id: Id025ecd6d4744bf3eab23503fbe317ed2a461138 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make Heap::RegExp and Heap::String trivialErik Verbruggen2016-10-051-6/+9
| | | | | Change-Id: Ia8eda67c9d59069d3a64363699720a79ba1348a1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Introduce destroy() on Base subclassesErik Verbruggen2016-10-051-4/+8
| | | | | | | | This removes the destructors of subclasses of Base, making them nearly trivial. Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make all context objects trivialErik Verbruggen2016-09-301-0/+2
| | | | | | | | | | | | | | | This change also adds a check to the d() calls for Managed, verifies that the object has been initialized. This is only done for debug builds. To prevent other code from tripping the check, a number of other classes are either marked as trivial, or do initialization in the constructors. Because of template function changes in them memory manager (those now call init() instead of in-place new), String has an extra parameter to force it to temporarily use an old/unmodified template function. Change-Id: I8c35161ce7680835d830638b6d21498c5129b02b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Updated license headersJani Heikkinen2016-01-191-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix the RegExpCache to be GC safeLars Knoll2015-06-171-12/+11
| | | | | Change-Id: I6c20c2c5fcdaefa0743f7c1f50cf6dd8d8edc753 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move memory management related functionality into it's own folderLars Knoll2015-03-021-1/+1
| | | | | | | | | Start moving the memory related functionality into it's own folder. This will simplify refactoring of the GC related functionality later on. Change-Id: I70ec6f512af7a7897625afb84d914c17572b0ccd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-121-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* QML: Fix MSVC 2013/64bit warnings.Friedemann Kleint2015-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | compiler\qv4ssa.cpp(687) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data compiler\qv4ssa.cpp(950) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data compiler\qv4ssa.cpp(1117) : warning C4267: 'return' : conversion from 'size_t' to 'unsigned int', possible loss of data compiler\qv4ssa.cpp(1120) : warning C4267: 'return' : conversion from 'size_t' to 'unsigned int', possible loss of data compiler\qv4ssa.cpp(1148) : warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned int', possible loss of data compiler\qv4ssa.cpp(1266) : warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned int', possible loss of data compiler\qv4ssa.cpp(1622) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data compiler\qv4ssa.cpp(2246) : warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned int', possible loss of data compiler\qv4ssa.cpp(4289) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data compiler\qv4ssa.cpp(4351) : warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned int', possible loss of data jit\qv4regalloc.cpp(1383) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data jit\qv4regalloc.cpp(1769) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data jit\qv4regalloc.cpp(1814) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data jsruntime\qv4mm.cpp(496) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data jsruntime\qv4mm.cpp(503) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data jsruntime\qv4mm.cpp(506) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data jsruntime\qv4regexp.cpp(60) : warning C4267: 'return' : conversion from 'size_t' to 'uint', possible loss of data jsruntime\qv4typedarray.cpp(85) : warning C4309: '=' : truncation of constant value Change-Id: I0b04e1a9d379c068fb3efe90a9db8b592061e448 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the internalClass pointer into Heap::ObjectLars Knoll2015-01-211-2/+1
| | | | | | | | The other classes that derive from Heap::Base don't need it at all. So get rid of it there and save a pointer. Change-Id: I9c5df2e43cd6eeac2e6e41f3d3b8077d3afbc8f2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove all the setVTable() calls that aren't required anymoreLars Knoll2015-01-211-1/+0
| | | | | | | | The memory manager's allocation methods now set this up correctly for us :) Change-Id: I8492bf732df601f95a1a851fb3804127ffc83935 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the remaining bit of code that use the vtable in the internalClassLars Knoll2015-01-211-1/+1
| | | | | Change-Id: Ia52f0e6db325aab37477d455f163487b319dce29 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix RegExpCache to store Heap ObjectsLars Knoll2014-12-201-4/+4
| | | | | Change-Id: I1613c438f5b862436790f81c6a3d370cfe78b6a1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup destruction of heap objectsLars Knoll2014-11-211-5/+0
| | | | | | | | Generate the code from a macro instead of duplicating boiler plate code. Operate on Heap::Base instead of Managed. Change-Id: I84c5a705980899be3e5b931a093645e50d3923bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Replaced more usages of Returned<T> with Heap::T*Simon Hausmann2014-11-141-3/+3
| | | | | Change-Id: I451128ee71610bfeb71139c28da89a00a8209ec6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup RegExpLars Knoll2014-11-081-4/+4
| | | | | | | Move it's Data into the Heap namespace. Change-Id: I4ed6ea481376ae1d0c1fb08b56feee4764083231 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Begin moving the data out of Managed objectsLars Knoll2014-11-081-2/+2
| | | | | | | | | | | We need to move the Data objects out of the Managed objects, to avoid lots of trouble because inner classes can't be forward declared in C++. Instead move them all into a Heap namespace. Change-Id: I736af60702b68a1759f4643aa16d64108693dea2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Let markObjects() operate directly on HeapObjectsLars Knoll2014-11-041-1/+1
| | | | | | | | | This decouples things a bit better and helps moving over to directly store heapobject pointers in other objects. Change-Id: I798f922e018b0a3ca6f8768e4a810187f34d82f6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some unneeded reinterpret_cast'sLars Knoll2014-11-041-3/+3
| | | | | Change-Id: I29ebc1f06bb3f0d20e6e21840c7fe326a0f4546d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changed Value to store Managed::Data pointers directlySimon Hausmann2014-11-041-1/+2
| | | | | | | | This is a step towards storing direct heap object pointers for the values on the JS stack, to avoid the costly indirection for data access. Change-Id: Ibb57ed6cf52a7088bbc95ee04ae3a4cb25b8c045 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Change the object allocation schemeSimon Hausmann2014-07-221-5/+6
| | | | | | | | | Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert regexpsLars Knoll2014-07-221-21/+18
| | | | | Change-Id: I5b62a265a7ce363a16b1e14ae93cadbb1ab0cb5b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert QV4RegExp to new storage schemeLars Knoll2014-07-221-9/+9
| | | | | Change-Id: Ic752b880ce3dfcb59f807794f0f54fb8ed0e61bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert RegExp and RegExpObject to new data layoutLars Knoll2014-07-221-15/+15
| | | | | Change-Id: I0c2bbab4b158069d5c1648edc38f7c5e38ee67ee Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed data into it's own subclassLars Knoll2014-07-221-1/+0
| | | | | | | | | This prepares for moving over to a d pointer scheme, where Managed subclasses don't hold any data directly. This is required to be able to move over to a modern GC. Change-Id: I3f59633ac07a7da461bd2d4f0f9f3a8e3b0baf02 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Split ManagedVTable into two classesLars Knoll2014-01-211-68/+0
| | | | | | | | Keep the basic methods in ManagedVTable, but have the Object related stuff in an ObjectVTable class. Change-Id: I9b068acf3caef813686227b8d935e7df1a7d1a6e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't return a Property pointer in Object::advanceIteratorLars Knoll2014-01-201-2/+2
| | | | | Change-Id: Iac4cb2a2252b18e40455910e51e3e374df7c1e80 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Managed::type and some flags into the vtableLars Knoll2014-01-031-2/+0
| | | | | | | | | | | | | Move the type flag into the vtable to free up these bits in the Managed class, and not have to set them at object construction time. As we often need to know whether a Managed object is a Object, FunctionObject or String, add some bitflags to test for these to the vtable. Change-Id: I7d08ca044544debb307b55f124f34cb086ad9e84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove setVTable calls in performance critical areasLars Knoll2013-12-041-2/+1
| | | | | | | | | | Remove all the calls to setVTable that were in performance critical parts of the code. This now brings performance back to the level we had with the vtable inlined in the Managed objects. Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move the vtable pointer from the object to the internal classLars Knoll2013-12-041-1/+1
| | | | | | | | This saves one pointer per object, and willmake other optimizations easier in the future. Change-Id: I1324cad31998896b5dc76af3c8a7ee9d86283bfe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-051-1/+2
| | | | | | | | | | | Don't use recursive function calls anymore. Instead, push marked objects onto the JS stack, and then pop them off when their children are being marked. Should reduce stack memory usage, and improves performance by ~5%. Change-Id: I2d37d97579144fcba87ec8e9fd545dd220c01fbb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix various compiler warnings in order to remove warn_off in the near futureErik Verbruggen2013-11-041-0/+26
| | | | | Change-Id: Ic0492fbe31a1e134674bc6c20381f735dd6d5b7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-021-1/+1
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more occurrences of QV4::ValueLars Knoll2013-09-301-2/+2
| | | | | Change-Id: I66c370680d7e6bee2e73a7a940aa96ab4009ec57 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>