summaryrefslogtreecommitdiff
path: root/src/script/api/qscriptengine_p.h
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-23 08:31:50 +0200
committerKent Hansen <khansen@trolltech.com>2009-10-23 12:18:25 +0200
commitd6af21c0c8c842b684064a63cd37575720bc0ed9 (patch)
tree62c8d0d1f816d99a058a353888910c69cce6fd28 /src/script/api/qscriptengine_p.h
parentb119fd7f3fca35fba80b554778581ffba0a68a62 (diff)
downloadqt4-tools-d6af21c0c8c842b684064a63cd37575720bc0ed9.tar.gz
Inline QtScript exception helper functions
Makes QScriptValue::toNumber() ~50% faster. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/api/qscriptengine_p.h')
-rw-r--r--src/script/api/qscriptengine_p.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index a16785ccdd..ec7c144016 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -527,6 +527,22 @@ inline void QScriptValuePrivate::operator delete(void *ptr)
qFree(d);
}
+inline void QScriptValuePrivate::saveException(JSC::ExecState *exec, JSC::JSValue *val)
+{
+ if (exec) {
+ *val = exec->exception();
+ exec->clearException();
+ } else {
+ *val = JSC::JSValue();
+ }
+}
+
+inline void QScriptValuePrivate::restoreException(JSC::ExecState *exec, JSC::JSValue val)
+{
+ if (exec && val)
+ exec->setException(val);
+}
+
inline void QScriptEnginePrivate::registerScriptString(QScriptStringPrivate *value)
{
Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated);