summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-22 14:01:26 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-10-23 10:18:24 (GMT)
commit4d318525c9663a46d36b27605143dab3250d2b9b (patch)
tree0cbd561811df113aaca533896c4b82ea898779e9 /src
parentcb3544a0c33973cfb662e0215e1b130d23045814 (diff)
downloadQt-4d318525c9663a46d36b27605143dab3250d2b9b.zip
Qt-4d318525c9663a46d36b27605143dab3250d2b9b.tar.gz
Qt-4d318525c9663a46d36b27605143dab3250d2b9b.tar.bz2
Inline scriptEngineFromExec() function
Makes QScriptContext::engine() 80% faster. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src')
-rw-r--r--src/script/api/qscriptengine.cpp16
-rw-r--r--src/script/api/qscriptengine_p.h20
2 files changed, 21 insertions, 15 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index ceaeccb..a628578 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -343,15 +343,10 @@ public:
namespace QScript
{
-struct GlobalClientData : public JSC::JSGlobalData::ClientData
+void GlobalClientData::mark(JSC::MarkStack& markStack)
{
- GlobalClientData(QScriptEnginePrivate *e)
- : engine(e) {}
- virtual ~GlobalClientData() {}
- virtual void mark(JSC::MarkStack& markStack) { engine->mark(markStack); }
-
- QScriptEnginePrivate *engine;
-};
+ engine->mark(markStack);
+}
class TimeoutCheckerProxy : public JSC::TimeoutChecker
{
@@ -452,11 +447,6 @@ qsreal integerFromString(const QString &str, int radix)
return integerFromString(ba.constData(), ba.size(), radix);
}
-QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec)
-{
- return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine;
-}
-
bool isFunction(JSC::JSValue value)
{
if (!value || !value.isObject())
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 02cf100..c9faa46 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -101,11 +101,22 @@ namespace QScript
class TimeoutCheckerProxy;
//some conversion helper functions
- QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec);
+ inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec);
bool isFunction(JSC::JSValue value);
class UStringSourceProviderWithFeedback;
-}
+
+struct GlobalClientData : public JSC::JSGlobalData::ClientData
+{
+ GlobalClientData(QScriptEnginePrivate *e)
+ : engine(e) {}
+ virtual ~GlobalClientData() {}
+ virtual void mark(JSC::MarkStack& markStack);
+
+ QScriptEnginePrivate *engine;
+};
+
+} // namespace QScript
class QScriptEnginePrivate
#ifndef QT_NO_QOBJECT
@@ -367,6 +378,11 @@ private:
JSC::ExecState *oldFrame;
};
+inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec)
+{
+ return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine;
+}
+
} // namespace QScript
inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)