aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4errorobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QML: Encode "missing" line number as negated address of stack frameUlf Hermann2023-05-091-2/+2
| | | | | | | | | | | | | | | This way we can identify which entry in a stack frame to amend when processing an exception in generated code. However, negative line numbers are also used to signal the position of "Ret" instructions. Since you cannot throw an exception from a "Ret" instruction, those cannot collide, but we cannot qAbs() the line number anymore when saving it in the stack trace. We have to qAbs() it in all the places where it's read. Pick-to: 6.5 Fixes: QTBUG-112946 Change-Id: I24dc4008fb7eab38e4d24e70211c22e46f1b72a7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that on() was replaced with a matcher that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QtQml: Remove unused includes in qml, first partSemih Yavuz2022-09-141-1/+0
| | | | | | | | | | | | | | | Drop unnecessary includes detected by clangd-iwyu. Add new includes due to the transitive includes. Also, some of the includes were detected as unused even if they were actually in use. In those cases, use angular brackets instead of "" which deceives the tool not to complain. Affected subfolders: Debugger, Compiler, JsApi, JsRuntime, Memory, Parser Task-number: QTBUG-106473 Change-Id: I01d996a2a2ba31cbbc5f60f5454c8f850298f528 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-111-38/+2
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* 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>
* 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>
* Get rid of remaining assumptions about setter being next to gettersLars Knoll2018-09-271-3/+3
| | | | | | | | The only place where we now assume that getters and setters are next to each other in the MemberData is in the internal class. Change-Id: I3285f3abb1cbfe051853e808339cd360eb602262 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-15/+15
| | | | | | | | | | | | 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>
* Setup the prototype correctly when subclassing error objectsLars Knoll2018-08-061-14/+14
| | | | | Change-Id: I5e394ef8d4d6d87bedb26070d51660e3ebe3ab1b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix a couple of test failures related to error objectsLars Knoll2018-08-021-6/+6
| | | | | | | | Set up the prototype chain for error objects correctly, and make them inherit from the right classes. Change-Id: I7bb12b3bb285950a1bff25e5c62954287a95970a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for new.targetLars Knoll2018-07-031-7/+7
| | | | | | | | | 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-8/+8
| | | | | | | | | 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>
* Fix the length property of various functionsLars Knoll2018-05-241-1/+1
| | | | | Change-Id: Ic782c8c9e211db25ac9e51840957db72ac1116fb 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>
* Convert methods of Error to new calling conventionLars Knoll2017-11-131-4/+4
| | | | | Change-Id: I1012e5b2f7ebac32de50b7bafe8394060fe6aa86 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Change signature for call/callAsConstructorLars Knoll2017-11-071-17/+23
| | | | | Change-Id: I159b57acc7a2133ef1ad545aa84e792c63449a57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename the construct 'virtual' method to callAsConstructorLars Knoll2017-11-071-7/+7
| | | | | | | To make it consistent with the rest of the engine. Change-Id: I57b98fa26134f9864c663f47371ef3e9ca16ac9c 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>
* Don't access arguments that are potentially out of boundsLars Knoll2017-11-071-1/+2
| | | | | Change-Id: I45259c66f2a4c6c60065852db34182c8cf9c9c02 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-8/+11
| | | | | | | | 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>
* Fix frame handlingLars Knoll2017-08-041-4/+5
| | | | | | | | Fix some regressions introduced by change 1ae1eaf59e0475a2dc9c5e22e53e9be19d0f2feb. Change-Id: I24c1db78634e3beb1ab090325b60e70f788f92a7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Change function signatures for call/construct backLars Knoll2017-08-041-23/+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>
* Don't store the current line number in the ExecutionContextLars Knoll2017-08-041-8/+7
| | | | | | | | | Instead modify our StackFrame struct to hold the QV4::Function and have a linked list of those for the frames. Change-Id: I8676e16bc51a5ba6cf25a5b3423576d44e8a926a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Remove now unused filesLars Knoll2017-06-301-1/+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>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-5/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 prototype into the internal classLars Knoll2017-05-191-2/+1
| | | | | | | | | | | | | | | | | | | | 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>
| * 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>
* | Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-17/+17
| | | | | | | | | | | | | | | | 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>
* | Make all write operations to Pointer<> types go through a set() methodLars Knoll2017-03-091-1/+1
| | | | | | | | | | | | | | | | 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-8/+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>
* Convert more builtin functionsLars Knoll2017-01-251-14/+11
| | | | | Change-Id: I2dc8797e2240fcfc4176cb08b982e3e98b879646 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make Heap::Object and all subclasses trivialErik Verbruggen2016-10-061-35/+38
| | | | | | | | | | | | GCC6 might dead-store-eliminate out our secret write to Base::mmdata, because it expects all memory content to be "undefined" before constructor calls. Clang might take the same approach if the constructor of Heap::Object is removed. By making these structs trivial, it also makes them memcpy-able. Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Introduce destroy() on Base subclassesErik Verbruggen2016-10-051-11/+13
| | | | | | | | This removes the destructors of subclasses of Base, making them nearly trivial. Change-Id: Ia6f7d467e87899b5ad37b8709a8f633a51689d59 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* V4: Pass scope around as parameters inside the runtime.Erik Verbruggen2016-06-221-23/+16
| | | | | | | | | | | | | | | | The implementation of many (or all) runtime functions consist of first creating a QV4::Scope, which saves and restores the JS stack pointer. It also prevents tail-calls because of that restoring behavior. In many cases it suffices to do that at the entry-point of the runtime. The return value of a JS function call is now also stored in the scope. Previously, all return values were stored in a ScopedValue, got loaded on return, and immediately stored in another ScopedValue in the caller. This resulted in a lot of stores, where now there is only one store needed, and no extra ScopedValue for every function. Change-Id: I13d80fc0ce72c5702ef1536d41d12f710c5914fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Scrape off some more allocations by using the QStringBuilderFrank Meerkoetter2016-05-091-7/+3
| | | | | Change-Id: I25cbbcad086afb15694f69bdc52bd4ddce4b3a18 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* 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>
* Fixes to Error objectsLars Knoll2015-09-221-59/+45
| | | | | | | | | | | | | Move the name and message property into the prototype as per JS spec. Only define the message property in the object itself if the value used for construction is not undefined. In addition, clean up creation of the objects and centralize it in a few template methods. Change-Id: I014017b710575b30bf4e0b0228111878f5c73b9a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Simplify new construction schemeLars Knoll2015-09-221-6/+6
| | | | | | | | Declare the default prototype and internal class in the class itself. Change-Id: I08c2b42aa61a886580061336ae60cef8dedc0f03 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* move error objects over to new construction schemeLars Knoll2015-09-221-63/+63
| | | | | Change-Id: I533c7bf90d49aee10b5661fd15a98e013b1169bd Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Convert variant object and ObjectProtoLars Knoll2015-09-221-1/+0
| | | | | Change-Id: I5ee3b453b74f5832997aca68d04979302f9afac5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* qml: Avoid heap allocations due to QString::fromLatin1()Sérgio Martins2015-08-131-2/+2
| | | | | | | By using QStringLiteral when the argument is a literal. Change-Id: Ib25042d10f3d9d0aca81af74cde0107aba4f9432 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move the StringValue members of ExecutionEngine onto the JS stackLars Knoll2015-06-101-4/+4
| | | | | Change-Id: Ib55c05f1730b7659e2f6fee7e1fa79c10c759167 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Move more objects from the v4 engine to the js stackLars Knoll2015-04-241-11/+11
| | | | | | | Convert most of the prototype objects in the v4 engine. Change-Id: I365f290493c20973bc991b6a383649836e42a16a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Get rid of qv4value_inl_p.h and replace it by qv4typedvalue_p.hLars Knoll2015-04-241-0/+1
| | | | | | | | This is a cleaner separation and further reduces include dependencies in the definitions of our basic data structured. Change-Id: I18aa86cdea0c0dfbc16075d4d617af97e638811e Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-0/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlbinding.cpp src/qml/jsruntime/qv4arraybuffer.cpp src/qml/jsruntime/qv4functionobject.cpp Change-Id: Ic752e9dfd69b282093651c9234c110a49762f06d
| * Address uninitialized pointer variablesHolger Hans Peter Freyther2015-04-201-0/+1
| | | | | | | | | | | | | | | | Coverity CID 10721, 84861, 86705, 85424, 85422, 85259, 84863, 84857 Change-Id: Ia86970b5ac4e0be9de01b79b618d33011da6a328 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | More cleanupsLars Knoll2015-04-211-28/+28
| | | | | | | | | | | | | | | | Get rid of Value::asObject(), and pass const Managed pointers into some more vtable methods. Change-Id: Ia4f427d5fd8868f77b4015d1ce5424d32bfc2115 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Move memory management related functionality into it's own folderLars Knoll2015-03-021-1/+3
|/ | | | | | | | | 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>