diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-10-23 08:31:50 +0200 |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-10-23 12:18:25 +0200 |
commit | d6af21c0c8c842b684064a63cd37575720bc0ed9 (patch) | |
tree | 62c8d0d1f816d99a058a353888910c69cce6fd28 /src/script | |
parent | b119fd7f3fca35fba80b554778581ffba0a68a62 (diff) | |
download | qt4-tools-d6af21c0c8c842b684064a63cd37575720bc0ed9.tar.gz |
Inline QtScript exception helper functions
Makes QScriptValue::toNumber() ~50% faster.
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine_p.h | 16 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 16 | ||||
-rw-r--r-- | src/script/api/qscriptvalue_p.h | 4 |
3 files changed, 18 insertions, 18 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); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 08a31762b6..52a1e6d4c6 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -438,22 +438,6 @@ void QScriptValuePrivate::setVariantValue(const QVariant &value) static_cast<QScript::QVariantDelegate*>(delegate)->setValue(value); } -void QScriptValuePrivate::saveException(JSC::ExecState *exec, JSC::JSValue *val) -{ - if (exec) { - *val = exec->exception(); - exec->clearException(); - } else { - *val = JSC::JSValue(); - } -} - -void QScriptValuePrivate::restoreException(JSC::ExecState *exec, JSC::JSValue val) -{ - if (exec && val) - exec->setException(val); -} - void QScriptValuePrivate::detachFromEngine() { if (isJSC()) diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 444c76a807..c322a37d2b 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -127,8 +127,8 @@ public: return -1; } - static void saveException(JSC::ExecState*, JSC::JSValue*); - static void restoreException(JSC::ExecState*, JSC::JSValue); + static inline void saveException(JSC::ExecState*, JSC::JSValue*); + static inline void restoreException(JSC::ExecState*, JSC::JSValue); QScriptEnginePrivate *engine; Type type; |