summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-22 15:37:08 +0200
committerKent Hansen <khansen@trolltech.com>2009-10-23 12:18:23 +0200
commit6209eb29588801c55891401c82ec17efa310f7f3 (patch)
treeea9533ceaeebc2ee1202982bd6171f93f4bb2213 /src/script
parent8a15a24a8aa7faeb2c02944de6f97105f0424906 (diff)
Inline two internal QtScript functions (contextForFrame() and globalExec())
Makes QScriptEngine::currentContext() 25% faster. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptengine.cpp15
-rw-r--r--src/script/api/qscriptengine_p.h19
2 files changed, 17 insertions, 17 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 3f2c9b4c58..0673f5b232 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -995,16 +995,6 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot
info->prototype = prototype;
}
-QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame)
-{
- if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee()
- && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) {
- //skip the "fake" context created in Interpreter::execute.
- frame = frame->callerFrame()->removeHostCallFrameFlag();
- }
- return reinterpret_cast<QScriptContext *>(frame);
-}
-
JSC::ExecState *QScriptEnginePrivate::frameForContext(QScriptContext *context)
{
return reinterpret_cast<JSC::ExecState*>(context);
@@ -1056,11 +1046,6 @@ void QScriptEnginePrivate::setGlobalObject(JSC::JSObject *object)
}
}
-JSC::ExecState *QScriptEnginePrivate::globalExec() const
-{
- return originalGlobalObject()->globalExec();
-}
-
/*!
\internal
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 3766559dcd..42c0444805 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -147,7 +147,7 @@ public:
JSC::JSValue defaultPrototype(int metaTypeId) const;
void setDefaultPrototype(int metaTypeId, JSC::JSValue prototype);
- static QScriptContext *contextForFrame(JSC::ExecState *frame);
+ static inline QScriptContext *contextForFrame(JSC::ExecState *frame);
static JSC::ExecState *frameForContext(QScriptContext *context);
static const JSC::ExecState *frameForContext(const QScriptContext *context);
@@ -156,7 +156,7 @@ public:
JSC::JSObject *customGlobalObject() const;
JSC::JSObject *globalObject() const;
void setGlobalObject(JSC::JSObject *object);
- JSC::ExecState *globalExec() const;
+ inline JSC::ExecState *globalExec() const;
JSC::JSValue toUsableValue(JSC::JSValue value);
static JSC::JSValue thisForContext(JSC::ExecState *frame);
static JSC::Register *thisRegisterForFrame(JSC::ExecState *frame);
@@ -512,6 +512,21 @@ inline void QScriptEnginePrivate::unregisterScriptString(QScriptStringPrivate *v
value->next = 0;
}
+inline QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame)
+{
+ if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee()
+ && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) {
+ //skip the "fake" context created in Interpreter::execute.
+ frame = frame->callerFrame()->removeHostCallFrameFlag();
+ }
+ return reinterpret_cast<QScriptContext *>(frame);
+}
+
+inline JSC::ExecState *QScriptEnginePrivate::globalExec() const
+{
+ return originalGlobalObject()->globalExec();
+}
+
QT_END_NAMESPACE
#endif