diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-09-09 15:37:57 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-10-06 11:44:08 +0000 |
commit | 3b14e2ffdd8eb4b7f7f4508768b75f2acc399370 (patch) | |
tree | 7943f293bf2d0d376d5dc620448bab1a2b58027d /src/qml/jsruntime/qv4regexpobject.cpp | |
parent | 1b90dc4482d001512f09a5785d4cbd8030879d82 (diff) |
QML: Make Heap::Object and all subclasses trivial
GCC6 might dead-store-eliminate out our secret write to Base::mmdata,
because it expects all memory content to be "undefined" before
constructor calls. Clang might take the same approach if the constructor
of Heap::Object is removed.
By making these structs trivial, it also makes them memcpy-able.
Change-Id: I055b2ad28311b997fbe059849ebda4d5894eaa9b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index b8780b8c53..4022d98c3f 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -69,8 +69,9 @@ using namespace QV4; DEFINE_OBJECT_VTABLE(RegExpObject); -Heap::RegExpObject::RegExpObject() +void Heap::RegExpObject::init() { + Object::init(); Scope scope(internalClass->engine); Scoped<QV4::RegExpObject> o(scope, this); o->d()->value = QV4::RegExp::create(scope.engine, QString(), false, false); @@ -78,9 +79,10 @@ Heap::RegExpObject::RegExpObject() o->initProperties(); } -Heap::RegExpObject::RegExpObject(QV4::RegExp *value, bool global) - : global(global) +void Heap::RegExpObject::init(QV4::RegExp *value, bool global) { + Object::init(); + this->global = global; this->value = value->d(); Scope scope(internalClass->engine); Scoped<QV4::RegExpObject> o(scope, this); @@ -90,8 +92,9 @@ Heap::RegExpObject::RegExpObject(QV4::RegExp *value, bool global) // Converts a QRegExp to a JS RegExp. // The conversion is not 100% exact since ECMA regexp and QRegExp // have different semantics/flags, but we try to do our best. -Heap::RegExpObject::RegExpObject(const QRegExp &re) +void Heap::RegExpObject::init(const QRegExp &re) { + Object::init(); global = false; // Convert the pattern to a ECMAScript pattern. @@ -217,9 +220,9 @@ uint RegExpObject::flags() const DEFINE_OBJECT_VTABLE(RegExpCtor); -Heap::RegExpCtor::RegExpCtor(QV4::ExecutionContext *scope) - : Heap::FunctionObject(scope, QStringLiteral("RegExp")) +void Heap::RegExpCtor::init(QV4::ExecutionContext *scope) { + Heap::FunctionObject::init(scope, QStringLiteral("RegExp")); clearLastMatch(); } |