diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-10-16 14:03:48 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-16 16:03:57 +0200 |
commit | 12c3579136b6925e75cca4f3a9b8bae2e4665db7 (patch) | |
tree | 17f82a28141856af0954ffe4eff20ebc679a3265 /src/qml/jsruntime/qv4engine_p.h | |
parent | c1c526aafb2fc70ac6155eb775b3784f1e2e6504 (diff) |
Speed up exception propagation
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>
Diffstat (limited to 'src/qml/jsruntime/qv4engine_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 5da556452e..e49b6a4ebf 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -326,11 +326,9 @@ struct Q_QML_EXPORT ExecutionEngine StackTrace exceptionStackTrace; void Q_NORETURN throwException(const ValueRef value); - void Q_NORETURN rethrowException(ExecutionContext *intermediateCatchingContext); ReturnedValue catchException(ExecutionContext *catchingContext, StackTrace *trace); void Q_NORETURN throwInternal(); - void Q_NORETURN rethrowInternal(); // ---- @@ -351,6 +349,23 @@ inline ExecutionContext *ExecutionEngine::popContext() return current; } +struct ExecutionContextSaver +{ + ExecutionEngine *engine; + ExecutionContext *savedContext; + + ExecutionContextSaver(ExecutionContext *context) + : engine(context->engine) + , savedContext(context) + { + } + ~ExecutionContextSaver() + { + while (engine->current != savedContext) + engine->popContext(); + } +}; + } // namespace QV4 QT_END_NAMESPACE |