diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-09-07 14:58:59 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-09-28 08:46:50 +0000 |
commit | 53ef0406b70e57c451e89c4bb9a6dcb4c438af86 (patch) | |
tree | d651ecd6e3db5090d5d1dfdd67a7af42523b8438 /src/qml | |
parent | 765f3afccb34b16c249c609d788374320cfbd25d (diff) |
QML: Make QV4::Heap::Pointer trivial
One more step needed to make QV4::Heap::structs trivial.
Change-Id: I6bebfaff970518d65a09f2b9f50a6855c431d4c0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4argumentsobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 32 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/memory/qv4heap_p.h | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 2 |
7 files changed, 26 insertions, 27 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index b55494823c..156c21ca66 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -46,9 +46,9 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(ArgumentsObject); Heap::ArgumentsObject::ArgumentsObject(QV4::CallContext *context) - : context(context->d()) - , fullyCreated(false) + : fullyCreated(false) { + this->context = context->d(); Q_ASSERT(vtable() == QV4::ArgumentsObject::staticVTable()); ExecutionEngine *v4 = context->d()->engine; diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index 368605ca4a..713b2b6412 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -119,14 +119,15 @@ struct ExecutionContext : Base { inline ExecutionContext::ExecutionContext(ExecutionEngine *engine, ContextType t) : engine(engine) - , outer(nullptr) , lookups(nullptr) , constantTable(nullptr) , compilationUnit(nullptr) , type(t) , strictMode(false) , lineNumber(-1) -{} +{ + outer = nullptr; +} struct CallContext : ExecutionContext { diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index b08ad24fbe..df9f92b259 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -69,18 +69,18 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(FunctionObject); Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, QV4::String *name, bool createProto) - : scope(scope->d()) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = scope->d(); Scope s(scope->engine()); ScopedFunctionObject f(s, this); f->init(name, createProto); } Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, Function *function, bool createProto) - : scope(scope->d()) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = scope->d(); Scope s(scope->engine()); ScopedString name(s, function->name()); ScopedFunctionObject f(s, this); @@ -88,9 +88,9 @@ Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, Function *fun } Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const QString &name, bool createProto) - : scope(scope->d()) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = scope->d(); Scope s(scope->engine()); ScopedFunctionObject f(s, this); ScopedString n(s, s.engine->newString(name)); @@ -98,9 +98,9 @@ Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const QString } Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, bool createProto) - : scope(scope) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = scope; Scope s(scope->engine); ScopedFunctionObject f(s, this); ScopedString n(s, s.engine->newString(name)); @@ -108,9 +108,9 @@ Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const QString &nam } Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const ReturnedValue name) - : scope(scope->d()) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = scope->d(); Scope s(scope); ScopedFunctionObject f(s, this); ScopedString n(s, name); @@ -118,9 +118,9 @@ Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const Returne } Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValue name) - : scope(scope) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = scope; Scope s(scope->engine); ScopedFunctionObject f(s, this); ScopedString n(s, name); @@ -128,9 +128,9 @@ Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const ReturnedValu } Heap::FunctionObject::FunctionObject() - : scope(internalClass->engine->rootContext()->d()) - , function(Q_NULLPTR) + : function(Q_NULLPTR) { + this->scope = internalClass->engine->rootContext()->d(); Q_ASSERT(internalClass && internalClass->find(internalClass->engine->id_prototype()) == Index_Prototype); *propertyData(Index_Prototype) = Encode::undefined(); } @@ -667,9 +667,9 @@ DEFINE_OBJECT_VTABLE(BoundFunction); Heap::BoundFunction::BoundFunction(QV4::ExecutionContext *scope, QV4::FunctionObject *target, const Value &boundThis, QV4::MemberData *boundArgs) : Heap::FunctionObject(scope, QStringLiteral("__bound function__")) - , target(target->d()) - , boundArgs(boundArgs ? boundArgs->d() : 0) { + this->target = target->d(); + this->boundArgs = boundArgs ? boundArgs->d() : 0; this->boundThis = boundThis; Scope s(scope); diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index ab00859b3b..203def0bcf 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -79,9 +79,9 @@ Heap::RegExpObject::RegExpObject() } Heap::RegExpObject::RegExpObject(QV4::RegExp *value, bool global) - : value(value->d()) - , global(global) + : global(global) { + this->value = value->d(); Scope scope(internalClass->engine); Scoped<QV4::RegExpObject> o(scope, this); o->initProperties(); diff --git a/src/qml/memory/qv4heap_p.h b/src/qml/memory/qv4heap_p.h index 584e8293e5..f38898b2ea 100644 --- a/src/qml/memory/qv4heap_p.h +++ b/src/qml/memory/qv4heap_p.h @@ -124,9 +124,6 @@ struct Q_QML_EXPORT Base { template <typename T> struct Pointer { - Pointer() {} - Pointer(T *t) : ptr(t) {} - T *operator->() const { return ptr; } operator T *() const { return ptr; } @@ -137,6 +134,7 @@ struct Pointer { T *ptr; }; +Q_STATIC_ASSERT(std::is_trivial<Pointer<void>>::value); } diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 337b15d35c..3cfbd7bed1 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1487,9 +1487,9 @@ QQmlComponentExtension::~QQmlComponentExtension() QV4::Heap::QmlIncubatorObject::QmlIncubatorObject(QQmlIncubator::IncubationMode m) : valuemap(QV4::Primitive::undefinedValue()) , statusChanged(QV4::Primitive::undefinedValue()) - , qmlContext(0) { parent.init(); + qmlContext = nullptr; incubator.reset(new QQmlComponentIncubator(this, m)); } diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 5d70b17ece..222b61ae49 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1304,8 +1304,8 @@ ReturnedValue QtObject::method_locale(CallContext *ctx) Heap::QQmlBindingFunction::QQmlBindingFunction(const QV4::FunctionObject *originalFunction) : QV4::Heap::FunctionObject(originalFunction->scope(), originalFunction->name()) - , originalFunction(originalFunction->d()) { + this->originalFunction = originalFunction->d(); } void QQmlBindingFunction::initBindingLocation() |