summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-23 06:31:50 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-10-23 10:18:25 (GMT)
commitd6af21c0c8c842b684064a63cd37575720bc0ed9 (patch)
tree62c8d0d1f816d99a058a353888910c69cce6fd28
parentb119fd7f3fca35fba80b554778581ffba0a68a62 (diff)
downloadQt-d6af21c0c8c842b684064a63cd37575720bc0ed9.zip
Qt-d6af21c0c8c842b684064a63cd37575720bc0ed9.tar.gz
Qt-d6af21c0c8c842b684064a63cd37575720bc0ed9.tar.bz2
Inline QtScript exception helper functions
Makes QScriptValue::toNumber() ~50% faster. Reviewed-by: Olivier Goffart
-rw-r--r--src/script/api/qscriptengine_p.h16
-rw-r--r--src/script/api/qscriptvalue.cpp16
-rw-r--r--src/script/api/qscriptvalue_p.h4
3 files changed, 18 insertions, 18 deletions
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index a16785c..ec7c144 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 08a3176..52a1e6d 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 444c76a..c322a37 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;