aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/layouts/plugin.cpp11
-rw-r--r--src/imports/layouts/qquicklayout.cpp14
-rw-r--r--src/imports/layouts/qquicklinearlayout.cpp8
-rw-r--r--src/particles/qquickv4particledata.cpp5
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp7
-rw-r--r--src/qml/compiler/qv4compiler.cpp6
-rw-r--r--src/qml/compiler/qv4jsir_p.h30
-rw-r--r--src/qml/compiler/qv4ssa.cpp13
-rw-r--r--src/qml/jsruntime/jsruntime.pri1
-rw-r--r--src/qml/jsruntime/qv4context.cpp19
-rw-r--r--src/qml/jsruntime/qv4context_p_p.h83
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp3
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp48
-rw-r--r--src/qml/jsruntime/qv4dateobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp64
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp6
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp2
-rw-r--r--src/qml/parser/qqmljsengine_p.cpp6
-rw-r--r--src/qml/qml/qqmlbinding.cpp10
-rw-r--r--src/qml/qml/qqmldata_p.h11
-rw-r--r--src/qml/qml/qqmlengine.cpp21
-rw-r--r--src/qml/qml/qqmlengine_p.h10
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp10
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h7
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp21
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h20
-rw-r--r--src/quick/designer/qqmldesignermetaobject.cpp8
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp8
-rw-r--r--src/quick/items/qquickitem.cpp42
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h27
-rw-r--r--src/quick/util/qquickpath.cpp8
-rw-r--r--src/quick/util/qquicktimeline.cpp8
33 files changed, 326 insertions, 217 deletions
diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp
index 4552b7219b..248b12ac31 100644
--- a/src/imports/layouts/plugin.cpp
+++ b/src/imports/layouts/plugin.cpp
@@ -42,6 +42,13 @@
#include "qquicklinearlayout_p.h"
#include "qquickstacklayout_p.h"
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Layouts);
+#endif
+}
+
QT_BEGIN_NAMESPACE
//![class decl]
@@ -50,6 +57,10 @@ class QtQuickLayoutsPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtQuickLayoutsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent)
+ {
+ initResources();
+ }
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Layouts"));
diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp
index d4d4e1703d..abc8f97cec 100644
--- a/src/imports/layouts/qquicklayout.cpp
+++ b/src/imports/layouts/qquicklayout.cpp
@@ -40,7 +40,7 @@
#include "qquicklayout_p.h"
#include <QEvent>
#include <QtCore/qcoreapplication.h>
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtCore/qmath.h>
#include <limits>
@@ -134,7 +134,7 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent)
*/
void QQuickLayoutAttached::setMinimumWidth(qreal width)
{
- if (qIsNaN(width))
+ if (qt_is_nan(width))
return;
m_isMinimumWidthSet = width >= 0;
if (m_minimumWidth == width)
@@ -162,7 +162,7 @@ void QQuickLayoutAttached::setMinimumWidth(qreal width)
*/
void QQuickLayoutAttached::setMinimumHeight(qreal height)
{
- if (qIsNaN(height))
+ if (qt_is_nan(height))
return;
m_isMinimumHeightSet = height >= 0;
if (m_minimumHeight == height)
@@ -186,7 +186,7 @@ void QQuickLayoutAttached::setMinimumHeight(qreal height)
*/
void QQuickLayoutAttached::setPreferredWidth(qreal width)
{
- if (qIsNaN(width) || m_preferredWidth == width)
+ if (qt_is_nan(width) || m_preferredWidth == width)
return;
m_preferredWidth = width;
@@ -207,7 +207,7 @@ void QQuickLayoutAttached::setPreferredWidth(qreal width)
*/
void QQuickLayoutAttached::setPreferredHeight(qreal height)
{
- if (qIsNaN(height) || m_preferredHeight == height)
+ if (qt_is_nan(height) || m_preferredHeight == height)
return;
m_preferredHeight = height;
@@ -232,7 +232,7 @@ void QQuickLayoutAttached::setPreferredHeight(qreal height)
*/
void QQuickLayoutAttached::setMaximumWidth(qreal width)
{
- if (qIsNaN(width))
+ if (qt_is_nan(width))
return;
m_isMaximumWidthSet = width >= 0;
if (m_maximumWidth == width)
@@ -259,7 +259,7 @@ void QQuickLayoutAttached::setMaximumWidth(qreal width)
*/
void QQuickLayoutAttached::setMaximumHeight(qreal height)
{
- if (qIsNaN(height))
+ if (qt_is_nan(height))
return;
m_isMaximumHeightSet = height >= 0;
if (m_maximumHeight == height)
diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp
index 2f8af4c58b..0b4a1968d7 100644
--- a/src/imports/layouts/qquicklinearlayout.cpp
+++ b/src/imports/layouts/qquicklinearlayout.cpp
@@ -40,7 +40,7 @@
#include "qquicklinearlayout_p.h"
#include "qquickgridlayoutengine_p.h"
#include "qquicklayoutstyleinfo_p.h"
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include "qdebug.h"
#include <limits>
@@ -566,7 +566,7 @@ qreal QQuickGridLayout::columnSpacing() const
void QQuickGridLayout::setColumnSpacing(qreal spacing)
{
Q_D(QQuickGridLayout);
- if (qIsNaN(spacing) || columnSpacing() == spacing)
+ if (qt_is_nan(spacing) || columnSpacing() == spacing)
return;
d->engine.setSpacing(spacing, Qt::Horizontal);
@@ -588,7 +588,7 @@ qreal QQuickGridLayout::rowSpacing() const
void QQuickGridLayout::setRowSpacing(qreal spacing)
{
Q_D(QQuickGridLayout);
- if (qIsNaN(spacing) || rowSpacing() == spacing)
+ if (qt_is_nan(spacing) || rowSpacing() == spacing)
return;
d->engine.setSpacing(spacing, Qt::Vertical);
@@ -867,7 +867,7 @@ qreal QQuickLinearLayout::spacing() const
void QQuickLinearLayout::setSpacing(qreal space)
{
Q_D(QQuickLinearLayout);
- if (qIsNaN(space) || spacing() == space)
+ if (qt_is_nan(space) || spacing() == space)
return;
d->engine.setSpacing(space, Qt::Horizontal | Qt::Vertical);
diff --git a/src/particles/qquickv4particledata.cpp b/src/particles/qquickv4particledata.cpp
index 3d7f4ce5b8..99451057ce 100644
--- a/src/particles/qquickv4particledata.cpp
+++ b/src/particles/qquickv4particledata.cpp
@@ -43,6 +43,7 @@
#include <QDebug>
#include <private/qv4engine_p.h>
#include <private/qv4functionobject_p.h>
+#include <QtCore/private/qnumeric_p.h>
QT_BEGIN_NAMESPACE
@@ -388,7 +389,7 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
if (!r || !r->d()->datum)\
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> VARIABLE = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();\
+ r->d()->datum-> VARIABLE = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();\
return QV4::Encode::undefined(); \
}
@@ -409,7 +410,7 @@ static QV4::ReturnedValue particleData_set_ ## VARIABLE (QV4::CallContext *ctx)\
if (!r || !r->d()->datum)\
ctx->engine()->throwError(QStringLiteral("Not a valid ParticleData object"));\
\
- r->d()->datum-> SETTER (ctx->argc() ? ctx->args()[0].toNumber() : qQNaN(), r->d()->particleSystem);\
+ r->d()->datum-> SETTER (ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan(), r->d()->particleSystem);\
return QV4::Encode::undefined(); \
}
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 1960f1d65b..065e91109b 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -1790,7 +1790,12 @@ void JSCodeGen::beginFunctionBodyHook()
#ifndef V4_BOOTSTRAP
QV4::IR::Temp *temp = _block->TEMP(_qmlContextTemp);
- move(temp, _block->NAME(QV4::IR::Name::builtin_qml_context, 0, 0));
+ temp->type = QV4::IR::QObjectType;
+ temp->memberResolver = _function->New<QV4::IR::MemberExpressionResolver>();
+ initMetaObjectResolver(temp->memberResolver, _scopeObject);
+ auto name = _block->NAME(QV4::IR::Name::builtin_qml_context, 0, 0);
+ name->type = temp->type;
+ move(temp, name);
move(_block->TEMP(_importedScriptsTemp), _block->NAME(QV4::IR::Name::builtin_qml_imported_scripts_object, 0, 0));
#endif
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 5de29d38fd..3943642146 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -385,15 +385,13 @@ int QV4::Compiler::JSUnitGenerator::writeFunction(char *f, int index, QV4::IR::F
*writtenDeps++ = id;
writtenDeps = (quint32 *)(f + function->dependingContextPropertiesOffset);
- for (QV4::IR::PropertyDependencyMap::ConstIterator property = irFunction->contextObjectPropertyDependencies.constBegin(), end = irFunction->contextObjectPropertyDependencies.constEnd();
- property != end; ++property) {
+ for (auto property : irFunction->contextObjectPropertyDependencies) {
*writtenDeps++ = property.key(); // property index
*writtenDeps++ = property.value(); // notify index
}
writtenDeps = (quint32 *)(f + function->dependingScopePropertiesOffset);
- for (QV4::IR::PropertyDependencyMap::ConstIterator property = irFunction->scopeObjectPropertyDependencies.constBegin(), end = irFunction->scopeObjectPropertyDependencies.constEnd();
- property != end; ++property) {
+ for (auto property : irFunction->scopeObjectPropertyDependencies) {
*writtenDeps++ = property.key(); // property index
*writtenDeps++ = property.value(); // notify index
}
diff --git a/src/qml/compiler/qv4jsir_p.h b/src/qml/compiler/qv4jsir_p.h
index eafecae494..94fa65cf71 100644
--- a/src/qml/compiler/qv4jsir_p.h
+++ b/src/qml/compiler/qv4jsir_p.h
@@ -55,6 +55,7 @@
#include <private/qqmljsastfwd_p.h>
#include <private/qflagpointer_p.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtCore/QVector>
#include <QtCore/QString>
#include <QtCore/QBitArray>
@@ -1060,7 +1061,32 @@ private:
};
// Map from meta property index (existence implies dependency) to notify signal index
-typedef QHash<int, int> PropertyDependencyMap;
+struct KeyValuePair
+{
+ quint32 _key;
+ quint32 _value;
+
+ KeyValuePair(): _key(0), _value(0) {}
+ KeyValuePair(quint32 key, quint32 value): _key(key), _value(value) {}
+
+ quint32 key() const { return _key; }
+ quint32 value() const { return _value; }
+};
+
+class PropertyDependencyMap: public QVarLengthArray<KeyValuePair, 8>
+{
+public:
+ void insert(quint32 key, quint32 value)
+ {
+ for (auto it = begin(), eit = end(); it != eit; ++it) {
+ if (it->_key == key) {
+ it->_value = value;
+ return;
+ }
+ }
+ append(KeyValuePair(key, value));
+ }
+};
// The Function owns (manages), among things, a list of basic-blocks. All the blocks have an index,
// which corresponds to the index in the entry/index in the vector in which they are stored. This
@@ -1344,7 +1370,7 @@ inline Expr *BasicBlock::CONST(Type type, double value)
} else if (type == NullType) {
value = 0;
} else if (type == UndefinedType) {
- value = qQNaN();
+ value = qt_qnan();
}
e->init(type, value);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 6a4c1c54d6..f021e1f760 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -2435,13 +2435,22 @@ protected:
virtual void visitExp(Exp *s) { _ty = run(s->expr); }
virtual void visitMove(Move *s) {
- TypingResult sourceTy = run(s->source);
if (Temp *t = s->target->asTemp()) {
+ if (Name *n = s->source->asName()) {
+ if (n->builtin == Name::builtin_qml_context) {
+ _ty = TypingResult(t->memberResolver);
+ setType(n, _ty.type);
+ setType(t, _ty.type);
+ return;
+ }
+ }
+ TypingResult sourceTy = run(s->source);
setType(t, sourceTy.type);
_ty = sourceTy;
return;
}
+ TypingResult sourceTy = run(s->source);
_ty = run(s->target);
_ty.fullyTyped &= sourceTy.fullyTyped;
}
@@ -2658,7 +2667,7 @@ void convertConst(Const *c, Type targetType)
break;
case NullType:
case UndefinedType:
- c->value = qQNaN();
+ c->value = qt_qnan();
c->type = targetType;
default:
Q_UNIMPLEMENTED();
diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri
index c61e848bd7..038b23e8d3 100644
--- a/src/qml/jsruntime/jsruntime.pri
+++ b/src/qml/jsruntime/jsruntime.pri
@@ -49,6 +49,7 @@ HEADERS += \
$$PWD/qv4global_p.h \
$$PWD/qv4engine_p.h \
$$PWD/qv4context_p.h \
+ $$PWD/qv4context_p_p.h \
$$PWD/qv4math_p.h \
$$PWD/qv4persistent_p.h \
$$PWD/qv4debugging_p.h \
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 18983eb832..97b3e26a26 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -39,7 +39,7 @@
#include <QString>
#include "qv4debugging_p.h"
-#include <qv4context_p.h>
+#include <qv4context_p_p.h>
#include <qv4object_p.h>
#include <qv4objectproto_p.h>
#include <private/qv4mm_p.h>
@@ -47,7 +47,6 @@
#include "qv4function_p.h"
#include "qv4errorobject_p.h"
#include "qv4string_p.h"
-#include "private/qqmlcontextwrapper_p.h"
using namespace QV4;
@@ -574,19 +573,3 @@ Heap::FunctionObject *ExecutionContext::getFunctionObject() const
return 0;
}
-
-
-QObject *QmlContext::qmlScope() const
-{
- return d()->qml->scopeObject;
-}
-
-QQmlContextData *QmlContext::qmlContext() const
-{
- return d()->qml->context;
-}
-
-void QmlContext::takeContextOwnership() {
- d()->qml->ownsContext = true;
-}
-
diff --git a/src/qml/jsruntime/qv4context_p_p.h b/src/qml/jsruntime/qv4context_p_p.h
new file mode 100644
index 0000000000..0da9f678ed
--- /dev/null
+++ b/src/qml/jsruntime/qv4context_p_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QV4CONTEXT_P_P_H
+#define QV4CONTEXT_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// This header defines a couple of inlinable methods.
+// These implementation cannot be put in qv4context_p.h, because they rely on the
+// QQmlContextWrapper, which in turn is a QV4::Object subclass (so it includes qv4object_p.h),
+// which includes qv4engine_p.h, that needs to include qv4context_p.h
+
+#include "qv4context_p.h"
+#include "private/qqmlcontextwrapper_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QV4 {
+
+QObject *QmlContext::qmlScope() const
+{
+ return d()->qml->scopeObject;
+}
+
+QQmlContextData *QmlContext::qmlContext() const
+{
+ return d()->qml->context;
+}
+
+void QmlContext::takeContextOwnership() {
+ d()->qml->ownsContext = true;
+}
+
+} // QV4 namespace
+
+QT_END_NAMESPACE
+
+#endif // QV4CONTEXT_P_P_H
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index b4422bcdc6..f296ffd71e 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -41,6 +41,7 @@
#include "qv4arraybuffer_p.h"
#include "qv4string_p.h"
+#include <QtCore/private/qnumeric_p.h>
#include "qendian.h"
using namespace QV4;
@@ -291,7 +292,7 @@ ReturnedValue DataViewPrototype::method_setFloat(CallContext *ctx)
return scope.engine->throwTypeError();
idx += v->d()->byteOffset;
- double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qQNaN();
+ double val = ctx->argc() >= 2 ? ctx->args()[1].toNumber() : qt_qnan();
bool littleEndian = ctx->argc() < 3 ? false : ctx->args()[2].toBoolean();
if (sizeof(T) == 4) {
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 520b6bcc37..5783e8fa2b 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -204,7 +204,7 @@ static inline double MonthFromTime(double t)
else if (d < 365.0 + l)
return 11;
- return qQNaN(); // ### assert?
+ return qt_qnan(); // ### assert?
}
static inline double DateFromTime(double t)
@@ -228,7 +228,7 @@ static inline double DateFromTime(double t)
case 11: return d - 333.0 - l;
}
- return qQNaN(); // ### assert
+ return qt_qnan(); // ### assert
}
static inline double WeekDay(double t)
@@ -260,7 +260,7 @@ static inline double DayFromMonth(double month, double leap)
case 11: return 334.0 + leap;
}
- return qQNaN(); // ### assert?
+ return qt_qnan(); // ### assert?
}
static double MakeDay(double year, double month, double day)
@@ -339,7 +339,7 @@ static inline double currentTime()
static inline double TimeClip(double t)
{
if (! qIsFinite(t) || fabs(t) > 8.64e15)
- return qQNaN();
+ return qt_qnan();
return Primitive::toInteger(t);
}
@@ -544,7 +544,7 @@ static inline double ParseString(const QString &s)
}
}
if (!dt.isValid())
- return qQNaN();
+ return qt_qnan();
return dt.toMSecsSinceEpoch();
}
@@ -636,7 +636,7 @@ DEFINE_OBJECT_VTABLE(DateObject);
Heap::DateObject::DateObject(const QDateTime &date)
{
- this->date = date.isValid() ? date.toMSecsSinceEpoch() : qQNaN();
+ this->date = date.isValid() ? date.toMSecsSinceEpoch() : qt_qnan();
}
QDateTime DateObject::toQDateTime() const
@@ -770,7 +770,7 @@ double DatePrototype::getThisDate(ExecutionContext *ctx)
ReturnedValue DatePrototype::method_parse(CallContext *ctx)
{
if (!ctx->argc())
- return Encode(qQNaN());
+ return Encode(qt_qnan());
return Encode(ParseString(ctx->args()[0].toQString()));
}
@@ -1000,7 +1000,7 @@ ReturnedValue DatePrototype::method_setTime(CallContext *ctx)
if (!self)
return ctx->engine()->throwTypeError();
- double t = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double t = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
self->setDate(TimeClip(t));
return Encode(self->date());
}
@@ -1013,7 +1013,7 @@ ReturnedValue DatePrototype::method_setMilliseconds(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date());
- double ms = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double ms = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
self->setDate(TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms)))));
return Encode(self->date());
}
@@ -1025,7 +1025,7 @@ ReturnedValue DatePrototype::method_setUTCMilliseconds(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double ms = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double ms = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
self->setDate(TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms))));
return Encode(self->date());
}
@@ -1037,7 +1037,7 @@ ReturnedValue DatePrototype::method_setSeconds(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date());
- double sec = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double sec = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms))));
self->setDate(t);
@@ -1051,7 +1051,7 @@ ReturnedValue DatePrototype::method_setUTCSeconds(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double sec = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double sec = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double ms = (ctx->argc() < 2) ? msFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), sec, ms)));
self->setDate(t);
@@ -1065,7 +1065,7 @@ ReturnedValue DatePrototype::method_setMinutes(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date());
- double min = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double min = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber();
double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(UTC(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms))));
@@ -1080,7 +1080,7 @@ ReturnedValue DatePrototype::method_setUTCMinutes(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double min = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double min = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double sec = (ctx->argc() < 2) ? SecFromTime(t) : ctx->args()[1].toNumber();
double ms = (ctx->argc() < 3) ? msFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(MakeDate(Day(t), MakeTime(HourFromTime(t), min, sec, ms)));
@@ -1095,7 +1095,7 @@ ReturnedValue DatePrototype::method_setHours(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date());
- double hour = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double hour = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber();
double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber();
double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber();
@@ -1111,7 +1111,7 @@ ReturnedValue DatePrototype::method_setUTCHours(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double hour = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double hour = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double min = (ctx->argc() < 2) ? MinFromTime(t) : ctx->args()[1].toNumber();
double sec = (ctx->argc() < 3) ? SecFromTime(t) : ctx->args()[2].toNumber();
double ms = (ctx->argc() < 4) ? msFromTime(t) : ctx->args()[3].toNumber();
@@ -1127,7 +1127,7 @@ ReturnedValue DatePrototype::method_setDate(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date());
- double date = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double date = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t))));
self->setDate(t);
return Encode(self->date());
@@ -1140,7 +1140,7 @@ ReturnedValue DatePrototype::method_setUTCDate(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double date = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double date = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
t = TimeClip(MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), date), TimeWithinDay(t)));
self->setDate(t);
return Encode(self->date());
@@ -1153,7 +1153,7 @@ ReturnedValue DatePrototype::method_setMonth(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = LocalTime(self->date());
- double month = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double month = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t))));
self->setDate(t);
@@ -1167,7 +1167,7 @@ ReturnedValue DatePrototype::method_setUTCMonth(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double month = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double month = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double date = (ctx->argc() < 2) ? DateFromTime(t) : ctx->args()[1].toNumber();
t = TimeClip(MakeDate(MakeDay(YearFromTime(t), month, date), TimeWithinDay(t)));
self->setDate(t);
@@ -1185,10 +1185,10 @@ ReturnedValue DatePrototype::method_setYear(CallContext *ctx)
t = 0;
else
t = LocalTime(t);
- double year = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double r;
if (std::isnan(year)) {
- r = qQNaN();
+ r = qt_qnan();
} else {
if ((Primitive::toInteger(year) >= 0) && (Primitive::toInteger(year) <= 99))
year += 1900;
@@ -1207,7 +1207,7 @@ ReturnedValue DatePrototype::method_setUTCFullYear(CallContext *ctx)
return ctx->engine()->throwTypeError();
double t = self->date();
- double year = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber();
double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(MakeDate(MakeDay(year, month, date), TimeWithinDay(t)));
@@ -1224,7 +1224,7 @@ ReturnedValue DatePrototype::method_setFullYear(CallContext *ctx)
double t = LocalTime(self->date());
if (std::isnan(t))
t = 0;
- double year = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double year = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
double month = (ctx->argc() < 2) ? MonthFromTime(t) : ctx->args()[1].toNumber();
double date = (ctx->argc() < 3) ? DateFromTime(t) : ctx->args()[2].toNumber();
t = TimeClip(UTC(MakeDate(MakeDay(year, month, date), TimeWithinDay(t))));
diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h
index edf5d625fd..e3615d76a7 100644
--- a/src/qml/jsruntime/qv4dateobject_p.h
+++ b/src/qml/jsruntime/qv4dateobject_p.h
@@ -52,7 +52,7 @@
#include "qv4object_p.h"
#include "qv4functionobject_p.h"
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
QT_BEGIN_NAMESPACE
@@ -65,7 +65,7 @@ namespace Heap {
struct DateObject : Object {
DateObject()
{
- date = qQNaN();
+ date = qt_qnan();
}
DateObject(const Value &date)
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 8c5e7d8be1..4a304b6138 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -42,7 +42,7 @@
#include <QtCore/qdatetime.h>
#include <QtCore/qmath.h>
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtCore/qthreadstorage.h>
#include <cmath>
@@ -100,7 +100,7 @@ static double copySign(double x, double y)
ReturnedValue MathObject::method_abs(CallContext *context)
{
if (!context->argc())
- return Encode(qQNaN());
+ return Encode(qt_qnan());
if (context->args()[0].isInteger()) {
int i = context->args()[0].integerValue();
@@ -118,7 +118,7 @@ ReturnedValue MathObject::method_acos(CallContext *context)
{
double v = context->argc() ? context->args()[0].toNumber() : 2;
if (v > 1)
- return Encode(qQNaN());
+ return Encode(qt_qnan());
return Encode(std::acos(v));
}
@@ -127,14 +127,14 @@ ReturnedValue MathObject::method_asin(CallContext *context)
{
double v = context->argc() ? context->args()[0].toNumber() : 2;
if (v > 1)
- return Encode(qQNaN());
+ return Encode(qt_qnan());
else
return Encode(std::asin(v));
}
ReturnedValue MathObject::method_atan(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
if (v == 0.0)
return Encode(v);
else
@@ -143,10 +143,10 @@ ReturnedValue MathObject::method_atan(CallContext *context)
ReturnedValue MathObject::method_atan2(CallContext *context)
{
- double v1 = context->argc() ? context->args()[0].toNumber() : qQNaN();
- double v2 = context->argc() > 1 ? context->args()[1].toNumber() : qQNaN();
+ double v1 = context->argc() ? context->args()[0].toNumber() : qt_qnan();
+ double v2 = context->argc() > 1 ? context->args()[1].toNumber() : qt_qnan();
- if ((v1 < 0) && qIsFinite(v1) && qIsInf(v2) && (copySign(1.0, v2) == 1.0))
+ if ((v1 < 0) && qt_is_finite(v1) && qt_is_inf(v2) && (copySign(1.0, v2) == 1.0))
return Encode(copySign(0, -1.0));
if ((v1 == 0.0) && (v2 == 0.0)) {
@@ -161,7 +161,7 @@ ReturnedValue MathObject::method_atan2(CallContext *context)
ReturnedValue MathObject::method_ceil(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
if (v < 0.0 && v > -1.0)
return Encode(copySign(0, -1.0));
else
@@ -170,18 +170,18 @@ ReturnedValue MathObject::method_ceil(CallContext *context)
ReturnedValue MathObject::method_cos(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
return Encode(std::cos(v));
}
ReturnedValue MathObject::method_exp(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
- if (qIsInf(v)) {
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
+ if (qt_is_inf(v)) {
if (copySign(1.0, v) == -1.0)
return Encode(0);
else
- return Encode(qInf());
+ return Encode(qt_inf());
} else {
return Encode(std::exp(v));
}
@@ -189,22 +189,22 @@ ReturnedValue MathObject::method_exp(CallContext *context)
ReturnedValue MathObject::method_floor(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
return Encode(std::floor(v));
}
ReturnedValue MathObject::method_log(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
if (v < 0)
- return Encode(qQNaN());
+ return Encode(qt_qnan());
else
return Encode(std::log(v));
}
ReturnedValue MathObject::method_max(CallContext *context)
{
- double mx = -qInf();
+ double mx = -qt_inf();
for (int i = 0; i < context->argc(); ++i) {
double x = context->args()[i].toNumber();
if (x > mx || std::isnan(x))
@@ -215,7 +215,7 @@ ReturnedValue MathObject::method_max(CallContext *context)
ReturnedValue MathObject::method_min(CallContext *context)
{
- double mx = qInf();
+ double mx = qt_inf();
for (int i = 0; i < context->argc(); ++i) {
double x = context->args()[i].toNumber();
if ((x == 0 && mx == x && copySign(1.0, x) == -1.0)
@@ -228,24 +228,24 @@ ReturnedValue MathObject::method_min(CallContext *context)
ReturnedValue MathObject::method_pow(CallContext *context)
{
- double x = context->argc() > 0 ? context->args()[0].toNumber() : qQNaN();
- double y = context->argc() > 1 ? context->args()[1].toNumber() : qQNaN();
+ double x = context->argc() > 0 ? context->args()[0].toNumber() : qt_qnan();
+ double y = context->argc() > 1 ? context->args()[1].toNumber() : qt_qnan();
if (std::isnan(y))
- return Encode(qQNaN());
+ return Encode(qt_qnan());
if (y == 0) {
return Encode(1);
} else if (((x == 1) || (x == -1)) && std::isinf(y)) {
- return Encode(qQNaN());
+ return Encode(qt_qnan());
} else if (((x == 0) && copySign(1.0, x) == 1.0) && (y < 0)) {
return Encode(qInf());
} else if ((x == 0) && copySign(1.0, x) == -1.0) {
if (y < 0) {
if (std::fmod(-y, 2.0) == 1.0)
- return Encode(-qInf());
+ return Encode(-qt_inf());
else
- return Encode(qInf());
+ return Encode(qt_inf());
} else if (y > 0) {
if (std::fmod(y, 2.0) == 1.0)
return Encode(copySign(0, -1.0));
@@ -255,12 +255,12 @@ ReturnedValue MathObject::method_pow(CallContext *context)
}
#ifdef Q_OS_AIX
- else if (qIsInf(x) && copySign(1.0, x) == -1.0) {
+ else if (qt_is_inf(x) && copySign(1.0, x) == -1.0) {
if (y > 0) {
if (std::fmod(y, 2.0) == 1.0)
- return Encode(-qInf());
+ return Encode(-qt_inf());
else
- return Encode(qInf());
+ return Encode(qt_inf());
} else if (y < 0) {
if (std::fmod(-y, 2.0) == 1.0)
return Encode(copySign(0, -1.0));
@@ -273,7 +273,7 @@ ReturnedValue MathObject::method_pow(CallContext *context)
return Encode(std::pow(x, y));
}
// ###
- return Encode(qQNaN());
+ return Encode(qt_qnan());
}
Q_GLOBAL_STATIC(QThreadStorage<bool *>, seedCreatedStorage);
@@ -294,26 +294,26 @@ ReturnedValue MathObject::method_random(CallContext *context)
ReturnedValue MathObject::method_round(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
v = copySign(std::floor(v + 0.5), v);
return Encode(v);
}
ReturnedValue MathObject::method_sin(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
return Encode(std::sin(v));
}
ReturnedValue MathObject::method_sqrt(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
return Encode(std::sqrt(v));
}
ReturnedValue MathObject::method_tan(CallContext *context)
{
- double v = context->argc() ? context->args()[0].toNumber() : qQNaN();
+ double v = context->argc() ? context->args()[0].toNumber() : qt_qnan();
if (v == 0.0)
return Encode(v);
else
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index 5cf7dbebd8..ab3e03b183 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -95,7 +95,7 @@ void NumberPrototype::init(ExecutionEngine *engine, Object *ctor)
ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));
ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(1));
- ctor->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(qQNaN()));
+ ctor->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(qt_qnan()));
ctor->defineReadonlyProperty(QStringLiteral("NEGATIVE_INFINITY"), Primitive::fromDouble(-qInf()));
ctor->defineReadonlyProperty(QStringLiteral("POSITIVE_INFINITY"), Primitive::fromDouble(qInf()));
ctor->defineReadonlyProperty(QStringLiteral("MAX_VALUE"), Primitive::fromDouble(1.7976931348623158e+308));
@@ -149,7 +149,7 @@ ReturnedValue NumberPrototype::method_toString(CallContext *ctx)
if (std::isnan(num)) {
return scope.engine->newString(QStringLiteral("NaN"))->asReturnedValue();
- } else if (qIsInf(num)) {
+ } else if (qt_is_inf(num)) {
return scope.engine->newString(QLatin1String(num < 0 ? "-Infinity" : "Infinity"))->asReturnedValue();
}
@@ -223,7 +223,7 @@ ReturnedValue NumberPrototype::method_toFixed(CallContext *ctx)
QString str;
if (std::isnan(v))
str = QStringLiteral("NaN");
- else if (qIsInf(v))
+ else if (qt_is_inf(v))
str = QString::fromLatin1(v < 0 ? "-Infinity" : "Infinity");
else if (v < 1.e21)
str = NumberLocale::instance()->toString(v, 'f', int(fdigits));
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 373e7fc8de..92971e2298 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -225,7 +225,7 @@ void RuntimeHelpers::numberToString(QString *result, double num, int radix)
if (std::isnan(num)) {
*result = QStringLiteral("NaN");
return;
- } else if (qIsInf(num)) {
+ } else if (qt_is_inf(num)) {
*result = num < 0 ? QStringLiteral("-Infinity") : QStringLiteral("Infinity");
return;
}
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 5adc5beea5..b874766655 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -270,7 +270,7 @@ ReturnedValue StringPrototype::method_charCodeAt(CallContext *context)
if (pos >= 0 && pos < str.length())
return Encode(str.at(pos).unicode());
- return Encode(qQNaN());
+ return Encode(qt_qnan());
}
ReturnedValue StringPrototype::method_concat(CallContext *context)
diff --git a/src/qml/parser/qqmljsengine_p.cpp b/src/qml/parser/qqmljsengine_p.cpp
index d3b3af317c..07064a4889 100644
--- a/src/qml/parser/qqmljsengine_p.cpp
+++ b/src/qml/parser/qqmljsengine_p.cpp
@@ -40,7 +40,7 @@
#include "qqmljsengine_p.h"
#include "qqmljsglobal_p.h"
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtCore/qhash.h>
#include <QtCore/qdebug.h>
@@ -62,7 +62,7 @@ static inline int toDigit(char c)
double integerFromString(const char *buf, int size, int radix)
{
if (size == 0)
- return qQNaN();
+ return qt_qnan();
double sign = 1.0;
int i = 0;
@@ -101,7 +101,7 @@ double integerFromString(const char *buf, int size, int radix)
if (!qstrcmp(buf, "Infinity"))
result = qInf();
else
- result = qQNaN();
+ result = qt_qnan();
} else {
result = 0;
double multiplier = 1;
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index f91378b758..e8ddfecbe3 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -226,9 +226,6 @@ bool QQmlBinding::write(const QQmlPropertyData &core,
Q_ASSERT(m_target.data());
Q_ASSERT(core.coreIndex != -1);
- QQmlEngine *engine = context()->engine;
- QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
-
#define QUICK_STORE(cpptype, conversion) \
{ \
cpptype o = (conversion); \
@@ -239,7 +236,7 @@ bool QQmlBinding::write(const QQmlPropertyData &core,
} \
- if (!isUndefined && !core.isValueTypeVirtual()) {
+ if (Q_LIKELY(!isUndefined && !core.isValueTypeVirtual())) {
switch (core.propType) {
case QMetaType::Int:
if (result.isInteger())
@@ -270,6 +267,9 @@ bool QQmlBinding::write(const QQmlPropertyData &core,
}
#undef QUICK_STORE
+ QQmlEngine *engine = context()->engine;
+ QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
+
int type = core.isValueTypeVirtual() ? core.valueTypePropType : core.propType;
QQmlJavaScriptExpression::DeleteWatcher watcher(this);
@@ -497,7 +497,7 @@ QQmlPropertyData QQmlBinding::getPropertyData() const
Q_ASSERT(propertyData);
QQmlPropertyData d = *propertyData;
- if (valueTypeIndex != -1) {
+ if (Q_UNLIKELY(valueTypeIndex != -1)) {
const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(d.propType);
Q_ASSERT(valueTypeMetaObject);
QMetaProperty vtProp = valueTypeMetaObject->property(valueTypeIndex);
diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h
index 1a8cd0ce09..ad2456a68d 100644
--- a/src/qml/qml/qqmldata_p.h
+++ b/src/qml/qml/qqmldata_p.h
@@ -149,7 +149,7 @@ public:
inline QQmlNotifierEndpoint *notify(int index);
void addNotify(int index, QQmlNotifierEndpoint *);
int endpointCount(int index);
- bool signalHasEndpoint(int index);
+ bool signalHasEndpoint(int index) const;
void disconnectNotifiers();
// The context that created the C++ object
@@ -264,6 +264,15 @@ QQmlNotifierEndpoint *QQmlData::notify(int index)
}
}
+/*
+ The index MUST be in the range returned by QObjectPrivate::signalIndex()
+ This is different than the index returned by QMetaMethod::methodIndex()
+*/
+inline bool QQmlData::signalHasEndpoint(int index) const
+{
+ return notifyList && (notifyList->connectionMask & (1ULL << quint64(index % 64)));
+}
+
bool QQmlData::hasBindingBit(int coreIndex) const
{
int bit = coreIndex * 2;
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 68e06dfc31..c14b9a0966 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1605,15 +1605,6 @@ void QQmlData::addNotify(int index, QQmlNotifierEndpoint *endpoint)
}
}
-/*
- index MUST in the range returned by QObjectPrivate::signalIndex()
- This is different than the index returned by QMetaMethod::methodIndex()
-*/
-bool QQmlData::signalHasEndpoint(int index)
-{
- return notifyList && (notifyList->connectionMask & (1ULL << quint64(index % 64)));
-}
-
void QQmlData::disconnectNotifiers()
{
if (notifyList) {
@@ -1909,16 +1900,6 @@ void QQmlEnginePrivate::warning(QQmlEnginePrivate *engine, const QList<QQmlError
}
/*
- This function should be called prior to evaluation of any js expression,
- so that scarce resources are not freed prematurely (eg, if there is a
- nested javascript expression).
- */
-void QQmlEnginePrivate::referenceScarceResources()
-{
- scarceResourcesRefCount += 1;
-}
-
-/*
This function should be called after evaluation of the js expression is
complete, and so the scarce resources may be freed safely.
*/
@@ -1930,7 +1911,7 @@ void QQmlEnginePrivate::dereferenceScarceResources()
// if the refcount is zero, then evaluation of the "top level"
// expression must have completed. We can safely release the
// scarce resources.
- if (scarceResourcesRefCount == 0) {
+ if (Q_UNLIKELY(scarceResourcesRefCount == 0)) {
// iterate through the list and release them all.
// note that the actual SRD is owned by the JS engine,
// so we cannot delete the SRD; but we can free the
diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h
index 795a505742..92eadb0540 100644
--- a/src/qml/qml/qqmlengine_p.h
+++ b/src/qml/qml/qqmlengine_p.h
@@ -269,6 +269,16 @@ private:
void doDeleteInEngineThread();
};
+/*
+ This function should be called prior to evaluation of any js expression,
+ so that scarce resources are not freed prematurely (eg, if there is a
+ nested javascript expression).
+ */
+inline void QQmlEnginePrivate::referenceScarceResources()
+{
+ scarceResourcesRefCount += 1;
+}
+
/*!
Returns true if the calling thread is the QQmlEngine thread.
*/
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 15d0a571a5..069dadd1c9 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -40,7 +40,7 @@
#include "qqmljavascriptexpression_p.h"
#include <private/qqmlexpression_p.h>
-#include <private/qqmlcontextwrapper_p.h>
+#include <private/qv4context_p.h>
#include <private/qv4value_p.h>
#include <private/qv4functionobject_p.h>
#include <private/qv4script_p.h>
@@ -336,14 +336,6 @@ void QQmlPropertyCapture::registerQmlDependencies(QV4::ExecutionEngine *engine,
}
-
-void QQmlJavaScriptExpression::clearError()
-{
- if (m_error)
- delete m_error;
- m_error = 0;
-}
-
QQmlError QQmlJavaScriptExpression::error(QQmlEngine *engine) const
{
Q_UNUSED(engine);
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index e8ca498ff4..64cb1bb242 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -243,6 +243,13 @@ bool QQmlJavaScriptExpression::hasDelayedError() const
return m_error;
}
+inline void QQmlJavaScriptExpression::clearError()
+{
+ if (m_error)
+ delete m_error;
+ m_error = 0;
+}
+
QQmlJavaScriptExpressionGuard::QQmlJavaScriptExpressionGuard(QQmlJavaScriptExpression *e)
: QQmlNotifierEndpoint(QQmlNotifierEndpoint::QQmlJavaScriptExpressionGuard),
expression(e), next(0)
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index 3be52cf461..0522aa93ee 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -704,14 +704,6 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject,
}
}
-QQmlPropertyData *QQmlPropertyCache::ensureResolved(QQmlPropertyData *p) const
-{
- if (p && p->notFullyResolved())
- resolve(p);
-
- return p;
-}
-
void QQmlPropertyCache::resolve(QQmlPropertyData *data) const
{
Q_ASSERT(data->notFullyResolved());
@@ -840,19 +832,6 @@ int QQmlPropertyCache::methodIndexToSignalIndex(int index) const
}
QQmlPropertyData *
-QQmlPropertyCache::property(int index) const
-{
- if (index < 0 || index >= (propertyIndexCacheStart + propertyIndexCache.count()))
- return 0;
-
- if (index < propertyIndexCacheStart)
- return _parent->property(index);
-
- QQmlPropertyData *rv = const_cast<QQmlPropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
- return ensureResolved(rv);
-}
-
-QQmlPropertyData *
QQmlPropertyCache::method(int index) const
{
if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count()))
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 4ff5ee89f9..bb39a5e371 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -494,6 +494,18 @@ int QQmlPropertyRawData::encodedIndex() const
return isValueTypeVirtual()?QQmlPropertyData::encodeValueTypePropertyIndex(coreIndex, valueTypeCoreIndex):coreIndex;
}
+inline QQmlPropertyData *QQmlPropertyCache::property(int index) const
+{
+ if (index < 0 || index >= (propertyIndexCacheStart + propertyIndexCache.count()))
+ return 0;
+
+ if (index < propertyIndexCacheStart)
+ return _parent->property(index);
+
+ QQmlPropertyData *rv = const_cast<QQmlPropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
+ return ensureResolved(rv);
+}
+
QQmlPropertyData *
QQmlPropertyCache::overrideData(QQmlPropertyData *data) const
{
@@ -542,6 +554,14 @@ int QQmlPropertyCache::signalOffset() const
return signalHandlerIndexCacheStart;
}
+inline QQmlPropertyData *QQmlPropertyCache::ensureResolved(QQmlPropertyData *p) const
+{
+ if (p && p->notFullyResolved())
+ resolve(p);
+
+ return p;
+}
+
QQmlMetaObject::QQmlMetaObject()
{
}
diff --git a/src/quick/designer/qqmldesignermetaobject.cpp b/src/quick/designer/qqmldesignermetaobject.cpp
index f238740504..46808f978b 100644
--- a/src/quick/designer/qqmldesignermetaobject.cpp
+++ b/src/quick/designer/qqmldesignermetaobject.cpp
@@ -41,7 +41,7 @@
#include <QSharedPointer>
#include <QMetaProperty>
-#include <qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QDebug>
#include <private/qqmlengine_p.h>
@@ -271,19 +271,19 @@ int QQmlDesignerMetaObject::metaCall(QObject *o, QMetaObject::Call call, int id,
if (call == QMetaObject::WriteProperty
&& propertyById.userType() == QMetaType::QVariant
&& reinterpret_cast<QVariant *>(a[0])->type() == QVariant::Double
- && qIsNaN(reinterpret_cast<QVariant *>(a[0])->toDouble())) {
+ && qt_is_nan(reinterpret_cast<QVariant *>(a[0])->toDouble())) {
return -1;
}
if (call == QMetaObject::WriteProperty
&& propertyById.userType() == QMetaType::Double
- && qIsNaN(*reinterpret_cast<double*>(a[0]))) {
+ && qt_is_nan(*reinterpret_cast<double*>(a[0]))) {
return -1;
}
if (call == QMetaObject::WriteProperty
&& propertyById.userType() == QMetaType::Float
- && qIsNaN(*reinterpret_cast<float*>(a[0]))) {
+ && qt_is_nan(*reinterpret_cast<float*>(a[0]))) {
return -1;
}
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index bacdfad557..56578b5f16 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -65,7 +65,7 @@
#include <private/qv4scopedvalue_p.h>
#include <QtCore/qmath.h>
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtCore/QRunnable>
#include <QtGui/qguiapplication.h>
#include <QtGui/qopenglframebufferobject.h>
@@ -1256,7 +1256,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(QV4::CallContext *c
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject().as<QQuickJSContext2D>());
CHECK_CONTEXT_SETTER(r)
- double globalAlpha = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ double globalAlpha = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
if (!qIsFinite(globalAlpha))
return QV4::Encode::undefined();
@@ -2006,7 +2006,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(QV4::CallContext
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal offsetX = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ qreal offsetX = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
if (qIsFinite(offsetX) && offsetX != r->d()->context->state.shadowOffsetX) {
r->d()->context->state.shadowOffsetX = offsetX;
r->d()->context->buffer()->setShadowOffsetX(offsetX);
@@ -2034,7 +2034,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(QV4::CallContext
QV4::Scoped<QQuickJSContext2D> r(scope, ctx->thisObject());
CHECK_CONTEXT_SETTER(r)
- qreal offsetY = ctx->argc() ? ctx->args()[0].toNumber() : qQNaN();
+ qreal offsetY = ctx->argc() ? ctx->args()[0].toNumber() : qt_qnan();
if (qIsFinite(offsetY) && offsetY != r->d()->context->state.shadowOffsetY) {
r->d()->context->state.shadowOffsetY = offsetY;
r->d()->context->buffer()->setShadowOffsetY(offsetY);
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index da89a51f24..ea2cb5aa5f 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -56,7 +56,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qinputmethod.h>
#include <QtCore/qcoreevent.h>
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
#include <QtGui/qpa/qplatformtheme.h>
#include <QtCore/qloggingcategory.h>
@@ -6260,8 +6260,8 @@ void QQuickItem::setX(qreal v)
d->dirty(QQuickItemPrivate::Position);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(oldx, y(), width(), height()));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(oldx, d->y, d->width, d->height));
}
void QQuickItem::setY(qreal v)
@@ -6275,8 +6275,8 @@ void QQuickItem::setY(qreal v)
d->dirty(QQuickItemPrivate::Position);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), oldy, width(), height()));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, oldy, d->width, d->height));
}
/*!
@@ -6296,8 +6296,8 @@ void QQuickItem::setPosition(const QPointF &pos)
d->dirty(QQuickItemPrivate::Position);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(oldx, oldy, width(), height()));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(oldx, oldy, d->width, d->height));
}
/*!
@@ -6314,7 +6314,7 @@ qreal QQuickItem::width() const
void QQuickItem::setWidth(qreal w)
{
Q_D(QQuickItem);
- if (qIsNaN(w))
+ if (qt_is_nan(w))
return;
d->widthValid = true;
@@ -6326,8 +6326,8 @@ void QQuickItem::setWidth(qreal w)
d->dirty(QQuickItemPrivate::Size);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), y(), oldWidth, height()));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, d->y, oldWidth, d->height));
}
void QQuickItem::resetWidth()
@@ -6448,8 +6448,8 @@ void QQuickItem::setImplicitWidth(qreal w)
d->dirty(QQuickItemPrivate::Size);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), y(), oldWidth, height()));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, d->y, oldWidth, d->height));
if (changed)
d->implicitWidthChanged();
@@ -6478,7 +6478,7 @@ qreal QQuickItem::height() const
void QQuickItem::setHeight(qreal h)
{
Q_D(QQuickItem);
- if (qIsNaN(h))
+ if (qt_is_nan(h))
return;
d->heightValid = true;
@@ -6490,8 +6490,8 @@ void QQuickItem::setHeight(qreal h)
d->dirty(QQuickItemPrivate::Size);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), y(), width(), oldHeight));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, d->y, d->width, oldHeight));
}
void QQuickItem::resetHeight()
@@ -6542,8 +6542,8 @@ void QQuickItem::setImplicitHeight(qreal h)
d->dirty(QQuickItemPrivate::Size);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), y(), width(), oldHeight));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, d->y, d->width, oldHeight));
if (changed)
d->implicitHeightChanged();
@@ -6587,8 +6587,8 @@ void QQuickItem::setImplicitSize(qreal w, qreal h)
d->dirty(QQuickItemPrivate::Size);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), y(), oldWidth, oldHeight));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, d->y, oldWidth, oldHeight));
if (!wDone && wChanged)
d->implicitWidthChanged();
@@ -6624,8 +6624,8 @@ void QQuickItem::setSize(const QSizeF &size)
d->dirty(QQuickItemPrivate::Size);
- geometryChanged(QRectF(x(), y(), width(), height()),
- QRectF(x(), y(), oldWidth, oldHeight));
+ geometryChanged(QRectF(d->x, d->y, d->width, d->height),
+ QRectF(d->x, d->y, oldWidth, oldHeight));
}
/*!
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
index afc564710e..5dbbc22870 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
@@ -101,7 +101,11 @@ public:
: available(PageSize)
, allocated(PageSize)
{
- for (int i=0; i<PageSize; ++i) blocks[i] = i;
+ for (int i=0; i<PageSize; ++i)
+ blocks[i] = i;
+
+ // Zero out all new pages.
+ memset(data, 0, sizeof(data));
}
const Type *at(uint index) const
@@ -153,7 +157,7 @@ public:
void *mem = p->at(pos);
p->available--;
p->allocated.setBit(pos);
- Type *t = new (mem) Type();
+ Type *t = (Type*)mem;
return t;
}
@@ -163,8 +167,9 @@ public:
if (!page->allocated.testBit(index))
qFatal("Double delete in allocator: page=%d, index=%d", pageIndex , index);
- // Call the destructor
- page->at(index)->~Type();
+ // Zero this instance as we're done with it.
+ void *mem = page->at(index);
+ memset(mem, 0, sizeof(Type));
page->allocated[index] = false;
page->available++;
@@ -440,21 +445,9 @@ struct Batch
QDataBuffer<DrawSet> drawSets;
};
+// NOTE: Node is zero-allocated by the Allocator.
struct Node
{
- Node()
- : sgNode(0)
- , parent(0)
- , data(0)
- , firstChild(0)
- , nextSibling(0)
- , lastChild(0)
- , dirtyState(0)
- , isOpaque(false)
- , isBatchRoot(false)
- {
- }
-
QSGNode *sgNode;
Node *parent;
void *data;
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 062411e0a9..6b491a433c 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -46,7 +46,7 @@
#include <private/qbezier_p.h>
#include <QtCore/qmath.h>
-#include <QtCore/qnumeric.h>
+#include <QtCore/private/qnumeric_p.h>
QT_BEGIN_NAMESPACE
@@ -560,7 +560,7 @@ void QQuickPath::createPointCache() const
{
Q_D(const QQuickPath);
qreal pathLength = d->pathLength;
- if (pathLength <= 0 || qIsNaN(pathLength))
+ if (pathLength <= 0 || qt_is_nan(pathLength))
return;
const int segments = segmentCount(d->_path, pathLength);
@@ -633,7 +633,7 @@ QPointF QQuickPath::sequentialPointAt(const QPainterPath &path, const qreal &pat
QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle)
{
- if (pathLength <= 0 || qIsNaN(pathLength))
+ if (pathLength <= 0 || qt_is_nan(pathLength))
return path.pointAtPercent(0); //expensive?
const int lastElement = path.elementCount() - 1;
@@ -689,7 +689,7 @@ QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathL
//ideally this should be merged with forwardsPointAt
QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle)
{
- if (pathLength <= 0 || qIsNaN(pathLength))
+ if (pathLength <= 0 || qt_is_nan(pathLength))
return path.pointAtPercent(0);
const int firstElement = 1; //element 0 is always a MoveTo, which we ignore
diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp
index d8226a08f3..74baa3bfda 100644
--- a/src/quick/util/qquicktimeline.cpp
+++ b/src/quick/util/qquicktimeline.cpp
@@ -47,7 +47,7 @@
#include <QCoreApplication>
#include <QEasingCurve>
#include <QTime>
-#include <QtNumeric>
+#include <QtCore/private/qnumeric_p.h>
#include <algorithm>
@@ -387,7 +387,7 @@ void QQuickTimeLine::set(QQuickTimeLineValue &timeLineValue, qreal value)
*/
int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration)
{
- if (qFuzzyIsNull(acceleration) || qIsNaN(acceleration))
+ if (qFuzzyIsNull(acceleration) || qt_is_nan(acceleration))
return -1;
if ((velocity > 0.0f) == (acceleration > 0.0f))
@@ -414,7 +414,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr
*/
int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance)
{
- if (qFuzzyIsNull(maxDistance) || qIsNaN(maxDistance) || qFuzzyIsNull(acceleration) || qIsNaN(acceleration))
+ if (qFuzzyIsNull(maxDistance) || qt_is_nan(maxDistance) || qFuzzyIsNull(acceleration) || qt_is_nan(acceleration))
return -1;
Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f);
@@ -444,7 +444,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr
*/
int QQuickTimeLine::accelDistance(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal distance)
{
- if (qFuzzyIsNull(distance) || qIsNaN(distance) || qFuzzyIsNull(velocity) || qIsNaN(velocity))
+ if (qFuzzyIsNull(distance) || qt_is_nan(distance) || qFuzzyIsNull(velocity) || qt_is_nan(velocity))
return -1;
Q_ASSERT((distance >= 0.0f) == (velocity >= 0.0f));