aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
Commit message (Collapse)AuthorAgeFilesLines
* V4 debugger: retrieve formals and locals.Erik Verbruggen2013-10-244-94/+228
| | | | | Change-Id: I47507a4d7d1b429b9c43ed3a7822079efe577327 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Win32: Remove dependency to DbgHelp DLLSimon Hausmann2013-10-231-4/+0
| | | | | | | | This was used for natice stack trace determination, which is done differently now. Change-Id: Id983f2bf6805aaf3f7081a16196268be88c98951 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Avoid crash when a QML signal is connected to a non-void slotJ-P Nurmi2013-10-221-5/+3
| | | | | | | | | | Don't pass a QVariant pointer for the return value when we're not interested in it and the return type might not even be a QVariant (that would be only true for QML methods). Task-number: QTBUG-32801 Change-Id: I8f14e40d8f94caef7e3d086b776735f0484dbf0e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix MSVC2013 compilationYuchen Deng2013-10-211-0/+2
| | | | | | Change-Id: I79b50e786f46c9a15963f09158c18871c95fe093 Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove internal method from public APILars Knoll2013-10-193-1/+27
| | | | | | | | QQmlError is public API and shouldn't expose an internal method. Change-Id: I7caf06af9340fefec5c96103395fe74acbf19497 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Some minor optimizationsLars Knoll2013-10-194-42/+38
| | | | | Change-Id: Ib2e08e7c89ca59a48f8fd52b30981e5d7e60803b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ARM thumb2 mode detectionSimon Hausmann2013-10-171-1/+5
| | | | | | | | | __TARGET_ARCH_THUMB may not always be defined, but __thumb2__ for example is also a good indicator that we can generated and run thumb2 code and thus enable the JIT. Change-Id: I987d0af5883d9bb844c4c99a0691a12aedc94ff5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix build on ARM in ARM mode (instead of thumb2)Simon Hausmann2013-10-171-0/+31
| | | | | | | | | | We don't support the traditional ARM assembler (yet), only JIT on thumb2. In order for us to reliably check that, we have to wait until the pre-processor runs, which this patch achieves by moving all JIT enable/disable decisions into qv4global_p.h Change-Id: I7eff5b4fbf1cd26297a08dee16984ad867358113 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix performance regression when doing property lookups for non-existant ↵Simon Hausmann2013-10-161-1/+1
| | | | | | | | | | | | | | | | | properties Commit 84627464eb11ca1149d46946b12e3c82eb54a8bf introduced a performance regression of falling back to reading the QMetaObject, when the lookup for a property in QML failed, after we've tried in the property cache. This is very very expensive to do and was only due to QQmlPropertyMap not correctly invalidating the property cache. Instead remove the property cache from the property map's QObject and on the lookup side rely on the property cache being correct in the result (positive or negative). Change-Id: I8a013483203f2007d48b71feafa10b3ea02c53fd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up exception propagationSimon Hausmann2013-10-169-144/+100
| | | | | | | | | | 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>
* Speed up stack trace generation for the JITSimon Hausmann2013-10-165-272/+8
| | | | | | | | | | | | | | It turns out that in QML it is not unusual that during early binding evaluations due to the undefined order, the evaluation tries to look up properties in objects that aren't initialized yet and thus exceptions are thrown. Eeach thrown exception saves a stack trace, which is expensive to generate when using the JIT, as it does full stack unwinding. This patch implements a more light-weight approach by storing the instruction pointer in the context before leaving JIT generated code. Change-Id: I95e1cfd01179247dfc2c1df949828f474a23161b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Turn on exact garbage collection by defaultLars Knoll2013-10-161-22/+23
| | | | | | | | | Keep conservative GC as a fallback for testing Enable all tests again that were skipped due to GC issues. Change-Id: I8e0fa728207bdd39a96d0acf95e27841157d8402 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix cleanup handlers on Android when exceptions are thrownSimon Hausmann2013-10-161-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | When an exception is thrown and we traverse a frame that requires only cleanup (i.e. call QV4::Scope::~Scope), control is first transferred to the generated cleanup code. Afterwards the unwinding is resumed (on ARM) by calling __cxa_end_cleanup, which resides in libsupc++ (libgnustl_shared). __cxa_end_cleanup first calls __gnu_end_cleanup and then resumes the process of stack unwinding by calling _Unwind_Resume (per specification). Given the linking situation on Android, this will end up calling _Unwind_Resume inside libgnustl_shared, which sidesteps our statically linked copy of the unwind code in QtQml (libgcc.a). Therefore any further unwinding through JIT generated frames will fail. This patch introduces the same EABI symbol exported in libQt5Qml, which will direct control to the correct JIT aware unwinder. This relies on https://codereview.qt-project.org/#change,68206 in order to ensure that libsupc++.a is gone from all link lines (not needed) and that gnustl_shared is after libQt5Qml. Task-Number: QTBUG-33892 Change-Id: I6ed691db3ceb287475a70b7af8cf3cd7b4ddfdd6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix GC issues with usage of raw RegExp pointersLars Knoll2013-10-154-7/+10
| | | | | | | Properly protect them through Scoped values. Change-Id: I5a0a1d5580d55ecff493419baa8959751a65f1d3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove debug outputLars Knoll2013-10-151-4/+0
| | | | | | | The output messes up some auto tests Change-Id: I9b9b2b4fdf023bc9953939b814872e860c84f484 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix some more issues with exact GCLars Knoll2013-10-152-3/+3
| | | | | | | | | Get the formal and local names of function object from the compilation unit to avoid creating another set of strings. Use a ScopedFunctionObject in eval() Change-Id: I6693aec2e88818df9c160b3780db12d8df79c2fe Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* inline get_element callsLars Knoll2013-10-144-12/+24
| | | | | | | | | | | Inline calls to get_element if the base is an object with a simple array structure, and the index is an integer number. Implemented for 64bit only for now, saves ~25% on crypto.js Change-Id: I3e34a6409169d90d3937f62264707d52a6c2f9f7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid creating array attributes if possibleLars Knoll2013-10-146-57/+47
| | | | | | | | | | | Holes in arrays should be represented by an empty value, not by creating/setting array attributes. Reason is that the creation is irreversable, and slows down execution. This speeds up crypto.js by 10% Change-Id: I2e5472575479a5f2dbe53f59ecb8ed3aeab1be7a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some unused flags from ManagedLars Knoll2013-10-125-14/+3
| | | | | Change-Id: I94399489823d5b0d4d40f300e1999272dc2da5c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Correctly set the vtbl for Boolean and NumberObjectLars Knoll2013-10-112-1/+5
| | | | | | | | Also accept a boolean primitive as input to Boolean.prototype.valueOf() Change-Id: I5b94d8d65b86e26860b9844eb4bf823577c8e924 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix the remaining objects against self destructionLars Knoll2013-10-119-5/+35
| | | | | | | | This makes pretty much all test cases pass with exact garbage collection. Change-Id: Ia874e3c17c3984afb7cfe370f9bd3ad8fe46699a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Optimise code generation for convertTypeToSInt32Lars Knoll2013-10-112-1/+9
| | | | | | | | Add 64 bit code patch and avoid some duplicated calculation in 32 bit mode Change-Id: I0e111de8ac4e733aa8802c49b4b15d785688d7ea Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix build on Android with -developer-buildSimon Hausmann2013-10-112-1/+2
| | | | | | | | | | | | That configuration implies -Werror for some kind of warnings. This patch fixes * Mix of different types in conditional (qv4isel_masm.cpp) * Noreturn function returning instead of calling another noreturn function at the end (qv4engine_cxxabi.cpp) * An out-of-line function being declared inline Task-Number: QTBUG-33998 Change-Id: I3ba58dcadeac6774c5de63e6bb551354a2f23332 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Protect a few constructors against self destructionLars Knoll2013-10-111-1/+2
| | | | | | | | This gets most of qqmlecmascript to pass with aggressive and exact garbage collection. Change-Id: I93ecbfe55f62af68227cdf3b1ec2bd066f1cbdef Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Smaller cleanupsLars Knoll2013-10-1112-30/+32
| | | | | Change-Id: I0a7eee96ef7c92ad4a3c5963010e3ac66fe6ed3a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove usage of String pointers where not requiredLars Knoll2013-10-111-1/+1
| | | | | Change-Id: Ia533308a1641fab263d8faa8316455e8ade1c859 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more direct usages of Managed pointersLars Knoll2013-10-112-8/+8
| | | | | Change-Id: I32f61b7919797eef51a8705695787175b76244c4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix build on iOSSimon Hausmann2013-10-111-2/+6
| | | | | | | | | | | On 32-bit ARM, iOS uses SJLJ for exceptions, which is probably why _Unwind_Backtrace is not available (it's hard to implement reliably without unwind tables). Don't use it there, we don't need it (because we can't JIT). Task-Number: QTBUG-33979 Change-Id: Ifafbb59a32fd23c9b2e93228779535b2324ac4a3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* V4 runtime: add some more counters.Erik Verbruggen2013-10-102-0/+21
| | | | | Change-Id: I872f259a9fd4580e8faeae664f4d34f59a785c4e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4 JIT: generate some strict (not) equal conditionsErik Verbruggen2013-10-101-2/+8
| | | | | | | | | | | Checks for strict (not) equal to null, undefined, or a boolean value can be generated without reserving extra registers, or doing a call. This reduces the amount of runtime calls from >25mln to ~6500 for v8-bench.js Change-Id: If08d1124b2869227654b1233a89833c5b5e7b40c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use common prefix for environment variableKai Koehne2013-10-091-3/+3
| | | | | Change-Id: Idbbdcad42106d30451000fc6593428a0bac4bc04 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Reshuffle inlined functions to fix MinGW-warnings.Friedemann Kleint2013-10-052-58/+58
| | | | | | | | | | | | | | | | | | | When compiling QtQuick: qv4value_p.h:80:17: warning: 'QV4::Managed* QV4::Value::asManaged() const' redeclared without dllimport attribute after being referenced with dll linkage ^ qv4value_p.h:180:14: warning: 'static QV4::Value QV4::Value::fromManaged(QV4::Managed*)' redeclared without dllimport attribute after being referenced with dll linkage ^ qv4value_p.h:285:16: warning: 'QV4::String* QV4::Value::asString() const' redeclared without dllimport attribute after being referenced with dll linkage Change-Id: I548a2f8049b8eca06ab1061f56416a332820dc01 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Signal no region descriptors follow the ETH table.Petr Nejedly2013-10-041-1/+2
| | | | | | | | | | | | In our implementation, the 2-word EXIDX is directly followed by a 3-word ETH for personality 2 unwind interpretter. According to ARM EHABI 9.2, "region of interest" descriptors should follow, finished by a single zero word. As the generated functions don't have any such regions, only the closing zero needs to be present. Change-Id: I65fde548371cf12a31aac3e8829275965e034f3a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Temporarily disable libunwind exception throwing on MacSimon Hausmann2013-10-032-3/+3
| | | | | | | | | The run-time appears to have a slightly different behaviour wrt exception ownership. We don't strictly need this code path on Mac, so use regular C++ exceptions until I can figure out what happens there. Change-Id: Idd540c8656d25ffdb4002843f398114881e33214 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix backtrace generation on Android/ARM/QNXSimon Hausmann2013-10-031-5/+37
| | | | | | | | | | | | Use a GCC extension to the common C++ ABI's called _Unwind_Backtrace, which generate backtraces if possible. Its direct use will ensure we use the statically linked unwind, which knows about our unwind tables. This also helps for the setup when libc doesn't have the glibc specific backtrace() function we used previously. The unwinder on Mac OS X with clang also implements the same extension. Change-Id: I0b780590c10c16e50ec570f7da1efae2e64c46dd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanup exception handlingSimon Hausmann2013-10-0313-228/+97
| | | | | | | | | | The code in the Exception class operates entirely on the engine's data, so move it into ExecutionEngine instead. This eliminates the need for a QV4::Exception class and catches and old code that tries to still do catch (Exception &) instead of catch (...) Change-Id: Ie608bec6af652038aca6c9423c225a4d7eb13b39 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change v4 exceptions to use the common C++ ABIs foreign exceptionsSimon Hausmann2013-10-035-65/+56
| | | | | | | | | | | | | | | | | | | On platforms where we use the common C++ ABI, throw the exception not using a dummy C++ exception structure and the throw keyboard, but instead use the lower-level _Unwind_RaiseException to throw a foreign exception. It is caught with the existing "catch (...)" and re-throw is implemented similarly, by grabbing the current exception from the globals (a standardized data structure) and re-throwing it. On platforms such as ARM that lack hooks for supplying our unwind tables to the system run-time, this patch will make it possible to link the unwinder statically into libQtQml (libgcc or libunwind) and thus force it to use our unwind tables, because throwing or re-throwing will always go through our statically linked code through direct calls to _Unwind_RaiseException (instead of libstdc++). Change-Id: Ic2ac056fc7ed9e93fb51e30ab45f35b260487c5f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: invert conditions when the true block follows the test.Erik Verbruggen2013-10-031-0/+2
| | | | | Change-Id: I5044acd4263b71734e4eb5d7e74b1a4a8414741e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change exception handling APISimon Hausmann2013-10-0221-136/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Cleanup API of Safe<T>Lars Knoll2013-10-0212-33/+58
| | | | | | | | Don't have an implicit cast operator to Returned<T> anymore, and return a T* from the operator->() Change-Id: If4165071b986bfc84a157560d94d39c2dcfbc9e1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use SafeValue instead of Value in ScopedValue methodsLars Knoll2013-10-0214-59/+57
| | | | | Change-Id: Ie463efe600d498ce77d4b9e8b48abcfd61c1ab78 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove some more uses of QV4::ValueLars Knoll2013-10-027-26/+29
| | | | | | | All remaining uses should be GC safe now. Change-Id: I05c962de6ab896f108f70caa1bf937a24e67bfe1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove more uses of ValueLars Knoll2013-10-0219-72/+75
| | | | | Change-Id: I889e760f75b485a28e1f2a2c26b2337ae9bfafac Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix ObjectIterator API to be GC safeLars Knoll2013-10-0221-104/+158
| | | | | Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix compilation on Android with 4.8 toolchainLaszlo Agocs2013-10-013-9/+10
| | | | | Change-Id: I1ce4ec8c9c671f0130c1530c772c1dd74f1fb1f4 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* V4: fix ArrayPrototype::method_isArray() build breakJ-P Nurmi2013-10-011-1/+1
| | | | | | | | | With a recent Clang in C++11 mode: error: incompatible operand types ('QV4::ArrayObject *' and 'bool') Task-number: QTBUG-33706 Change-Id: I7bd4fe01176745fb6f8dbdf8f271edb7121eb35e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Compile imported scripts in the loader threadSimon Hausmann2013-09-302-0/+101
| | | | | | | | | | | | | | | | | This has the benefit of blocking the GUI thread less and speeding up type creation in the GUI thread (for types that import js libraries). This patch also brings one behavioral change: Due to the parsing at type instantiation type, things like syntax errors for script imports would only generate a run-time warning and the code in the QML file would just see "undefined". Errors in the script now generate real errors at component compilation time, meaning the errors come out earlier and as real errors. This patch implements the separation for the VME only (to keep the size of this patch small). Change-Id: I82f7f3a2d3d4524ea12a7ab62abd8640aba6a47f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* V4: remove inplace operationsErik Verbruggen2013-09-305-320/+0
| | | | | | | | | Inplace operations are expanded when building the IR, so the neither the IR, nor the instruction selection backends or runtime need to handle them. Change-Id: Id01f9544e137dd52364cf2ed2c10931c31ddfff3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove some uses of raw Object pointersLars Knoll2013-09-309-70/+67
| | | | | Change-Id: I7c715f33d197ebbf6f0c00040099b27ed7221d42 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* remove more uses of QV4::ValueLars Knoll2013-09-301-19/+18
| | | | | Change-Id: I11b0b2b7626297e2c98dc77784574da4b59ba8cf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>