aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stackframe_p.h
Commit message (Collapse)AuthorAgeFilesLines
* jsruntime: silence msvc warning 4201 (nameless struct/union)Tim Blechmann2024-02-061-0/+3
| | | | | | | | | qml's private headers are pulled into binaries when using the qml compiler. we should keep the warnings out of downstream code Pick-to: 6.5 6.6 6.7 Change-Id: I330b5f76d7846b5f2e5f2a4c1ece95b58c67a876 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove the use of Q_QML_PRIVATE_EXPORTAlexey Edelev2024-01-111-4/+4
| | | | | | Task-number: QTBUG-117983 Change-Id: I5790f01d614cd70c7fcc9bd817ec6ace3f3e3730 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QML: Implement QObjectMethod::virtualCallWithMetaTypesUlf Hermann2023-09-281-0/+3
| | | | | | | | | | | | We can use the same mechanism we have in place when calling typed JavaScript functions. The type coercion is generalized and moved to qv4jscall_p.h. We also use the correct JavaScript coercion in the rare fallback case where the types are actually different. Fixes: QTBUG-113258 Change-Id: I30404ee0122433b47227b2fc0dc4b0e3862a99c7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move ScopedStackFrame into qv4stackframe_p.hUlf Hermann2023-05-171-0/+25
| | | | | | | | | | | This is where it belongs. We need to apply some tricks to avoid cyclic includes, but that's better than what we have so far. Also, sort and clean up the includes in the affected files. Change-Id: Ia7a957d06c0ca284045d831417740c3f9920bc92 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QML: Encode "missing" line number as negated address of stack frameUlf Hermann2023-05-091-0/+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>
* QML: Track the statement indices together with line numbersUlf Hermann2022-10-131-0/+1
| | | | | | | | | | We will need the statement indices when tracking value type references. New value type references shall only be written back in the same statement they were created in. Task-number: QTBUG-99766 Change-Id: I83f908df034e7da8ba46ccacaa29bd9d78020d20 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>
* Allow AOT functions to signal an undefined result via the contextUlf Hermann2021-06-151-0/+5
| | | | | | | | | | | | undefined as value returned from bindings has the special meaning of resetting the binding. As AOT-compiled functions return the actual type of the binding rather than a QV4::Value, we cannot always encode undefined. Therefore, add a flag that tells us whether the result was supposed to be undefined. Pick-to: 6.2 Change-Id: Iac2298869dde80f6d889240dd8200b2ad83e5dc5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Eliminate JS call frame from metatypes callsUlf Hermann2021-06-101-54/+103
| | | | | | | | If we call an AOT-compiled function we never need the JavaScript call frame. We can just skip its setup and save some overhead. Change-Id: I39dc2ca6eea5b5a66f3b87b642a310534cecf6cd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QV4StackFrame: Fix ubsan warningFabian Kosmale2021-05-281-1/+3
| | | | | | | | | | Calling memcpy with a nullptr is UB, even if we copy 0 bytes. Add a null check to avoid the issue. Pick-to: 6.1 Fixes: QTBUG-94067 Change-Id: I1d47424754e22f13d7b494ae984b4407b96b1805 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Optimize stack frame setup for AOT compiled functionsUlf Hermann2021-03-231-58/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When called via the metaobject system, parameters and return values are passed as void*, with accompanying type information in the form of QMetaType. The same format is expected when calling an AOT compiled function. Previously, we would first convert all the parameters to QV4::Value, just to convert them back the moment we notice that there is an AOT compiled function. This is wasteful. This change provides a second call infrastructure that accepts void* and QMetaType as parameter and return value format, and passes them as-is all the way to any AOT compiled functions. If there is no AOT compiled function, the conversion is done when detecting this, rather than when initiating the call. This also passes the information "ignore return value" all the way down to the actual function call. If the caller is not interested in the return value, we don't have to marshal it back at all. For now, we only add the extra "callWithMetaTypes" vtable entry to ArrowFunction. However, other callables could also receive variants optimized for calling with void*/int rather than V4 values. This required changing the way how function arguments are stored in the property cache. We squeeze the return type into QQmlPropertyCacheMethodArguments now, and we use QMetaType instead of integers. In turn, we remove some unused bits. Change-Id: I946e603e623d9d985c54d3a15f6f4b7c7b7d8c60 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Do not set up JS arguments when calling an AOT functionUlf Hermann2021-03-131-0/+3
| | | | | | | We won't use them anyway and it's expensive. Change-Id: I869b915afeac2f3882a959bea8a92dc2279d0b3e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Pass suitable nFormals when constructing JS stack frameUlf Hermann2019-10-211-1/+1
| | | | | | | | | The extra formal parameters for signal handlers are not passed in "registers" and therefore should not be given here. Fixes: QTBUG-78486 Change-Id: I18594e0139a7a23d4e53b41e8b00b1e9f2e07aeb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove now dead V4_BOOTSTRAP #if-eryUlf Hermann2019-05-131-4/+0
| | | | | | | Change-Id: I04f8f69ed8ee415ca330e2f7beeffc4ee4c38e65 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make sure we don't include qv4stackframe_p.h in qmldevtoolsUlf Hermann2019-05-101-49/+1
| | | | | | | | The only thing we need is CallData, which is now provided as separate file. Change-Id: Iccbab67ac30d09077075b200f18d1d694f3ecb2a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Annotate stack traces when frames are elided through tail callsErik Verbruggen2019-01-151-0/+2
| | | | | | Task-number: QTBUG-72407 Change-Id: I98b96852309fc783a945797185f666196513d24b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* ES7: Implement Tail Position Calls in the runtimeErik Verbruggen2018-10-051-1/+5
| | | | | Change-Id: If1629109722496b3fd10b36b2376548440f2fee9 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>
* Micro optimization when initializing the Cpp frameLars Knoll2018-09-111-3/+2
| | | | | Change-Id: I07db2df7eec2bdbeb84bd576d9e4f7912f79fc78 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Add support for yield*Lars Knoll2018-09-071-0/+2
| | | | | Change-Id: I5b054b59519ed825459a5b0b0a7cd2c6fc8a3797 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement the dead temporal zoneSimon Hausmann2018-08-281-0/+9
| | | | | | | | | | | | | | With const and let it is possible to access the declared member before initialization. This is expected to throw a type reference error at run-time. We initialize such variables with the empty value when entering their scope and check upon access for that. For locals we place the lexically scoped variables at the end. For register allocated lexical variables we group them into one batch and remember the index/size. Change-Id: Icb493ee0de0525bb682e1bc58981a4dfd33f750e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add missing "We mean it." warningFrederik Gladhorn2018-07-311-0/+11
| | | | | Change-Id: I3de691385a7884c4b38454e7a9f6f27b3b839286 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add LastOffset/OffsetCount constants to CallData::OffsetsErik Verbruggen2018-07-131-3/+11
| | | | | | | | | For use by code that needs to iterate over the stack slots occupied by the CallData (like a JIT). Also add more checks to verify that the offsets correspond with the actual member field layout in memory. Change-Id: Iedae11a9d7602286b10910b22c9bf0eedc23b411 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for super callsLars Knoll2018-07-031-4/+12
| | | | | | | | Implement super call support for class constructor functions. Change-Id: I3c64276234689cf4f644b095e0fc8ca1c634ac53 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Refactor initialization code for JS stack framesLars Knoll2018-07-031-1/+51
| | | | | | | | | 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/+130
Change-Id: I86e89e07197aec6071809c2d32bd5c98cb7ac6f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>