aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4function_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-061-0/+11
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Refactor the way we declare signal parameter namesLars Knoll2015-09-081-1/+6
| | | | | | | | | | | | | | Qml Connection objects where using an awkward way to make the parameter names of signals available to the signal handler. This now uses an approach that is equivalent to what we do with other functions. The main difference is that we can't know the parameter names at type compile time, so we have to rewrite the internal class of the QV4::Function at connect time. Change-Id: I5e538ac840b5a46ccb14ff71684404d947948324 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>
* Fix run-time string handling with regards to the new heapSimon Hausmann2014-11-211-1/+1
| | | | | | | | | | | | | | | | | Changed runtimeStrings to be an array of Heap::String pointers instead of indirect String pointers. Later that member along with other GC related members will go into a managed subclass. Meanwhile the generated code no more loads String pointers directly but just passes the index into the run-time strings to the run-time functions, which in turn will load the heap string into a scoped string. Also replaced the template<T> Value::operator=(T *m) with a non-template overload that takes a Managed *, in order to help the compiler choose the non-template operator=(Heap::Base *) overload. This allows removing a bunch of Value::fromHeapObject calls. Change-Id: I20415c0549d33cca6813441a2495976b66d4c00e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change signature or runtime methods to take an engine pointerLars Knoll2014-11-121-2/+2
| | | | | | | | | This makes a lot more sense in the long term and is the more maintainable solution, once the GC starts moving objects around in memory Change-Id: I8f327c0f5b5b0af38c5fe1a217852ee8c4a5c2fc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup header file dependenciesLars Knoll2014-11-041-32/+0
| | | | | Change-Id: Ibb4658576a98b53de2eac2474ce4d5b9eb83b6ae Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Changed Value to store Managed::Data pointers directlySimon Hausmann2014-11-041-1/+1
| | | | | | | | 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>
* Get rid of StringRefLars Knoll2014-07-221-2/+2
| | | | | | | | Remove the Ref classes, as they won't be required anymore once Managed and Managed::Data are separated. Change-Id: Ic6bec2d5b4ecf2595ce129dbb45bbf6a385138a5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix linkingSimon Hausmann2014-03-111-1/+1
| | | | | | | Add some missing exports Change-Id: I0c250231e902b6efeda257951ee5653ea363e288 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a Line instruction to the interpreterLars Knoll2014-03-071-2/+0
| | | | | | | | | | This unifies the way we handle line numbers in the JIT and Interpreter. Remove the now unused lineNumberMapping code and data. Change-Id: I1d60b1fbb77e70b531fa73d93410683e84dd1e3c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused codeSizesLars Knoll2014-03-031-2/+1
| | | | | Change-Id: I13c7d9dda7cd1e771079f6fdaa175008b3a3e0e5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove nArguments and name from QV4::FunctionLars Knoll2014-03-031-5/+3
| | | | | | | | Saves 12 bytes per Function Change-Id: I9a495805f9201eb6162a520ff5c2defeb73dc37a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* CleanupsLars Knoll2014-01-311-1/+1
| | | | | | | | | | Remove SafeValue, it was used to port over to an exact GC. Since we now have that, we can now safely merge it with QV4::Value again. Also rename SafeString to StringValue for better naming consistency. Change-Id: I8553d1bec5134c53996f6b0d758738a0ec8a2e4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename some filesLars Knoll2014-01-311-1/+1
| | | | | | | | | | | | Rename qv4value_def_p.h -> qv4value_p.h and qv4value_p.h to qv4value_inl_p.h. It makes more sense to have the class definition in the file that is named after the class and move the inline methods into a _inl file. Doing this now, as I expect we'll be needing a few more _inl files soon. Change-Id: Ib59e9380e9e976254c6b4369574157f39b1b5f51 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use an internalClass to represent formals and locals in CallContextsLars Knoll2013-12-041-2/+3
| | | | | | | | | | formals and locals in a CallContext where so far accessed through a linear search in ExecutionContext::getProperty. Fix this by introducing an internalClass for the Function used by the call context. Change-Id: I1141efa12b19d6de4a354bfd6e769c5ffcb8898b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove unused inline wrapperLars Knoll2013-12-041-4/+1
| | | | | | | | | The wrapper method for Function::code() was still there from the times we used C++ exceptions. It's not needed any more, so get rid of it. Change-Id: I2ec25fbca71eeef9d7a94a38b5adfa42e4de3a84 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4 debugging: fix step-over and step-out.Erik Verbruggen2013-11-141-1/+1
| | | | | | | | | | | | | | | | - step-out: only stop if we’re leaving the context for the function we previously stopped at, so intermediate calls between the current position and the end do not stop the engine - step-over: set breakpoints on all lines in current function and continue to run. When hitting a breakpoint, see if we are in the same context, because recursive calls might happen. Breakpoints on all lines are needed, because the (pure) next line might be jumped over (like when doing step-over a single-line then clause, where the next line might be in the else clause). Change-Id: Idf35dc740ca64fae5079162162906490a96af2a7 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Debugging with V4Erik Verbruggen2013-11-101-0/+1
| | | | | | | | | Currently missing, but coming in subsequent patches: - evaluating expressions - evaluating breakpoint conditions Change-Id: Ib43f2a3aaa252741ea7ce857a274480feb8741aa Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove code that's not required anymoreLars Knoll2013-11-051-17/+0
| | | | | | | | | The StackSaver class is not required anymore, as we don't throw C++ exceptions anymore, and masm/moth generated code always cleans up the JS stack. Change-Id: If49d952230f8bd074f3b9353f56c07c8c5134752 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-051-1/+1
| | | | | | | | | | | 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>
* Speed up exception propagationSimon Hausmann2013-10-161-7/+18
| | | | | | | | | | Avoid catch (...) with re-throw as it turns that this is very slow because it throws a new exception and the unwinder starts from scratch. Instead use stack allocated objects and cleaning destructors to restore state before continuing with the propagation of exceptions. Change-Id: I6d95026bcd60b58cb6258a9dae28623a46739532 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change exception handling APISimon Hausmann2013-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the exception handling API in the engine slightly, encapsulating any use of direct throw statements and catch blocks with concrete types. In the future we need to be able to change the way these are implemented, in order to ensure that the correct stack unwinding code is triggered for throw and re-throw. This patch separates the C++ exception object thrown from the V4 exception (that includes value, throwing context pointer) and stores the latter inside the engine. In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to move into the QV4 namespace directly. In addition the syntax for catching exceptions changes from try { ... } catch (QV4::Exception &ex) { ex.accept(context); QV4::ScopedValue exceptionValue(scope, ex.value()); } to try { ... } catch (...) { QV4::ScopedValue exception(scope, context->catchException()); } Context::catchException() checks if there's a "current" exception in the engine, and if not assumes that we caught an unrelated exception and consequently re-throws. partiallyUnwind() is also gone and replaced with rethrowException(), in order to encapsulate the re-throw. Lastly, in the future nesting try/catch blocks isn't going to be possible due to limitations in the common C++ ABI with regards to foreign exceptions. Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use SafeValue in more placesLars Knoll2013-09-281-1/+1
| | | | | Change-Id: Ic15c1419c74f22bd7639ce8746ff11b15240b718 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Prevent objects from being collected while in their constructorLars Knoll2013-09-221-1/+1
| | | | | | | | | | | | | While objects are being constructed, we don't have a reference to them on the JS stack yet. So the constructor needs to protect itself against being collected by putting the this object onto the JS stack. Added an environment switch MM_EXACT_GC to test exact garbage collection. Change-Id: Ie37665a954de800359c272ffbebbe1488e7a8ace Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into HEADSimon Hausmann2013-09-201-3/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_masm.cpp src/qml/jsruntime/qv4script.cpp src/qml/qml/qml.pri src/qml/qml/qqmltypeloader_p.h Change-Id: Ia784d855a2131e3289454f12d841ca2c65be15c1
| * Change calling convention in JIT to use ReturnedValueSimon Hausmann2013-09-181-3/+3
| | | | | | | | | | | | | | This simplifies the masm backend as well and should be faster. Change-Id: I64ad5d9ee1b6caca950471e3aec4ef19d7503e62 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge branch 'dev' of qtdeclarative into wip/v4Simon Hausmann2013-09-111-1/+12
|\| | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4script.cpp Change-Id: I20136cab29d86862b5bd9208003200bc24bcdacf
| * Properly unwind the js stack for generated codeLars Knoll2013-09-111-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Surround all calls into generated code with a try {} catch {} statement that resets the jstack to the correct position. Like this we properly unwind the js stack in all cases, and can also use stricter assertions in our ScopedCallData, etc. classes to check that the stack is healthy. Change-Id: I7ca03e06ea55007be683305d9c2a6898cf5fc689 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Beginning of a new qml parserSimon Hausmann2013-09-081-1/+0
|/ | | | | | | | | | | | | | The goal is to parse QML and JavaScript binding expressions/functions in one go and generate data structures that allow for the parsing to happen in a thread and the instantiation of the object tree in another thread, just reading from the generated data structures. This will replace qqmlcompiler and the VME. This new way of loading QML is currently hidden behind the QML_NEW_COMPILER=1 environment variable. There's lots of work left to fill in the gaps in object construction, Component support, Component.onComplete, error messages, etc. etc. Change-Id: I5e40643cff169f469f0b6ce151584ffee5ca5e90 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove unused Function::engine member and line number mapping typeSimon Hausmann2013-08-161-9/+0
| | | | | Change-Id: Id227139bf385aa92e539cdb0d0012e1360679c81 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge Function::init with the constructorSimon Hausmann2013-08-161-13/+2
| | | | | Change-Id: I557f8a80aa2c74398b94e87ed0f29fe8d2297150 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Refcount the compilation unit and remove refcount from runtime functionSimon Hausmann2013-08-161-13/+1
| | | | | Change-Id: Iaa2f96a6814f1b39589ffcfe3c84e3c229e25f1f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QV4::Function::lineNumberMappings by porting moth to the new mappingSimon Hausmann2013-08-161-2/+0
| | | | | Change-Id: Ib79489ac4c6c93042143be1f512d29c13d4cd3c6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QV4::Function::generatedValues by porting moths' regexps to ↵Simon Hausmann2013-08-161-1/+0
| | | | | | | runtime expressions Change-Id: Iaae3c4855016948952159596d2528fca73341b72 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ported identifiers in moth to use runtime stringsSimon Hausmann2013-08-161-1/+0
| | | | | Change-Id: I09f04994a2ebe631b12fa76b77a622711de31926 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of the QV4::Function in the masm iselSimon Hausmann2013-08-161-1/+2
| | | | | Change-Id: Ide70ca5a3f3dcc793fb96fd64f8b8df6b07d1168 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Ported lookups to use the compiled data infrastructureSimon Hausmann2013-08-151-3/+0
| | | | | Change-Id: Idf75cd51087ea825f22aabda59661be461fd3b86 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Initialize formals and locals from the compiled function data instead of in ↵Simon Hausmann2013-08-151-0/+3
| | | | | | | the isel Change-Id: I9db976df310a5986ceca66d21efeeae536dbede4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Store the file name per compilation unit, not per compiled functionSimon Hausmann2013-08-151-1/+1
| | | | | Change-Id: Id699897b241a9ff6495689e5685092d311acb8c2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move codeRef out of QV4::FunctionSimon Hausmann2013-08-151-2/+0
| | | | | Change-Id: I65700b9cc4907aaa28623a95204e88f87fccfd49 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move QV4::Function::sourceFile to CompiledFunctionSimon Hausmann2013-08-151-1/+2
| | | | | Change-Id: Iacf907c475070bab4a5a1583280f110c089141c4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of flags in QV4::Function and use CompiledFunction::flags insteadSimon Hausmann2013-08-151-12/+6
| | | | | Change-Id: Iffe72ff6dd0311d7548d1ea41164a400fd3a7600 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix writing the function offset table and initialize the pointer to the ↵Simon Hausmann2013-08-151-0/+2
| | | | | | | compiled function in the runtime function Change-Id: I9aed9f394fedc4a4ea334f6ab1b72fe749c64c72 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Begin using the compiled data structures for runtime stringsSimon Hausmann2013-08-151-0/+3
| | | | | Change-Id: Idbf278a96624bf101df35de40577b38e593f22be Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add reference counting to the VM functionsSimon Hausmann2013-08-121-2/+16
| | | | | | | | | This reduces memory pressure, keep engine->functions small and thus makes back trace lookup faster. It became visible for example in the QtQuickControls auto-tests that use plenty of loaders and we ended up with 30k+ functions. Change-Id: Iaa5981f44e1e49ad9417a50c1e6a74946090dd28 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of unused outer function pointer of QV4::FunctionSimon Hausmann2013-08-121-2/+0
| | | | | Change-Id: I3ea88d3c259447081d1ac5f85d7da95fed8f02f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Restructure source codeLars Knoll2013-08-081-0/+142
Move the v4 engine classes from a subdir of qml/qml into two subdirs (compiler and jsruntime) of the qml module Remove an unsued qv4syntaxchecker class, and move the moth code directly into compiler. Change-Id: I6929bede1f25098e6cb2e68087e779fac16b0c68 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>