aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
Commit message (Collapse)AuthorAgeFilesLines
* V4: Clean up the runtime functions declarationsErik Verbruggen2019-02-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The declarations and usage of runtime functions have seen a number of changes: - we don't use the array of method pointers anymore because we don't use cross-platform AOT JITting - the check if a method can throw a JS exception was invalid, and was not used anymore - value-pointer vs. const-value-ref was inconsistent This patch cleans that up. By fixing the exception checking, we can now use it in the baseline JIT to automatically insert those checks. To make that work correctly, all runtime methods are in a struct, which gets annotated to indicate if that method throws. (The old way of checking which type of engine was used is fragile: some non-throwing methods do not take an engine parameter at all, and those got flagged as throwing). By using a struct, we can also get rid of a bunch of interesting macros. The flags in the struct (as mentioned above) can later be extended to capture more information, e.g. if a method will change the context. Change-Id: I1e0b9ba62a0bf538eb728b4378e2678136e29a64 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-1/+1
| | | | | | | | | | | | 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>
* Implement the dead temporal zoneSimon Hausmann2018-08-281-0/+6
| | | | | | | | | | | | | | 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>
* Move the C++ and JS stack frame definitions into it's own fileLars Knoll2018-07-031-40/+0
| | | | | Change-Id: I86e89e07197aec6071809c2d32bd5c98cb7ac6f6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement support for new.targetLars Knoll2018-07-031-2/+4
| | | | | | | | | 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-1/+1
| | | | | | | | | 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 managed and object vtablesLars Knoll2018-07-031-0/+6
| | | | | | | | | | Allow for nullptr entries in the vtable. To nevertheless get some decent error checking if one of the methods is reimplemented, use a base class for Managed that contains a full set of the vtable entries all being nullptr's. Change-Id: Ibc53973b539f87331e8e465a6c44436a30acbefd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Give for loops a per-iteration context as wellLars Knoll2018-05-111-0/+1
| | | | | | | | Regular for loops also have a per iteration context for lexically declared variables as well. Change-Id: I35cb58bfb198c7dc32d70f41ea0ced7ddefcc37e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rework catch context handlingLars Knoll2018-05-021-22/+5
| | | | | | | | | | | | Remove the need for a specialized catch context, instead use a regular block context, that also captures the catched variable. This also removes the need to do lookups by name inside a catch expression. Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for proper lexical scopingLars Knoll2018-05-021-1/+3
| | | | | | | | | | | | | This is still to some extend work in progress as lexically scoped for loops won't yet do the right thing. let and const variables are still accessible before they are declared, and the global scope doesn't yet have a proper context for lexically declared variables. Change-Id: Ie39f74a8fccdaead437fbf07f9fc228a444c26ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove dependency from qv4heap_p.h onto qv4internalclass_p.hLars Knoll2018-04-121-0/+4
| | | | | | | | This is required to be able to turn the internal class into something that lives on the GC heap. Change-Id: Ie4318588d420743b1e1ab1cd596a1c9d153eb793 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Optimize MM::allocManaged()Lars Knoll2018-04-121-17/+1
| | | | | | | | We can manage without calls to changeVTable() here, as the set of classes allocated with this is rather limited. Change-Id: I804e4850b91c61ebbca8a04edbe51deac911928d 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>
* Raise minimum supported MSVC version to 2015Friedemann Kleint2018-01-061-3/+3
| | | | | | | | | | | | Remove code for older versions and streamline #ifdefs. Remove the helpers macros Q_STATIC_ASSERT_FOR_SANE_COMPILERS and V4_ASSERT_IS_TRIVIAL. Task-number: QTBUG-40658 Task-number: QTBUG-51673 Change-Id: Ifa4fab653b10ce7858739adef08364cddc6507cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't copy unnamed arguments onto the JS stackLars Knoll2017-11-151-1/+1
| | | | | | | | | These can only be referenced through the arguments objects, and have so far messed up initialization of local variables. Change-Id: I3100520ed55c93204dd7953da8cc3d2b7d200d11 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Bring back markObjects(), this time generatedLars Knoll2017-11-141-3/+3
| | | | | | | | Doing the marking of objects in a function instead of using the table seems to be somewhat faster. Change-Id: I9ec00cc0264f9a15c69b285db493bee31d99bf96 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Finally get rid of the QV4::Function pointer in the contextLars Knoll2017-11-131-8/+1
| | | | | Change-Id: Iad6018f67faa956d385087865fca9d73419e363e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Change CallData::argc to be a QV4::ValueErik Verbruggen2017-09-191-9/+12
| | | | | | | | | | | 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>
* Unify JSStackFrame and CallDataLars Knoll2017-09-011-7/+15
| | | | | Change-Id: I4494dae8166026074c9efc74bac62de9d3fa2342 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use the context member in CallDataLars Knoll2017-09-011-1/+1
| | | | | | | | Store the current context in the context member instead of passing it along as arguments. Change-Id: If3dd0d32eddb2a02bcbf65fe6e8d15142403170e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of the FunctionObject parameter to VME::exec()Lars Knoll2017-09-011-1/+1
| | | | | Change-Id: I5b833d1f76899a5b8fceb0f4fc109b77b1b431fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add the current context and function object to CallDataLars Knoll2017-09-011-2/+4
| | | | | | | | Like this we can avoid creating Scope's when calling functions. Change-Id: I59b82c85eafd3a5437c233aba5f2e8330d5ce104 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* New value type encodingLars Knoll2017-08-251-1/+0
| | | | | | | | | Switch to a more efficient encoding of Values. This makes the type() determination easier and faster than before, and should allow us to optimize comparison operations better. Change-Id: I22106262cea052ae1887f42a957860ee00b450e6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Fix assertion in debug buildsLars Knoll2017-08-251-1/+1
| | | | | | | | The code is doing the right thing, but was hitting an assertion meant for other use cases. Change-Id: I4b175fda32f99fa4f09a19d70a9de33d8eacc6b7 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Cleanup argument handling in contextsLars Knoll2017-08-181-22/+14
| | | | | | | | | | | | | | | | | | 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>
* Get rid of CallData in the ExecutionContextLars Knoll2017-08-181-21/+16
| | | | | | | | Part 1, where the callData member is moved to CallContext. We'll get rid of it there in a subsequent commit. Change-Id: I6218992802133913f7766ebb3d2f47bd29f33907 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Remove one more layer of function calls when entering JS functionsLars Knoll2017-08-101-1/+1
| | | | | Change-Id: I7d8b2e16d2eacf5e0eafb8b8574de51527fd0ac2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Always create a valid CallData object for interpreter callsLars Knoll2017-08-101-2/+0
| | | | | | | | 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>
* Split StoreName into StoreNameStrict and StoreNameSloppyLars Knoll2017-08-101-1/+8
| | | | | | | And adjust the name of the corresponding runtime functions. Change-Id: I4adf7b0e069d9b0dff9162cd1271dafc60be854b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove stuff related to simple call contextsLars Knoll2017-08-101-6/+5
| | | | | | | Those are not being used anymore. Change-Id: Ia33dd7c3c7ea7828caef0fbf397253249580a4e1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of simpleCallLars Knoll2017-08-101-3/+2
| | | | | | | | After the recent changes this can easily be unified with the call method without loss of performance. Change-Id: I0385b47b6a86e890f97dcbada3a1be1129ae0b84 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of ExecutionContext::strictModeLars Knoll2017-08-101-3/+2
| | | | | | | | | This should be done by generating different byte code for the strict/non strict cases. For now the VME has a workaround checking the isStrict() flag of QV4::Function. Change-Id: I2faa9e9184ffc5274491067e67f665d6989b54c2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't throw errors from the internal put methods anymoreLars Knoll2017-08-101-1/+1
| | | | | | | | Instead do it in the VME, where we can then easily separate into throwing and non throwing versions by bytecode. Change-Id: Ie63bd5b3610bb85f26fb8979179b2e239876cd97 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Completely avoid intermediate scopes for simple functionsLars Knoll2017-08-081-2/+2
| | | | | Change-Id: I1fe2ff987e79cf590ad5ad3fc520b17925f8b616 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-2/+2
| | | | | | | | 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>
* Don't store the current line number in the ExecutionContextLars Knoll2017-08-041-4/+0
| | | | | | | | | 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>
* Get rid of the compilation unit related members in ExecutionContextLars Knoll2017-08-031-11/+5
| | | | | | | | | | 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>
* Disable size check for CallContextErik Verbruggen2017-07-121-5/+7
| | | | | | | | | | This check now also fails on Win8/msvc2013. It's questionable if it's useful at all, because the ValueArray at the end of the CallContextMembers is meant to be of variable-length at runtime. Task-number: QTBUG-61874 Change-Id: I6f3be8f60e6a2f3e1d134edb68a205222067f68d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Support broken C++11 compilersErik Verbruggen2017-07-111-1/+1
| | | | | | | MSVC2013 doesn't like constexpr. Change-Id: I01d2ec318812cb06872e55d993850cc9c528a826 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix alignment issue on most 32bit arm platformsErik Verbruggen2017-07-101-0/+4
| | | | | | | | | | | | | | | The ARM eabi states that 64bit integers are 8-byte aligned (note: iOS explicitly makes an exception to this). The size of the ExecutionContext is 9 "pointers" in size, the CallData is 4 "pointers" in size, so on 64bit architectures CallContext is a nice 13 "pointers" sized structure. However, on ARM the last element of CallData (ValueArray) has a QV4::Value as its last element, and this needs to be 8-byte aligned. So, padding will be inserted, and that will grow it from 15 "pointers" to 16. Task-number: QTBUG-61874 Change-Id: Iba4bc805ef6b459928ef09d604504e896732a8f2 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify SimpleCallContext and CallContextLars Knoll2017-07-051-48/+21
| | | | | | | Plan is to completely remove the need for the simple call context. Change-Id: Ie5e4673a6746dc110adbf526e45188f218fd7bfc Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Get rid of the GlobalContext and WithContext classesLars Knoll2017-07-051-43/+1
| | | | | | | They are just ExecutionContext's. Change-Id: Id543934740b0e54172e469935513847224b19e79 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Simplify and unite handling of activation objects in ContextsLars Knoll2017-07-051-9/+7
| | | | | | | | | | All ExecutionContexts (except for CatchContext) have or can have some sort of activation object. Unify them in one pointer in the ExecutionContext class, and unify it's handling where it's actually the same. Change-Id: I6750999ddbd5d1d74235ef4b34dcd7546c432541 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Switch over to new JS call setupLars Knoll2017-06-291-0/+2
| | | | | | | | | | | | | | | | Differences: - push parameters on the stack, including space for CallData members - call instructions calculate the argument start - use temp space above the calldata to evaluate arguments - fewer temporaries are needed when a call is done while generating the arguments of another call - when calling the function, the js stack space above the callData is not used, allowing for optimizations in the future - Array and ObjectLiteral use the same mechanism Change-Id: Id100fa06f12cc9d941b0f90b0b81b8270a8e4f5d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-9/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 engine() accessor from Object to ManagedLars Knoll2017-05-191-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | We can easily do this now that Managed has a pointer to an internal class (which always has a back pointer to the ExecutionEngine). Remove the extra engine pointer from ExecutionContext, and clean up tow methods in String. Change-Id: I98d750b1afbdeadf42e66ae0c92c48db1a7adc31 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
| * Move the prototype into the internal classLars Knoll2017-05-191-0/+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-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | QmlContextWrapper -> QQmlContextWrapperRobin Burchell2017-05-041-1/+1
| | | | | | | | | | | | | | That poor Q looked so lonely. Change-Id: I29a0aa0574fefa5be8ffaa9857e03500c914c830 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-12/+52
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40