aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-04-03 13:00:49 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-22 13:48:53 +0200
commit4427576fe548b6f9f8acba6a5ac3082fbbb99724 (patch)
tree309f80779da95f337dd869e1990ffd4f0bb9b724 /src/qml
parent08a3c0edeb3cdfa15a9fecdfb4c7c1ab82227437 (diff)
Avoid calling destroy() on most objects
The method is now optional, and we can simply avoid calling it if all members an object has are themselves garbage collected. Change-Id: If560fce051908bcc10409ead1a7d8a5bd5fa71d2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp11
-rw-r--r--src/qml/jsruntime/qv4argumentsobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp6
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h1
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4booleanobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4context.cpp2
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp14
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp12
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4managed.cpp2
-rw-r--r--src/qml/jsruntime/qv4managed_p.h38
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4memberdata.cpp18
-rw-r--r--src/qml/jsruntime/qv4numberobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4object.cpp14
-rw-r--r--src/qml/jsruntime/qv4object_p.h2
-rw-r--r--src/qml/jsruntime/qv4objectiterator.cpp2
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp2
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp9
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4script.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp4
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp4
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions.cpp2
-rw-r--r--src/qml/qml/v8/qqmlbuiltinfunctions_p.h3
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp4
31 files changed, 85 insertions, 95 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 987b228209..9b465a06e5 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -44,7 +44,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(ArgumentsObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ArgumentsObject);
ArgumentsObject::ArgumentsObject(CallContext *context)
: Object(context->strictMode ? context->engine->strictArgumentsObjectClass : context->engine->argumentsObjectClass)
@@ -79,11 +79,6 @@ ArgumentsObject::ArgumentsObject(CallContext *context)
Q_ASSERT(internalClass->vtable == staticVTable());
}
-void ArgumentsObject::destroy(Managed *that)
-{
- static_cast<ArgumentsObject *>(that)->~ArgumentsObject();
-}
-
void ArgumentsObject::fullyCreate()
{
if (fullyCreated)
@@ -202,7 +197,7 @@ PropertyAttributes ArgumentsObject::queryIndexed(const Managed *m, uint index)
return Attr_Accessor;
}
-DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ArgumentsGetterFunction);
ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
{
@@ -217,7 +212,7 @@ ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
return o->context->argument(g->index);
}
-DEFINE_OBJECT_VTABLE(ArgumentsSetterFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ArgumentsSetterFunction);
ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
{
diff --git a/src/qml/jsruntime/qv4argumentsobject_p.h b/src/qml/jsruntime/qv4argumentsobject_p.h
index 80c2a70501..c693669b40 100644
--- a/src/qml/jsruntime/qv4argumentsobject_p.h
+++ b/src/qml/jsruntime/qv4argumentsobject_p.h
@@ -82,7 +82,6 @@ struct ArgumentsObject: Object {
bool fullyCreated;
Members mappedArguments;
ArgumentsObject(CallContext *context);
- ~ArgumentsObject() {}
static bool isNonStrictArgumentsObject(Managed *m) {
return m->internalClass->vtable->type == Type_ArgumentsObject &&
@@ -100,7 +99,6 @@ struct ArgumentsObject: Object {
static bool deleteIndexedProperty(Managed *m, uint index);
static PropertyAttributes queryIndexed(const Managed *m, uint index);
static void markObjects(Managed *that, ExecutionEngine *e);
- static void destroy(Managed *);
void fullyCreate();
};
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index ed2122fb89..0bc97cd571 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -47,7 +47,7 @@ using namespace QV4;
const ArrayVTable SimpleArrayData::static_vtbl =
{
- DEFINE_MANAGED_VTABLE_INT(SimpleArrayData),
+ DEFINE_MANAGED_VTABLE_NO_DESTROY_INT(SimpleArrayData),
SimpleArrayData::Simple,
SimpleArrayData::reallocate,
SimpleArrayData::get,
@@ -207,10 +207,6 @@ void ArrayData::ensureAttributes(Object *o)
}
-void SimpleArrayData::destroy(Managed *)
-{
-}
-
void SimpleArrayData::markObjects(Managed *d, ExecutionEngine *e)
{
SimpleArrayData *dd = static_cast<SimpleArrayData *>(d);
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index 50b7b8a947..dec1573da7 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -149,7 +149,6 @@ struct Q_QML_EXPORT SimpleArrayData : public ArrayData
static void getHeadRoom(Object *o);
static ArrayData *reallocate(Object *o, uint n, bool enforceAttributes);
- static void destroy(Managed *d);
static void markObjects(Managed *d, ExecutionEngine *e);
static ReturnedValue get(const ArrayData *d, uint index);
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index d5b3b8a651..95677f2272 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -46,7 +46,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(ArrayCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ArrayCtor);
ArrayCtor::ArrayCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Array"))
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp
index 662ec64efb..51931da825 100644
--- a/src/qml/jsruntime/qv4booleanobject.cpp
+++ b/src/qml/jsruntime/qv4booleanobject.cpp
@@ -43,8 +43,8 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(BooleanCtor);
-DEFINE_OBJECT_VTABLE(BooleanObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(BooleanCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(BooleanObject);
BooleanCtor::BooleanCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Boolean"))
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index b43b4893a3..899723b35c 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -51,7 +51,7 @@
using namespace QV4;
-DEFINE_MANAGED_VTABLE(ExecutionContext);
+DEFINE_MANAGED_VTABLE_NO_DESTROY(ExecutionContext);
CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index ceef88455b..aaa67e935f 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -641,7 +641,7 @@ static double getLocalTZA()
#endif
}
-DEFINE_OBJECT_VTABLE(DateObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(DateObject);
DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date)
: Object(engine->dateClass)
@@ -655,7 +655,7 @@ QDateTime DateObject::toQDateTime() const
return ToDateTime(value.asDouble(), Qt::LocalTime);
}
-DEFINE_OBJECT_VTABLE(DateCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(DateCtor);
DateCtor::DateCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Date"))
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index 9d6403e7dd..086ca8eeea 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -249,13 +249,13 @@ URIErrorObject::URIErrorObject(ExecutionEngine *engine, const ValueRef message)
{
}
-DEFINE_OBJECT_VTABLE(ErrorCtor);
-DEFINE_OBJECT_VTABLE(EvalErrorCtor);
-DEFINE_OBJECT_VTABLE(RangeErrorCtor);
-DEFINE_OBJECT_VTABLE(ReferenceErrorCtor);
-DEFINE_OBJECT_VTABLE(SyntaxErrorCtor);
-DEFINE_OBJECT_VTABLE(TypeErrorCtor);
-DEFINE_OBJECT_VTABLE(URIErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(EvalErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(RangeErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ReferenceErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(SyntaxErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(TypeErrorCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(URIErrorCtor);
ErrorCtor::ErrorCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Error"))
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index b5300f8799..1c6de05ff1 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -72,7 +72,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(FunctionObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(FunctionObject);
FunctionObject::FunctionObject(ExecutionContext *scope, const StringRef name, bool createProto)
: Object(scope->engine->functionClass)
@@ -183,7 +183,7 @@ FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Fu
return new (scope->engine->memoryManager) SimpleScriptFunction(scope, function, createProto);
}
-DEFINE_OBJECT_VTABLE(FunctionCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(FunctionCtor);
FunctionCtor::FunctionCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Function"))
@@ -348,7 +348,7 @@ ReturnedValue FunctionPrototype::method_bind(CallContext *ctx)
return ctx->engine->newBoundFunction(ctx->engine->rootContext, target, boundThis, boundArgs)->asReturnedValue();
}
-DEFINE_OBJECT_VTABLE(ScriptFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ScriptFunction);
ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
: SimpleScriptFunction(scope, function, true)
@@ -421,7 +421,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
return result.asReturnedValue();
}
-DEFINE_OBJECT_VTABLE(SimpleScriptFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(SimpleScriptFunction);
SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function, bool createProto)
: FunctionObject(scope, function->name(), createProto)
@@ -545,7 +545,7 @@ InternalClass *SimpleScriptFunction::internalClassForConstructor()
-DEFINE_OBJECT_VTABLE(BuiltinFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(BuiltinFunction);
BuiltinFunction::BuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(CallContext *))
: FunctionObject(scope, name)
@@ -597,7 +597,7 @@ ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
return f->code(&ctx, f->index);
}
-DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(IndexedBuiltinFunction);
DEFINE_OBJECT_VTABLE(BoundFunction);
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 5b832d0595..76a69d7d2a 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -143,8 +143,6 @@ protected:
FunctionObject(InternalClass *ic);
static void markObjects(Managed *that, ExecutionEngine *e);
- static void destroy(Managed *that)
- { static_cast<FunctionObject*>(that)->~FunctionObject(); }
};
template<>
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index eb0994c1e6..feac21a546 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -344,7 +344,7 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok)
return QString();
}
-DEFINE_OBJECT_VTABLE(EvalFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(EvalFunction);
EvalFunction::EvalFunction(ExecutionContext *scope)
: FunctionObject(scope, scope->engine->id_eval)
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index ca82af1b30..556b2ea59f 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -66,7 +66,7 @@ static int indent = 0;
#endif
-DEFINE_OBJECT_VTABLE(JsonObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(JsonObject);
class JsonParser
{
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index 1f4030a4ed..3cfbb3715c 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -56,7 +56,7 @@ const ManagedVTable Managed::static_vtbl =
0,
Managed::MyType,
"Managed",
- destroy,
+ 0,
0 /*markObjects*/,
isEqualTo
};
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h
index 06d3e4884b..1718149bc7 100644
--- a/src/qml/jsruntime/qv4managed_p.h
+++ b/src/qml/jsruntime/qv4managed_p.h
@@ -141,9 +141,26 @@ struct ObjectVTable
isEqualTo \
}
+#define DEFINE_MANAGED_VTABLE_NO_DESTROY_INT(classname) \
+{ \
+ classname::IsExecutionContext, \
+ classname::IsString, \
+ classname::IsObject, \
+ classname::IsFunctionObject, \
+ classname::IsErrorObject, \
+ classname::IsArrayData, \
+ 0, \
+ classname::MyType, \
+ #classname, \
+ 0, \
+ markObjects, \
+ isEqualTo \
+}
#define DEFINE_MANAGED_VTABLE(classname) \
const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(classname)
+#define DEFINE_MANAGED_VTABLE_NO_DESTROY(classname) \
+const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_NO_DESTROY_INT(classname)
#define DEFINE_OBJECT_VTABLE(classname) \
@@ -166,6 +183,26 @@ const QV4::ObjectVTable classname::static_vtbl = \
advanceIterator \
}
+#define DEFINE_OBJECT_VTABLE_NO_DESTROY(classname) \
+const QV4::ObjectVTable classname::static_vtbl = \
+{ \
+ DEFINE_MANAGED_VTABLE_NO_DESTROY_INT(classname), \
+ call, \
+ construct, \
+ get, \
+ getIndexed, \
+ put, \
+ putIndexed, \
+ query, \
+ queryIndexed, \
+ deleteProperty, \
+ deleteIndexedProperty, \
+ getLookup, \
+ setLookup, \
+ getLength, \
+ advanceIterator \
+}
+
#define DEFINE_MANAGED_VTABLE_WITH_NAME(classname, name) \
const QV4::ObjectVTable classname::static_vtbl = \
{ \
@@ -299,7 +336,6 @@ public:
bool isEqualTo(Managed *other)
{ return internalClass->vtable->isEqualTo(this, other); }
- static void destroy(Managed *that) { that->_data = 0; }
static bool isEqualTo(Managed *m, Managed *other);
ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); }
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 16d76e6914..66fb06d6f0 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -51,7 +51,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(MathObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(MathObject);
static const double qt_PI = 2.0 * ::asin(1.0);
diff --git a/src/qml/jsruntime/qv4memberdata.cpp b/src/qml/jsruntime/qv4memberdata.cpp
index aeb4c38a8e..7c3b2b9b87 100644
--- a/src/qml/jsruntime/qv4memberdata.cpp
+++ b/src/qml/jsruntime/qv4memberdata.cpp
@@ -44,23 +44,7 @@
using namespace QV4;
-const ManagedVTable MemberData::static_vtbl =
-{
- MemberData::IsExecutionContext,
- MemberData::IsString,
- MemberData::IsObject,
- MemberData::IsFunctionObject,
- MemberData::IsErrorObject,
- MemberData::IsArrayData,
- 0,
- MemberData::MyType,
- "MemberData",
- destroy,
- markObjects,
- isEqualTo
-};
-
-
+DEFINE_MANAGED_VTABLE_NO_DESTROY(MemberData);
void MemberData::markObjects(Managed *that, ExecutionEngine *e)
{
diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp
index c97e86f2cd..16f81bc83b 100644
--- a/src/qml/jsruntime/qv4numberobject.cpp
+++ b/src/qml/jsruntime/qv4numberobject.cpp
@@ -48,8 +48,8 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(NumberCtor);
-DEFINE_OBJECT_VTABLE(NumberObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(NumberCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(NumberObject);
NumberCtor::NumberCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Number"))
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index c8d360d511..c67ca6a902 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -68,7 +68,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(Object);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(Object);
Object::Object(ExecutionEngine *engine)
: Managed(engine->objectClass)
@@ -88,11 +88,6 @@ Object::Object(InternalClass *ic)
}
}
-Object::~Object()
-{
- _data = 0;
-}
-
bool Object::setPrototype(Object *proto)
{
Object *pp = proto;
@@ -105,11 +100,6 @@ bool Object::setPrototype(Object *proto)
return true;
}
-void Object::destroy(Managed *that)
-{
- static_cast<Object *>(that)->~Object();
-}
-
void Object::put(ExecutionContext *ctx, const QString &name, const ValueRef value)
{
Scope scope(ctx);
@@ -1162,7 +1152,7 @@ void Object::initSparseArray()
}
-DEFINE_OBJECT_VTABLE(ArrayObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ArrayObject);
ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
: Object(engine->arrayClass)
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 5e32bb6c34..666b6c91f9 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -116,7 +116,6 @@ struct Q_QML_EXPORT Object: Managed {
Object(ExecutionEngine *engine);
Object(InternalClass *internalClass);
- ~Object();
const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(internalClass->vtable); }
Object *prototype() const { return internalClass->prototype; }
@@ -270,7 +269,6 @@ public:
inline ReturnedValue call(CallData *d)
{ return vtable()->call(this, d); }
protected:
- static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e);
static ReturnedValue construct(Managed *m, CallData *);
static ReturnedValue call(Managed *m, CallData *);
diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp
index e5f693c323..f9ad00e308 100644
--- a/src/qml/jsruntime/qv4objectiterator.cpp
+++ b/src/qml/jsruntime/qv4objectiterator.cpp
@@ -192,7 +192,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString()
}
-DEFINE_OBJECT_VTABLE(ForEachIteratorObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ForEachIteratorObject);
void ForEachIteratorObject::markObjects(Managed *that, ExecutionEngine *e)
{
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 5c824bdfbd..4d54a99240 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -72,7 +72,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(ObjectCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ObjectCtor);
ObjectCtor::ObjectCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Object"))
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 956d1c594e..a173dbcf2a 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -69,7 +69,7 @@ Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyn
using namespace QV4;
-DEFINE_OBJECT_VTABLE(RegExpObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(RegExpObject);
RegExpObject::RegExpObject(InternalClass *ic)
: Object(ic)
@@ -169,11 +169,6 @@ void RegExpObject::init(ExecutionEngine *engine)
}
-void RegExpObject::destroy(Managed *that)
-{
- static_cast<RegExpObject *>(that)->~RegExpObject();
-}
-
void RegExpObject::markObjects(Managed *that, ExecutionEngine *e)
{
RegExpObject *re = static_cast<RegExpObject*>(that);
@@ -231,7 +226,7 @@ uint RegExpObject::flags() const
return f;
}
-DEFINE_OBJECT_VTABLE(RegExpCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(RegExpCtor);
RegExpCtor::RegExpCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("RegExp"))
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 1b408749d3..0c22d50216 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -86,7 +86,6 @@ struct RegExpObject: Object {
RegExpObject(ExecutionEngine *engine, RegExpRef value, bool global);
RegExpObject(ExecutionEngine *engine, const QRegExp &re);
- ~RegExpObject() {}
void init(ExecutionEngine *engine);
@@ -97,7 +96,6 @@ struct RegExpObject: Object {
protected:
RegExpObject(InternalClass *ic);
- static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e);
};
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 36f61a1df5..e3fc156987 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -164,7 +164,7 @@ Returned<FunctionObject> *QmlBindingWrapper::createQmlCallableForFunction(QQmlCo
return function->asReturned<FunctionObject>();
}
-DEFINE_OBJECT_VTABLE(QmlBindingWrapper);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QmlBindingWrapper);
struct CompilationUnitHolder : public QV4::Object
{
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index f1e51703a8..5385a7618c 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -75,7 +75,7 @@
using namespace QV4;
-DEFINE_OBJECT_VTABLE(StringObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(StringObject);
StringObject::StringObject(InternalClass *ic)
: Object(ic)
@@ -171,7 +171,7 @@ void StringObject::markObjects(Managed *that, ExecutionEngine *e)
Object::markObjects(that, e);
}
-DEFINE_OBJECT_VTABLE(StringCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(StringCtor);
StringCtor::StringCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("String"))
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index a5574b706a..1480625974 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -437,7 +437,7 @@ ReturnedValue QmlContextWrapper::qmlSingletonWrapper(QV8Engine *v8, const String
return QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine());
}
-DEFINE_OBJECT_VTABLE(QQmlIdObjectsArray);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QQmlIdObjectsArray);
QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper)
: Object(engine)
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index d89dc92b68..1a8564d111 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -302,7 +302,7 @@ public:
};
-DEFINE_OBJECT_VTABLE(NodePrototype);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(NodePrototype);
class Node : public Object
{
@@ -1696,7 +1696,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Object *proto;
};
-DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestCtor);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QQmlXMLHttpRequestCtor);
void QQmlXMLHttpRequestCtor::setupProto()
{
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
index 67e9e80efb..03e2830fee 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
using namespace QV4;
-DEFINE_OBJECT_VTABLE(QtObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QtObject);
struct StaticQtMetaObject : public QObject
{
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
index adc0c6ce4f..f7fe2d2e5b 100644
--- a/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
+++ b/src/qml/qml/v8/qqmlbuiltinfunctions_p.h
@@ -155,6 +155,9 @@ struct QQmlBindingFunction : public QV4::FunctionObject
static ReturnedValue call(Managed *that, CallData *callData);
static void markObjects(Managed *that, ExecutionEngine *e);
+ static void destroy(Managed *that) {
+ static_cast<QQmlBindingFunction *>(that)->~QQmlBindingFunction();
+ }
QV4::FunctionObject *originalFunction;
// Set when the binding is created later
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index f7ce1c8fad..c86f1c989f 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -93,7 +93,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject
}
};
-DEFINE_OBJECT_VTABLE(DelegateModelGroupFunction);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(DelegateModelGroupFunction);
@@ -3237,7 +3237,7 @@ struct QQmlDelegateModelGroupChange : QV4::Object
QQmlChangeSet::Change change;
};
-DEFINE_OBJECT_VTABLE(QQmlDelegateModelGroupChange);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QQmlDelegateModelGroupChange);
class QQmlDelegateModelGroupChangeArray : public QV4::Object
{