summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine_p.h
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/script/api/qscriptengine_p.h
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/script/api/qscriptengine_p.h')
-rw-r--r--src/script/api/qscriptengine_p.h20
1 files changed, 18 insertions, 2 deletions
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)