From 893a298a9c66af9aa2a87d9ba5e805967bade405 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 2 Sep 2019 18:36:24 +0200 Subject: Use quiet NaNs instead of signalling ones I see no good reason why the NaN returned when reading "nan" as a double should be a signalling one; a quiet one should be just fine. [ChangeLog][ES][] The NaN obtained by Math.pow(+/-1, +/-infinity) and (+/-1)**(+/-infinity) is now quiet rather than signalling. Change-Id: I6b5ea469c17c028328c803f54f2a6d4422a80033 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4runtime.cpp | 2 +- src/qml/jsruntime/qv4vme_moth.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 8a7cbdfb2a..aaa198c62a 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -2050,7 +2050,7 @@ ReturnedValue Runtime::Exp::call(const Value &base, const Value &exp) double b = base.toNumber(); double e = exp.toNumber(); if (qt_is_inf(e) && (b == 1 || b == -1)) - return Encode(qt_snan()); + return Encode(qt_qnan()); return Encode(pow(b,e)); } diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index b4c34d60fa..4d099d2e0f 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -1247,7 +1247,7 @@ QV4::ReturnedValue VME::interpret(CppStackFrame *frame, ExecutionEngine *engine, double base = left.toNumber(); double exp = ACC.toNumber(); if (qIsInf(exp) && (base == 1 || base == -1)) - acc = Encode(qSNaN()); + acc = Encode(qQNaN()); else acc = Encode(pow(base,exp)); MOTH_END_INSTR(Exp) -- cgit v1.2.3 From 53bece0812207e52b3368434c8174976b10e2aa8 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 30 Jul 2019 12:41:46 +0200 Subject: Implement lookups for qml type wrappers Task-number: QTBUG-77237 Change-Id: I661dc7a23946520c8ad298c39796cb8d0561d80c Reviewed-by: Ulf Hermann Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4lookup_p.h | 4 ++++ src/qml/jsruntime/qv4qmlcontext.cpp | 31 ++++++++++++++++++++++++++++--- src/qml/jsruntime/qv4qmlcontext_p.h | 1 + 3 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h index 7578de4d14..fb4c5f6864 100644 --- a/src/qml/jsruntime/qv4lookup_p.h +++ b/src/qml/jsruntime/qv4lookup_p.h @@ -151,6 +151,10 @@ struct Q_QML_PRIVATE_EXPORT Lookup { quintptr reserved3; ReturnedValue (*getterTrampoline)(Lookup *l, ExecutionEngine *engine); } qmlContextGlobalLookup; + struct { + Heap::Object *qmlTypeWrapper; + quintptr unused2; + } qmlTypeLookup; }; uint nameIndex; diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index c832bff051..e2d3b98ff6 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -248,11 +248,15 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r return lookup->qmlContextPropertyGetter(lookup, v4, base); } } - return QQmlTypeWrapper::create(v4, scopeObject, r.type); + result = QQmlTypeWrapper::create(v4, scopeObject, r.type); } else if (r.importNamespace) { - return QQmlTypeWrapper::create(v4, scopeObject, context->imports, r.importNamespace); + result = QQmlTypeWrapper::create(v4, scopeObject, context->imports, r.importNamespace); } - Q_ASSERT(!"Unreachable"); + if (lookup) { + lookup->qmlTypeLookup.qmlTypeWrapper = static_cast(result->heapObject()); + lookup->qmlContextPropertyGetter = QQmlContextWrapper::lookupType; + } + return result->asReturnedValue(); } // Fall through @@ -659,6 +663,27 @@ ReturnedValue QQmlContextWrapper::lookupInParentContextHierarchy(Lookup *l, Exec return Encode::undefined(); } +ReturnedValue QQmlContextWrapper::lookupType(Lookup *l, ExecutionEngine *engine, Value *base) +{ + Scope scope(engine); + Scoped qmlContext(scope, engine->qmlContext()); + if (!qmlContext) + return QV4::Encode::undefined(); + + QObject *scopeObject = qmlContext->qmlScope(); + if (scopeObject && QQmlData::wasDeleted(scopeObject)) + return QV4::Encode::undefined(); + + Heap::Object *heapObject = l->qmlTypeLookup.qmlTypeWrapper; + if (static_cast(heapObject)->object != scopeObject) { + l->qmlTypeLookup.qmlTypeWrapper = nullptr; + l->qmlContextPropertyGetter = QQmlContextWrapper::resolveQmlContextPropertyLookupGetter; + return QQmlContextWrapper::resolveQmlContextPropertyLookupGetter(l, engine, base); + } + + return Value::fromHeapObject(heapObject).asReturnedValue(); +} + void Heap::QmlContext::init(QV4::ExecutionContext *outerContext, QV4::QQmlContextWrapper *qml) { Heap::ExecutionContext::init(Heap::ExecutionContext::Type_QmlContext); diff --git a/src/qml/jsruntime/qv4qmlcontext_p.h b/src/qml/jsruntime/qv4qmlcontext_p.h index 4c8287ef2f..e3e7239fe5 100644 --- a/src/qml/jsruntime/qv4qmlcontext_p.h +++ b/src/qml/jsruntime/qv4qmlcontext_p.h @@ -112,6 +112,7 @@ struct Q_QML_EXPORT QQmlContextWrapper : Object static ReturnedValue lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base); static ReturnedValue lookupInGlobalObject(Lookup *l, ExecutionEngine *engine, Value *base); static ReturnedValue lookupInParentContextHierarchy(Lookup *l, ExecutionEngine *engine, Value *base); + static ReturnedValue lookupType(Lookup *l, ExecutionEngine *engine, Value *base); }; struct Q_QML_EXPORT QmlContext : public ExecutionContext -- cgit v1.2.3 From 81ac3bd856e7c6ead21fc2efc34cdf52cd9196b1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 30 Aug 2019 13:22:43 +0200 Subject: Implement lookups for enums Task-number: QTBUG-77237 Change-Id: Ibe8fe8044b96d9d4b7a1a31b432daa886edbd799 Reviewed-by: Fabian Kosmale Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4lookup_p.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h index fb4c5f6864..31c90b31f6 100644 --- a/src/qml/jsruntime/qv4lookup_p.h +++ b/src/qml/jsruntime/qv4lookup_p.h @@ -155,6 +155,15 @@ struct Q_QML_PRIVATE_EXPORT Lookup { Heap::Object *qmlTypeWrapper; quintptr unused2; } qmlTypeLookup; + struct { + Heap::InternalClass *ic; + quintptr unused; + ReturnedValue encodedEnumValue; + } qmlEnumValueLookup; + struct { + Heap::InternalClass *ic; + Heap::Object *qmlScopedEnumWrapper; + } qmlScopedEnumWrapperLookup; }; uint nameIndex; -- cgit v1.2.3