aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4globalobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Speed up exception propagationSimon Hausmann2013-10-161-21/+25
| | | | | | | | | | 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>
* Fix some more issues with exact GCLars Knoll2013-10-151-1/+1
| | | | | | | | | 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>
* Remove some unused flags from ManagedLars Knoll2013-10-121-1/+0
| | | | | Change-Id: I94399489823d5b0d4d40f300e1999272dc2da5c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Cleanup exception handlingSimon Hausmann2013-10-031-1/+0
| | | | | | | | | | 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 exception handling APISimon Hausmann2013-10-021-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix API for evalCall()Lars Knoll2013-09-281-6/+6
| | | | | Change-Id: Ib80b18348e18eb93044a73358f0c4e266b988f63 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove Value::fromString()Lars Knoll2013-09-281-8/+8
| | | | | | | | replaced with call to the GC safe ExceutionEngine::newString() method. Change-Id: I7258296e75ca724ff42b94a0d147bc33a05f8f68 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Value usage in ErrorObjectsLars Knoll2013-09-281-8/+20
| | | | | Change-Id: Iaa14ad5a8d3f085843e49195f8f4bb7bb020b9b6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-1/+1
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Clean up QV4::ExecutionContextLars Knoll2013-09-281-8/+0
| | | | | | | Remove an unused variable, and don't copy runtimeStrings Change-Id: I2197a7eb82ab3dbefea83cc917567390266f9673 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix CallContext to not hold arguments on the C stack anymoreLars Knoll2013-09-281-19/+19
| | | | | Change-Id: I35f46cce4f243d4b8b2bac9244f8fc26836f413b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change the runtime API over to using StringRef's instead of String*Lars Knoll2013-09-221-1/+1
| | | | | Change-Id: I0ea95e6cca995dc5f98871f0369204af18e48111 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Further work towards an exact GCLars Knoll2013-09-221-19/+26
| | | | | | | | | | | Add some more convenience in the helper classes in qscopedvalue_p.h Make accesses to CallData safer, and change ExecutionEngine::newObject() to return a safe pointer. Change-Id: I980909754ce9681cf6faa1355bab3a1e5d6dd186 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix regression with isNaN and isInfLars Knoll2013-09-181-2/+2
| | | | | | | | | We use std::isnan and std::isinf to determine whether a number is NaN or Inf. Unfortunately some versions of these methods seem to return int instead of bool, breaking the Encode() call. Change-Id: Iec58eb3a5f344373a389ddbc7f6ee81cdead2726 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert builtin methods to return a ReturnedValueLars Knoll2013-09-181-37/+37
| | | | | Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-1/+1
| | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Require a ValueScope for ScopedCallData as wellLars Knoll2013-09-181-1/+1
| | | | | | | | This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::call()Lars Knoll2013-09-181-6/+6
| | | | | Change-Id: Ief2d75e9789dd367c603d90dc0fe5316a0d055e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Change calling convention in JIT to use ReturnedValueSimon Hausmann2013-09-181-1/+2
| | | | | | | This simplifies the masm backend as well and should be faster. Change-Id: I64ad5d9ee1b6caca950471e3aec4ef19d7503e62 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change signature of call/construct() to take a pointer to a CallDataLars Knoll2013-09-111-2/+2
| | | | | Change-Id: I5467aadba083e4b01fb0a7170946695207033680 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move CallData onto the JS stackLars Knoll2013-09-111-4/+6
| | | | | Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* change calling convention for JS function callsLars Knoll2013-09-021-3/+5
| | | | | | | | | | | | This allows faster pass through of the data if we have nested calls. Also make sure we always reserve at least QV4::Global::ReservedArgumentCount Values on the stack to avoid stack corruption. Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Add a SimpleScriptFunction classLars Knoll2013-09-021-1/+1
| | | | | | | | | Choose whether we use a stack based context for a function, when the actual closure is generated, not at call time. This speeds up function calling for leaf functions. Change-Id: Ibcbf3acb5610a7f59b6474e982122df03c1c5298 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix eval operating on incorrect runtime dataSimon Hausmann2013-08-181-0/+13
| | | | | | | | Moved compilationUnit and compiledFunction into the context and set it also during eval, along with the runtime strings. Change-Id: I627b3bea0f7c38ad91bc5e8ee85e1484d08ed3f3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of flags in QV4::Function and use CompiledFunction::flags insteadSimon Hausmann2013-08-151-2/+2
| | | | | Change-Id: Iffe72ff6dd0311d7548d1ea41164a400fd3a7600 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Restructure source codeLars Knoll2013-08-081-0/+652
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>