diff options
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 2 | ||||
-rw-r--r-- | src/qml/compiler/qv4compileddata_p.h | 54 | ||||
-rw-r--r-- | src/qml/compiler/qv4jsir_p.h | 62 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 14 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa_p.h | 35 | ||||
-rw-r--r-- | src/qml/jit/qv4regalloc.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 8 | ||||
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 5 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 98 |
9 files changed, 160 insertions, 124 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 400575f288..8f5ea44599 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -639,7 +639,7 @@ static QByteArray ownLibraryChecksum() if (checksumInitialized) return libraryChecksum; checksumInitialized = true; -#if defined(Q_OS_UNIX) && !defined(QT_NO_DYNAMIC_CAST) +#if defined(Q_OS_UNIX) && !defined(QT_NO_DYNAMIC_CAST) && !defined(Q_OS_INTEGRITY) Dl_info libInfo; if (dladdr(reinterpret_cast<const void *>(&ownLibraryChecksum), &libInfo) != 0) { QFile library(QFile::decodeName(libInfo.dli_fname)); diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h index 301660c66b..f5acfda631 100644 --- a/src/qml/compiler/qv4compileddata_p.h +++ b/src/qml/compiler/qv4compileddata_p.h @@ -777,31 +777,7 @@ struct TypeReferenceMap : QHash<int, TypeReference> }; #ifndef V4_BOOTSTRAP -struct ResolvedTypeReference -{ - ResolvedTypeReference() - : type(0) - , majorVersion(0) - , minorVersion(0) - , isFullyDynamicType(false) - {} - - QQmlType *type; - QQmlRefPointer<QQmlPropertyCache> typePropertyCache; - QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit; - - int majorVersion; - int minorVersion; - // Types such as QQmlPropertyMap can add properties dynamically at run-time and - // therefore cannot have a property cache installed when instantiated. - bool isFullyDynamicType; - - QQmlPropertyCache *propertyCache() const; - QQmlPropertyCache *createPropertyCache(QQmlEngine *); - bool addToHash(QCryptographicHash *hash, QQmlEngine *engine); - - void doDynamicTypeCheck(); -}; +struct ResolvedTypeReference; // map from name index // While this could be a hash, a map is chosen here to provide a stable // order, which is used to calculating a check-sum on dependent meta-objects. @@ -941,6 +917,34 @@ protected: virtual bool saveCodeToDisk(QIODevice *device, const CompiledData::Unit *unit, QString *errorString); }; +#ifndef V4_BOOTSTRAP +struct ResolvedTypeReference +{ + ResolvedTypeReference() + : type(0) + , majorVersion(0) + , minorVersion(0) + , isFullyDynamicType(false) + {} + + QQmlType *type; + QQmlRefPointer<QQmlPropertyCache> typePropertyCache; + QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit; + + int majorVersion; + int minorVersion; + // Types such as QQmlPropertyMap can add properties dynamically at run-time and + // therefore cannot have a property cache installed when instantiated. + bool isFullyDynamicType; + + QQmlPropertyCache *propertyCache() const; + QQmlPropertyCache *createPropertyCache(QQmlEngine *); + bool addToHash(QCryptographicHash *hash, QQmlEngine *engine); + + void doDynamicTypeCheck(); +}; +#endif + } } diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h index 73aa6c4975..04bc3d86e5 100644 --- a/src/qml/compiler/qv4jsir_p.h +++ b/src/qml/compiler/qv4jsir_p.h @@ -315,20 +315,20 @@ struct Q_AUTOTEST_EXPORT Expr { Expr(ExprKind exprKind): type(UnknownType), exprKind(exprKind) {} bool isLValue() const; - Const *asConst() { return as<Const>(); } - String *asString() { return as<String>(); } - RegExp *asRegExp() { return as<RegExp>(); } - Name *asName() { return as<Name>(); } - Temp *asTemp() { return as<Temp>(); } - ArgLocal *asArgLocal() { return as<ArgLocal>(); } - Closure *asClosure() { return as<Closure>(); } - Convert *asConvert() { return as<Convert>(); } - Unop *asUnop() { return as<Unop>(); } - Binop *asBinop() { return as<Binop>(); } - Call *asCall() { return as<Call>(); } - New *asNew() { return as<New>(); } - Subscript *asSubscript() { return as<Subscript>(); } - Member *asMember() { return as<Member>(); } + Const *asConst(); + String *asString(); + RegExp *asRegExp(); + Name *asName(); + Temp *asTemp(); + ArgLocal *asArgLocal(); + Closure *asClosure(); + Convert *asConvert(); + Unop *asUnop(); + Binop *asBinop(); + Call *asCall(); + New *asNew(); + Subscript *asSubscript(); + Member *asMember(); }; #define EXPR_VISIT_ALL_KINDS(e) \ @@ -773,12 +773,12 @@ struct Stmt { Stmt *asTerminator(); - Exp *asExp() { return as<Exp>(); } - Move *asMove() { return as<Move>(); } - Jump *asJump() { return as<Jump>(); } - CJump *asCJump() { return as<CJump>(); } - Ret *asRet() { return as<Ret>(); } - Phi *asPhi() { return as<Phi>(); } + Exp *asExp(); + Move *asMove(); + Jump *asJump(); + CJump *asCJump(); + Ret *asRet(); + Phi *asPhi(); int id() const { return _id; } @@ -1720,6 +1720,28 @@ inline Stmt *BasicBlock::RET(Expr *expr) return s; } +inline Const *Expr::asConst() { return as<Const>(); } +inline String *Expr::asString() { return as<String>(); } +inline RegExp *Expr::asRegExp() { return as<RegExp>(); } +inline Name *Expr::asName() { return as<Name>(); } +inline Temp *Expr::asTemp() { return as<Temp>(); } +inline ArgLocal *Expr::asArgLocal() { return as<ArgLocal>(); } +inline Closure *Expr::asClosure() { return as<Closure>(); } +inline Convert *Expr::asConvert() { return as<Convert>(); } +inline Unop *Expr::asUnop() { return as<Unop>(); } +inline Binop *Expr::asBinop() { return as<Binop>(); } +inline Call *Expr::asCall() { return as<Call>(); } +inline New *Expr::asNew() { return as<New>(); } +inline Subscript *Expr::asSubscript() { return as<Subscript>(); } +inline Member *Expr::asMember() { return as<Member>(); } + +inline Exp *Stmt::asExp() { return as<Exp>(); } +inline Move *Stmt::asMove() { return as<Move>(); } +inline Jump *Stmt::asJump() { return as<Jump>(); } +inline CJump *Stmt::asCJump() { return as<CJump>(); } +inline Ret *Stmt::asRet() { return as<Ret>(); } +inline Phi *Stmt::asPhi() { return as<Phi>(); } + } // end of namespace IR } // end of namespace QV4 diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 1d512711b8..10f0bbcf8f 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -5123,7 +5123,7 @@ void LifeTimeInterval::setFrom(int from) { Q_ASSERT(from > 0); if (_ranges.isEmpty()) { // this is the case where there is no use, only a define - _ranges.prepend(Range(from, from)); + _ranges.prepend(LifeTimeIntervalRange(from, from)); if (_end == InvalidPosition) _end = from; } else { @@ -5137,17 +5137,17 @@ void LifeTimeInterval::addRange(int from, int to) { Q_ASSERT(to >= from); if (_ranges.isEmpty()) { - _ranges.prepend(Range(from, to)); + _ranges.prepend(LifeTimeIntervalRange(from, to)); _end = to; return; } - Range *p = &_ranges.first(); + LifeTimeIntervalRange *p = &_ranges.first(); if (to + 1 >= p->start && p->end + 1 >= from) { p->start = qMin(p->start, from); p->end = qMax(p->end, to); while (_ranges.count() > 1) { - Range *p1 = p + 1; + LifeTimeIntervalRange *p1 = p + 1; if (p->end + 1 < p1->start || p1->end + 1 < p->start) break; p1->start = qMin(p->start, p1->start); @@ -5157,10 +5157,10 @@ void LifeTimeInterval::addRange(int from, int to) { } } else { if (to < p->start) { - _ranges.prepend(Range(from, to)); + _ranges.prepend(LifeTimeIntervalRange(from, to)); } else { Q_ASSERT(from > _ranges.last().end); - _ranges.push_back(Range(from, to)); + _ranges.push_back(LifeTimeIntervalRange(from, to)); } } @@ -5206,7 +5206,7 @@ LifeTimeInterval LifeTimeInterval::split(int atPosition, int newStart) } else { // find the first range where the temp will get active again: while (!newInterval._ranges.isEmpty()) { - const Range &range = newInterval._ranges.first(); + const LifeTimeIntervalRange &range = newInterval._ranges.first(); if (range.start > newStart) { // The split position is before the start of the range. Either we managed to skip // over the correct range, or we got an invalid split request. Either way, this diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h index db8b6edd1a..c07abd04c4 100644 --- a/src/qml/compiler/qv4ssa_p.h +++ b/src/qml/compiler/qv4ssa_p.h @@ -63,20 +63,28 @@ class QQmlEnginePrivate; namespace QV4 { namespace IR { -class Q_AUTOTEST_EXPORT LifeTimeInterval { -public: - struct Range { - int start; - int end; +struct LifeTimeIntervalRange { + int start; + int end; - Range(int start = InvalidPosition, int end = InvalidPosition) - : start(start) - , end(end) - {} + LifeTimeIntervalRange(int start = -1, int end = -1) + : start(start) + , end(end) + {} - bool covers(int position) const { return start <= position && position <= end; } - }; - typedef QVarLengthArray<Range, 4> Ranges; + bool covers(int position) const { return start <= position && position <= end; } +}; +} // IR namespace +} // QV4 namespace + +Q_DECLARE_TYPEINFO(QV4::IR::LifeTimeIntervalRange, Q_PRIMITIVE_TYPE); + +namespace QV4 { +namespace IR { + +class Q_AUTOTEST_EXPORT LifeTimeInterval { +public: + typedef QVarLengthArray<LifeTimeIntervalRange, 4> Ranges; private: Temp _temp; @@ -137,7 +145,7 @@ public: // Validate the new range if (_end != InvalidPosition) { Q_ASSERT(!_ranges.isEmpty()); - for (const Range &range : qAsConst(_ranges)) { + for (const LifeTimeIntervalRange &range : qAsConst(_ranges)) { Q_ASSERT(range.start >= 0); Q_ASSERT(range.end >= 0); Q_ASSERT(range.start <= range.end); @@ -457,7 +465,6 @@ protected: Q_DECLARE_TYPEINFO(QV4::IR::LifeTimeInterval, Q_MOVABLE_TYPE); -Q_DECLARE_TYPEINFO(QV4::IR::LifeTimeInterval::Range, Q_PRIMITIVE_TYPE); QT_END_NAMESPACE diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp index f2ae7e117a..d5da863ee0 100644 --- a/src/qml/jit/qv4regalloc.cpp +++ b/src/qml/jit/qv4regalloc.cpp @@ -1529,7 +1529,7 @@ static inline int indexOfRangeCoveringPosition(const LifeTimeInterval::Ranges &r return -1; } -static inline int intersectionPosition(const LifeTimeInterval::Range &one, const LifeTimeInterval::Range &two) +static inline int intersectionPosition(const LifeTimeIntervalRange &one, const LifeTimeIntervalRange &two) { if (one.covers(two.start)) return two.start; @@ -1787,9 +1787,9 @@ int RegisterAllocator::nextIntersection(const LifeTimeInterval ¤t, return -1; for (int currentEnd = currentRanges.size(); currentIt < currentEnd; ++currentIt) { - const LifeTimeInterval::Range currentRange = currentRanges.at(currentIt); + const LifeTimeIntervalRange currentRange = currentRanges.at(currentIt); for (int anotherIt = anotherItStart, anotherEnd = anotherRanges.size(); anotherIt < anotherEnd; ++anotherIt) { - const LifeTimeInterval::Range anotherRange = anotherRanges.at(anotherIt); + const LifeTimeIntervalRange anotherRange = anotherRanges.at(anotherIt); if (anotherRange.start > currentRange.end) break; int intersectPos = intersectionPosition(currentRange, anotherRange); diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index a11f7f0875..7ce8ef17a4 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -91,7 +91,9 @@ #if USE(PTHREADS) # include <pthread.h> +#if !defined(Q_OS_INTEGRITY) # include <sys/resource.h> +#endif #if HAVE(PTHREAD_NP_H) # include <pthread_np.h> #endif @@ -1109,7 +1111,7 @@ static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int if (typeHint == qMetaTypeId<QJSValue>()) return QVariant::fromValue(QJSValue(e, value.asReturnedValue())); - if (value.as<Object>()) { + if (value.as<QV4::Object>()) { QV4::ScopedObject object(scope, value); if (typeHint == QMetaType::QJsonObject && !value.as<ArrayObject>() && !value.as<FunctionObject>()) { @@ -1755,7 +1757,7 @@ bool ExecutionEngine::metaTypeFromJS(const Value *value, int type, void *data) return false; } -static bool convertToNativeQObject(QV4::ExecutionEngine *e, const Value &value, const QByteArray &targetType, void **result) +static bool convertToNativeQObject(QV4::ExecutionEngine *e, const QV4::Value &value, const QByteArray &targetType, void **result) { if (!targetType.endsWith('*')) return false; @@ -1770,7 +1772,7 @@ static bool convertToNativeQObject(QV4::ExecutionEngine *e, const Value &value, return false; } -static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const Value &value) +static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &value) { if (!value.isObject()) return 0; diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 562aa1c88a..88ce2fa1b9 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -76,7 +76,8 @@ public: int argumentsValid:1; QList<QByteArray> *names; - int arguments[0]; + + int arguments[1]; }; // Flags that do *NOT* depend on the property's QMetaProperty::userType() and thus are quick @@ -919,7 +920,7 @@ static int EnumType(const QMetaObject *metaobj, const QByteArray &str, int type) QQmlPropertyCacheMethodArguments *QQmlPropertyCache::createArgumentsObject(int argc, const QList<QByteArray> &names) { typedef QQmlPropertyCacheMethodArguments A; - A *args = static_cast<A *>(malloc(sizeof(A) + (argc + 1) * sizeof(int))); + A *args = static_cast<A *>(malloc(sizeof(A) + (argc) * sizeof(int))); args->arguments[0] = argc; args->argumentsValid = false; args->signalParameterStringForJS = 0; diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 6b9db105e7..2f5d5790ee 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -88,6 +88,7 @@ class QSGRectangleNode; class QSGImageNode; class QSGNinePatchNode; class QSGSpriteNode; +class QSGRenderContext; Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_RENDERLOOP) Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_COMPILATION) @@ -98,6 +99,54 @@ Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_RENDERER) Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_INFO) Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_RENDERLOOP) +class Q_QUICK_PRIVATE_EXPORT QSGContext : public QObject +{ + Q_OBJECT + +public: + enum AntialiasingMethod { + UndecidedAntialiasing, + VertexAntialiasing, + MsaaAntialiasing + }; + + explicit QSGContext(QObject *parent = 0); + virtual ~QSGContext(); + + virtual void renderContextInitialized(QSGRenderContext *renderContext); + virtual void renderContextInvalidated(QSGRenderContext *renderContext); + virtual QSGRenderContext *createRenderContext() = 0; + + QSGInternalRectangleNode *createInternalRectangleNode(const QRectF &rect, const QColor &c); + virtual QSGInternalRectangleNode *createInternalRectangleNode() = 0; + virtual QSGInternalImageNode *createInternalImageNode() = 0; + virtual QSGPainterNode *createPainterNode(QQuickPaintedItem *item) = 0; + virtual QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) = 0; + virtual QSGLayer *createLayer(QSGRenderContext *renderContext) = 0; + virtual QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager(); + virtual QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext, + QSGGuiThreadShaderEffectManager *mgr); +#if QT_CONFIG(quick_sprite) + virtual QSGSpriteNode *createSpriteNode() = 0; +#endif + virtual QAnimationDriver *createAnimationDriver(QObject *parent); + + virtual QSize minimumFBOSize() const; + virtual QSurfaceFormat defaultSurfaceFormat() const = 0; + + virtual QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext); + + virtual QSGRectangleNode *createRectangleNode() = 0; + virtual QSGImageNode *createImageNode() = 0; + virtual QSGNinePatchNode *createNinePatchNode() = 0; + + static QSGContext *createDefaultContext(); + static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image); + static QSGRenderLoop *createWindowManager(); + + static void setBackend(const QString &backend); +}; + class Q_QUICK_PRIVATE_EXPORT QSGRenderContext : public QObject { Q_OBJECT @@ -150,55 +199,6 @@ protected: QSet<QFontEngine *> m_fontEnginesToClean; }; - -class Q_QUICK_PRIVATE_EXPORT QSGContext : public QObject -{ - Q_OBJECT - -public: - enum AntialiasingMethod { - UndecidedAntialiasing, - VertexAntialiasing, - MsaaAntialiasing - }; - - explicit QSGContext(QObject *parent = 0); - virtual ~QSGContext(); - - virtual void renderContextInitialized(QSGRenderContext *renderContext); - virtual void renderContextInvalidated(QSGRenderContext *renderContext); - virtual QSGRenderContext *createRenderContext() = 0; - - QSGInternalRectangleNode *createInternalRectangleNode(const QRectF &rect, const QColor &c); - virtual QSGInternalRectangleNode *createInternalRectangleNode() = 0; - virtual QSGInternalImageNode *createInternalImageNode() = 0; - virtual QSGPainterNode *createPainterNode(QQuickPaintedItem *item) = 0; - virtual QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode) = 0; - virtual QSGLayer *createLayer(QSGRenderContext *renderContext) = 0; - virtual QSGGuiThreadShaderEffectManager *createGuiThreadShaderEffectManager(); - virtual QSGShaderEffectNode *createShaderEffectNode(QSGRenderContext *renderContext, - QSGGuiThreadShaderEffectManager *mgr); -#if QT_CONFIG(quick_sprite) - virtual QSGSpriteNode *createSpriteNode() = 0; -#endif - virtual QAnimationDriver *createAnimationDriver(QObject *parent); - - virtual QSize minimumFBOSize() const; - virtual QSurfaceFormat defaultSurfaceFormat() const = 0; - - virtual QSGRendererInterface *rendererInterface(QSGRenderContext *renderContext); - - virtual QSGRectangleNode *createRectangleNode() = 0; - virtual QSGImageNode *createImageNode() = 0; - virtual QSGNinePatchNode *createNinePatchNode() = 0; - - static QSGContext *createDefaultContext(); - static QQuickTextureFactory *createTextureFactoryFromImage(const QImage &image); - static QSGRenderLoop *createWindowManager(); - - static void setBackend(const QString &backend); -}; - QT_END_NAMESPACE #endif // QSGCONTEXT_H |