diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-03-23 13:23:21 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2016-03-31 11:00:50 +0000 |
commit | 7d512482842b2570b345a32a725d0f28b4e74697 (patch) | |
tree | 605df3fe58503842096de0f5520c4432af2cbc69 | |
parent | bac1268ab00011f901602072277f1a02ebf5b35b (diff) |
V4: Allow some more functions to be inlined.
Change-Id: If9d1f87fd7cf0b12d2827c4574109234be7e8ab8
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 30 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine_p.h | 29 | ||||
-rw-r--r-- | src/qml/qml/ftw/qhashedstring_p.h | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlcontext_p.h | 1 | ||||
-rw-r--r-- | src/qml/qml/qqmlengine_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickdrag.cpp | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 2 |
8 files changed, 34 insertions, 34 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index c28df7d74a..bc64bbfe06 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -576,15 +576,6 @@ ExecutionContext *ExecutionEngine::pushGlobalContext() return currentContext; } -ExecutionContext *ExecutionEngine::parentContext(ExecutionContext *context) const -{ - Value *offset = static_cast<Value *>(context) + 1; - Q_ASSERT(offset->isInteger()); - int o = offset->integerValue(); - return o ? context - o : 0; -} - - Heap::Object *ExecutionEngine::newObject() { return memoryManager->allocObject<Object>(); @@ -770,27 +761,6 @@ Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o) return obj->d(); } -Heap::QmlContext *ExecutionEngine::qmlContext() const -{ - Heap::ExecutionContext *ctx = current; - - // get the correct context when we're within a builtin function - if (ctx->type == Heap::ExecutionContext::Type_SimpleCallContext && !ctx->outer) - ctx = parentContext(currentContext)->d(); - - if (!ctx->outer) - return 0; - - while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext) - ctx = ctx->outer; - - Q_ASSERT(ctx); - if (ctx->type != Heap::ExecutionContext::Type_QmlContext) - return 0; - - return static_cast<Heap::QmlContext *>(ctx); -} - QObject *ExecutionEngine::qmlScopeObject() const { Heap::QmlContext *ctx = qmlContext(); diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index 12ed98e6e7..7da4a1c3c1 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -500,6 +500,35 @@ inline void ExecutionEngine::popContext() current = currentContext->d(); } +inline ExecutionContext *ExecutionEngine::parentContext(ExecutionContext *context) const +{ + Value *offset = static_cast<Value *>(context) + 1; + Q_ASSERT(offset->isInteger()); + int o = offset->integerValue(); + return o ? context - o : 0; +} + +inline Heap::QmlContext *ExecutionEngine::qmlContext() const +{ + Heap::ExecutionContext *ctx = current; + + // get the correct context when we're within a builtin function + if (ctx->type == Heap::ExecutionContext::Type_SimpleCallContext && !ctx->outer) + ctx = parentContext(currentContext)->d(); + + if (!ctx->outer) + return 0; + + while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext) + ctx = ctx->outer; + + Q_ASSERT(ctx); + if (ctx->type != Heap::ExecutionContext::Type_QmlContext) + return 0; + + return static_cast<Heap::QmlContext *>(ctx); +} + inline void Heap::Base::mark(QV4::ExecutionEngine *engine) { diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 4ddac0c2c6..6ff3e4a11b 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -54,7 +54,6 @@ #include <QtCore/qglobal.h> #include <QtCore/qstring.h> #include <private/qv4string_p.h> -#include <private/qv4scopedvalue_p.h> #include <private/qflagpointer_p.h> diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h index 057f4b54c0..48d596418d 100644 --- a/src/qml/qml/qqmlcontext_p.h +++ b/src/qml/qml/qqmlcontext_p.h @@ -66,6 +66,7 @@ #include <private/qflagpointer_p.h> #include <private/qqmlguard_p.h> +#include <private/qv4compileddata_p.h> #include <private/qv4identifier_p.h> QT_BEGIN_NAMESPACE diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index 88518ac749..4014d20a9e 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -375,7 +375,7 @@ const QQmlEnginePrivate *QQmlEnginePrivate::get(const QQmlEngine *e) { Q_ASSERT(e); - return e->d_func(); + return e ? e->d_func() : nullptr; } QQmlEnginePrivate *QQmlEnginePrivate::get(QQmlContext *c) diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index aef0916239..15d0a571a5 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -298,7 +298,7 @@ void QQmlPropertyCapture::registerQmlDependencies(QV4::ExecutionEngine *engine, // Let the caller check and avoid the function call :) Q_ASSERT(compiledFunction->hasQmlDependencies()); - QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0; + QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine->qmlEngine()); if (!ep) return; QQmlPropertyCapture *capture = ep->propertyCapture; diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 5bfbaf74b2..4aa54b71df 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -46,6 +46,7 @@ #include <QtQuick/private/qquickevents_p_p.h> #include <private/qquickitemchangelistener_p.h> #include <private/qv8engine_p.h> +#include <private/qv4scopedvalue_p.h> #include <QtCore/qmimedata.h> #include <QtQml/qqmlinfo.h> #include <QtGui/qdrag.h> diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 2b1141bea8..6551af4396 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -43,7 +43,7 @@ #include "qquicktextutil_p.h" #include <private/qqmlglobal_p.h> - +#include <private/qv4scopedvalue_p.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qmimedata.h> |