aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4function.cpp
Commit message (Collapse)AuthorAgeFilesLines
* qtdeclarative: finish fixing compilation with explicit QChar(int)David Faure2020-11-071-1/+1
| | | | | Change-Id: Idb26e2df6d4fe8940db57066a30fa8c243f6d2c9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for binding ahead-of-time compiled bindings to QPropertiesSimon Hausmann2020-04-221-3/+7
| | | | | | | | | | When the ahead-of-time built binding returns the same type as the QProperty, then we can connect them directly with a small shim and pass through the context and scope objects. Change-Id: I9cb49d1fa35490a4ccb06965397674d5534c067d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add support for C++ accessible typed parameters and return types in qml ↵Simon Hausmann2019-07-091-2/+2
| | | | | | | | | | | | functions These can be declared using the new typescript-like syntax and using type names that are also used for signal parameters and property types. This merely affects their signature on the C++ side and allows the corresponding invocation. Change-Id: Icaed4ee0dc7aa71330f99d96e073a2a63d409bbe Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-161-4/+9
| | | | | | | | We need a CompilationUnit that only holds the data needed for compilation and another one that is executable by the runtime. Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove tracing JIT infrastructureUlf Hermann2019-04-291-34/+2
| | | | | | | | The tracing JIT won't be finished. Therefore, remove the parts that have already been integrated. Change-Id: If72036be904bd7fc17ba9bcba0a317f8ed6cb30d Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
* Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-211-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| * Remove dead compile time QML context/scope property and id object codeSimon Hausmann2019-03-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | After enabling lookups in QML files, we can remove all the code that tries to deal with (type) compile time detection of access to id objects and properties of the scope/context object. This also allows removing quite a bit of run-time code paths and even byte code instructions. Task-number: QTBUG-69898 Change-Id: I7b26d7983393594a3ef56466d3e633f1822b76f4 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | V4: Collect trace information in the interpreterErik Verbruggen2019-01-251-5/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Collect type information about values used in a function. These include all parameters, and the results of many bytecode instructions. For array loads/stores, it also tracks if the access is in-bounds of a SimpleArrayData. Collection is only enabled when the qml-tracing feature is turned on while configuring. In subsequent patches this is used to generated optimized JITted code. Change-Id: I63985c334c3fdc55fca7fb4addfe3e535989aac5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | V4: Generate function tables on 64bit windowsUlf Hermann2018-12-031-1/+16
|/ | | | | | | | | | | | | | In order for global exception handlers to be called reliably, the runtime needs to unwind through JIT-generated code. This can be facilitated by installing a "function table" for each JITed function that specifies "use the frame pointer". Also make sure to generate a function table for JIT'ed regular expressions. Those were forgotten also in the linux case. Fixes: QTBUG-50061 Change-Id: Ib0b8ae9356ed80afe1cab017e36efa4ccbe73f90 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-3/+3
| | | | | | | | | | | | 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>
* Refactor initialization code for JS stack framesLars Knoll2018-07-031-3/+22
| | | | | | | | | Move code into qv4stackframe_p.h, so that it can be re-used from different places. Clean up VME::exec and the generatorfunctions using this. Change-Id: Ib4f7eceeb5f55d98dd6ccf2584d13a3b864caea1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the C++ and JS stack frame definitions into it's own fileLars Knoll2018-07-031-0/+6
| | | | | Change-Id: I86e89e07197aec6071809c2d32bd5c98cb7ac6f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rename IdentifierTable methodsLars Knoll2018-07-021-3/+3
| | | | | | | identifier -> asPropertyKey Change-Id: I4e6f33bdad12e901303ec6101dd2b8d6b0e99ac4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Clean up the property key API in StringOrSymbolLars Knoll2018-07-021-1/+1
| | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.11' into devSimon Hausmann2018-06-191-4/+5
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp src/qml/compiler/qv4codegen.cpp tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp Change-Id: I010505326d76ee728ffe5fbd4c7879f28adadb12
| * Formals come after locals in the CallContextLars Knoll2018-05-291-4/+5
| | | | | | | | | | | | | | | | | | | | | | The method updating the internal class for a CallContext messed up the order between locals and formals, leading to wrong name lookups for signal handlers taking implicit arguments Task-number: QTBUG-68522 Change-Id: I36d55b3b0cfe9af6397455782551498b7ddb940a Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove unused QV4::Function::code memberSimon Hausmann2018-05-281-2/+1
| | | | | | | | | | | | | | | | Since commit 831ddc54932d2681712ca9fa3e94484ae11d59f7 we always call the interpreter entry function when calling into JS. Change-Id: Ieeb549f6d144f02f0a919759fd31541a7f636f83 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Remove String dependency from InternalClassLars Knoll2018-05-021-2/+2
| | | | | | | | | | | | | | | | This is required, so we can also use Symbols in the internal classes. Change-Id: I630e7aa7b8b16d5a94041f8d18515fd582f94264 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | garbage collect InternalClassLars Knoll2018-04-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Better encapsulation for EngineBase::internalClassLars Knoll2018-04-121-2/+2
|/ | | | | | | | 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>
* V4: Add a baseline JITErik Verbruggen2017-11-171-0/+4
| | | | | | | | This patch add a JIT back in for all platforms that supported JITting before, with the exception of MIPS. Change-Id: I51bc5ce3a2ac40e0510bd72a563af897c5b60343 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Get rid of the unusued canUseSimpleCall flagLars Knoll2017-11-071-5/+0
| | | | | Change-Id: I5230342db4647bd95793475f751213f0725d6965 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Fix argument order for bound signal expressionsErik Verbruggen2017-09-131-12/+29
| | | | | | | | | | | | | | Function::updateInternalClass added the arguments in reverse order to the call context object. However, the index of the member is used as the index into CallData::args, so the result would be a reverse order when lookup was done. Now the order is as expected: first argument first. To handle duplicates, another pass is done before adding those arguments so that names are uniques out. Change-Id: Icfb6af2769b7669ff5589ef29f16c23c314758e8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix: QQmlBoundSignal really needs a call contextErik Verbruggen2017-09-121-1/+1
| | | | | | | | And not an empty class "context". This would trip an assert later on when the CreateCallContext instruction would be executed. Change-Id: I6ac7c2df7169990ced77bc9ba1e992d48bb201bb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove the codeRefs in the Moth::CompilationUnitLars Knoll2017-08-301-1/+1
| | | | | | | | | There's no point in allocating that vector of byte arrays, if we can directly embed those int the CompiledData and reference it from there. Change-Id: I8fc92b1efaca5a9646f40fc84a2ac4191c8f3444 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/new-backendLars Knoll2017-08-221-6/+7
|\ | | | | | | Change-Id: Iff06429f948ac6cdec77a9e5bb8c5375c56fe705
| * Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-08-181-4/+3
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4qobjectwrapper.cpp src/qml/qml/qqmlcustomparser.cpp src/qml/qml/qqmlimport.cpp src/qml/qml/qqmlimport_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmlmetatype_p.h src/qml/qml/qqmltypenamecache.cpp src/qml/qml/qqmltypenamecache_p.h src/qml/qml/qqmltypewrapper.cpp src/qml/qml/qqmltypewrapper_p.h src/qml/qml/qqmlvmemetaobject.cpp src/qml/util/qqmladaptormodel.cpp Change-Id: Ic959d03e6f9c328fb02710d9abbb0f27cddde131
| | * Improve releasing of memory allocated from compilation unit stringsSimon Hausmann2017-08-041-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocate the strings in the compilation unit as regular strings, not as identifiers. We mark the runtimeStrings in the compilation unit, so when the unit is released as part of component cache trimming, those strings can also be collected. The JS object literal class keys have to remain identifiers though. However this is just a stop-gap as the real problem is that the identifier table can be triggered to grow without bounds. Task-number: QTBUG-61536 Change-Id: I7a2854b7fa9c9953348b5e34a31833f7be67cfbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | Refactor le integer types from qjson_p.h to qendian_p.hAllan Sandfeld Jensen2017-07-061-3/+3
| | | | | | | | | | | | | | | Change-Id: Ibb24b0a55dd94e03fea3104e8af5ddb266004300 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Cleanup argument handling in contextsLars Knoll2017-08-181-18/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the compiler to already deal with duplicated argument names. Doing this at runtime was not ideal. Remove the callData member from the context. Instead use the fact that the arguments already followed the locals in the context. Don't copy the thisObject over into the CallContext anymore, it's never used from there anyway. Fix the ordering of names in the internalclass, so that arguments don't require special handling anymore when looking them up by name. Adjust all places that used callData, and related methods. Change-Id: I0bc45e1be3f1fcd38dc3b4f04e91edaf7b9ed103 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove one more layer of function calls when entering JS functionsLars Knoll2017-08-101-23/+0
| | | | | | | | | | | | | | | Change-Id: I7d8b2e16d2eacf5e0eafb8b8574de51527fd0ac2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Always create a valid CallData object for interpreter callsLars Knoll2017-08-101-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | This will allow removing a few more special cases and to simplify the code further. Change-Id: I3a958e9f68e3c103ea4f2ee6825f893e5931b11d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Introduce a JS stack frame that corresponds to the C++ stack frameLars Knoll2017-08-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | The frame currently contains the function itself and the current context. Change-Id: I7d3402627fbc90e860a7bdc277585f365f5b4cb5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | No need to pass the Engine pointer to VME::exec()Lars Knoll2017-08-031-1/+1
| | | | | | | | | | | | | | | Change-Id: I1e43305e26833a6d9b714e89f59ccead6bd12605 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Get rid of the compilation unit related members in ExecutionContextLars Knoll2017-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And change the signature for VME::exec to take the QV4::Function that should be executed. This is in preparation to being able to run functions that will not need to allocate an execution context on their own. Change-Id: I34538a8723006f4ec24583805e88a66e750100c3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Unify QV4::Function::internalClass and the ic used in CallContextLars Knoll2017-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Set the internal class of the V4 function on the CallContext, as that one is describing it's layout, and use it to lookup variables. Change-Id: I49d9b9afe1f504fbd059d6a350b7a4e62e2e505b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Use simple calls if possibleLars Knoll2017-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was disabled by accident. We do however not get many simple calls currently, as this would require turning locals into temps in the current architecture. This will get fixed with a better approach to allocating contexts in the slightly longer term. Change-Id: Ie9b88e6d5668caec5b5c25ab18540d39bf4e8dc2 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Fix exception handlingLars Knoll2017-06-211-1/+1
|/ / | | | | | | | | | | | | | | Fix all exception handling related test failures in test262. Change-Id: Iba50238627c31705a4878b43abbb8f20f0ecee88 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Get rid of the MemoryManager pointer inside StringLars Knoll2017-05-191-2/+2
| | | | | | | | | | | | | | We can always get the pointer through the internalClass. Change-Id: If68432845e7c67da70d9e19aef1a90ebe1e6056b Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
| * Move the list of default internal classes into EngineBaseLars Knoll2017-05-191-2/+2
| | | | | | | | | | | | | | | | And store them in an enumerated array. This will simplify upcoming changes. Change-Id: I82eac03b9f6264843ae625e36e150464fe08be9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Make the decision about whether to use a Simple callcontext earlierLars Knoll2017-03-091-6/+1
| | | | | | | | | | | | | | | | | | All required information is already available when creating the CompiledData::Function, so determine at that point whether we use a Simple or full CallContext. Change-Id: Ife489ca2ca6eaf2ffc7843544a56e8bd86590e9d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Get rid of QV4::Function::needsActivation()Lars Knoll2017-03-091-6/+7
| | | | | | | | | | | | | | | | We can just as well simply check whether we have a simple or regular CallContext instead. Change-Id: Iddd4ca249ab6b3b13d7ef0a732c22a26bcb23dbb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Avoid one indirection when looking up local variablesLars Knoll2017-03-091-1/+2
|/ | | | | | | | | | | | Simple CallContext's never have locals, as they get converted to temps in the compiler. For regular CallContext's, local variables always got appended to the callcontext. So there was no need to have an additional indirect pointer to them in the CallContext. This speeds up v8-bench by 1-2%. Change-Id: I3def7ba653aea5bc5761076f398450ae30c62823 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of SimpleScriptFunctionLars Knoll2016-12-111-0/+3
| | | | | | | | | | Now that the code paths are very similar, we can simply to the check whether to do a fast or slow function call in ScriptFunction::call/contruct. To make this fast, cache the result of the required check in QV4::Function Change-Id: I03085ca2beb83b1721b60b0d7b2ab4c9266d1e48 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Precalculate and cache hasQmlDependenciesErik Verbruggen2016-12-011-0/+1
| | | | | Change-Id: I62b5e167847871f7ead39168ac281ba10e7f7008 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make Heap::RegExp and Heap::String trivialErik Verbruggen2016-10-051-2/+2
| | | | | Change-Id: Ia8eda67c9d59069d3a64363699720a79ba1348a1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Make all context objects trivialErik Verbruggen2016-09-301-2/+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>
* Fix endian support in compiled data structuresSimon Hausmann2016-07-141-3/+3
| | | | | | | | | | | | The goal is to make the compiled data structures persistent on disk. In order to make it possible to create these data structures on a "host" system that may have a different endianness than the target system, we now make all the word sized fields little-endian. The template wrappers from QJson provide zero-overhead access for little-endian machines (the vast majority) while maintaining a large degree of source compatibility. Change-Id: I3d30da1fcf3bffb98dbe9337d3a35482fb7b57c8 Reviewed-by: Lars Knoll <lars.knoll@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>