aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-06-11 01:01:10 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-06-11 11:28:44 +0200
commit10e3b24c02cd1c22c7df0f350f229625e13faeae (patch)
treee9f02181e47156e9c8652e0c5dba15bbdcb97e5a /src/qml/jsruntime
parent8733a8762c2db473d3a39d1f01c09156c04e3772 (diff)
parentac402fa6d99eeb519a9cc23b028358dfb6df4d82 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: src/qml/jsruntime/qv4value_p.h src/qml/qml/qqmlmetatype.cpp src/qml/qml/qqmltypewrapper.cpp src/quick/items/qquicktableview.cpp Change-Id: I684f8e01a711580512848bf1253f39b39fcbf4c7
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp9
-rw-r--r--src/qml/jsruntime/qv4lookup_p.h2
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp1
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h3
-rw-r--r--src/qml/jsruntime/qv4value_p.h17
6 files changed, 26 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 99f425293e..0cda6b864a 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -77,8 +77,13 @@ ReturnedValue Lookup::resolvePrimitiveGetter(ExecutionEngine *engine, const Valu
primitiveLookup.type = object.type();
switch (primitiveLookup.type) {
case Value::Undefined_Type:
- case Value::Null_Type:
- return engine->throwTypeError();
+ case Value::Null_Type: {
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]);
+ const QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString())
+ .arg(QLatin1String(primitiveLookup.type == Value::Undefined_Type ? "undefined" : "null"));
+ return engine->throwTypeError(message);
+ }
case Value::Boolean_Type:
primitiveLookup.proto = engine->booleanPrototype()->d();
break;
diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h
index 94bf1a98ae..7578de4d14 100644
--- a/src/qml/jsruntime/qv4lookup_p.h
+++ b/src/qml/jsruntime/qv4lookup_p.h
@@ -120,7 +120,7 @@ struct Q_QML_PRIVATE_EXPORT Lookup {
} indexedLookup;
struct {
Heap::InternalClass *ic;
- Heap::QObjectWrapper *staticQObject;
+ Heap::InternalClass *qmlTypeIc; // only used when lookup goes through QQmlTypeWrapper
QQmlPropertyCache *propertyCache;
QQmlPropertyData *propertyData;
} qobjectLookup;
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index f3351f6da0..7b885a9e9e 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -292,7 +292,6 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r
ScopedValue val(scope, base ? *base : Value::fromReturnedValue(QV4::QObjectWrapper::wrap(v4, scopeObject)));
const QObjectWrapper *That = static_cast<const QObjectWrapper *>(val->objectValue());
lookup->qobjectLookup.ic = That->internalClass();
- lookup->qobjectLookup.staticQObject = nullptr;
lookup->qobjectLookup.propertyCache = ddata->propertyCache;
lookup->qobjectLookup.propertyCache->addref();
lookup->qobjectLookup.propertyData = propertyData;
@@ -325,7 +324,6 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r
ScopedValue val(scope, base ? *base : Value::fromReturnedValue(QV4::QObjectWrapper::wrap(v4, context->contextObject)));
const QObjectWrapper *That = static_cast<const QObjectWrapper *>(val->objectValue());
lookup->qobjectLookup.ic = That->internalClass();
- lookup->qobjectLookup.staticQObject = nullptr;
lookup->qobjectLookup.propertyCache = ddata->propertyCache;
lookup->qobjectLookup.propertyCache->addref();
lookup->qobjectLookup.propertyData = propertyData;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 8b7de89d5b..8a4adfe69a 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -872,7 +872,6 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E
}
lookup->qobjectLookup.ic = This->internalClass();
- lookup->qobjectLookup.staticQObject = nullptr;
lookup->qobjectLookup.propertyCache = ddata->propertyCache;
lookup->qobjectLookup.propertyCache->addref();
lookup->qobjectLookup.propertyData = property;
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 795bf241f2..ac9cad2bdb 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -231,8 +231,7 @@ inline ReturnedValue QObjectWrapper::lookupGetterImpl(Lookup *lookup, ExecutionE
if (!o || o->internalClass != lookup->qobjectLookup.ic)
return revertLookup();
- const Heap::QObjectWrapper *This = lookup->qobjectLookup.staticQObject ? lookup->qobjectLookup.staticQObject :
- static_cast<const Heap::QObjectWrapper *>(o);
+ const Heap::QObjectWrapper *This = static_cast<const Heap::QObjectWrapper *>(o);
QObject *qobj = This->object();
if (QQmlData::wasDeleted(qobj))
return QV4::Encode::undefined();
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index a9c8ac66bd..4e901721cb 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -87,12 +87,29 @@ struct Q_QML_PRIVATE_EXPORT Value : public StaticValue
QML_NEARLY_ALWAYS_INLINE HeapBasePtr m() const
{
HeapBasePtr b;
+#ifdef __ia64
+// Restore bits 49-47 to bits 63-61, undoing the workaround explained in
+// setM below.
+ quint64 _tmp;
+
+ _tmp = _val & (7L << 47); // 0x3800000000000
+ _tmp = (_tmp << 14) | (_val ^ _tmp);
+ memcpy(&b, &_tmp, 8);
+#else
memcpy(&b, &_val, 8);
+#endif
return b;
}
QML_NEARLY_ALWAYS_INLINE void setM(HeapBasePtr b)
{
memcpy(&_val, &b, 8);
+#ifdef __ia64
+// On ia64, bits 63-61 in a 64-bit pointer are used to store the virtual region
+// number. Since this implementation is not 64-bit clean, we move bits 63-61
+// to bits 49-47 and hope for the best. This is undone in *m(), above.
+ _val |= ((_val & (7L << 61)) >> 14);
+ _val &= ((1L << 50)-1);
+#endif
}
#elif QT_POINTER_SIZE == 4
QML_NEARLY_ALWAYS_INLINE HeapBasePtr m() const