Avoid calling destroy() on most objects
authorLars Knoll <lars.knoll@digia.com>
Thu, 3 Apr 2014 11:00:49 +0000 (13:00 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 22 Jul 2014 11:48:53 +0000 (13:48 +0200)
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>
33 files changed:
src/qml/jsruntime/qv4argumentsobject.cpp
src/qml/jsruntime/qv4argumentsobject_p.h
src/qml/jsruntime/qv4arraydata.cpp
src/qml/jsruntime/qv4arraydata_p.h
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4booleanobject.cpp
src/qml/jsruntime/qv4context.cpp
src/qml/jsruntime/qv4dateobject.cpp
src/qml/jsruntime/qv4errorobject.cpp
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4functionobject_p.h
src/qml/jsruntime/qv4globalobject.cpp
src/qml/jsruntime/qv4jsonobject.cpp
src/qml/jsruntime/qv4managed.cpp
src/qml/jsruntime/qv4managed_p.h
src/qml/jsruntime/qv4mathobject.cpp
src/qml/jsruntime/qv4memberdata.cpp
src/qml/jsruntime/qv4numberobject.cpp
src/qml/jsruntime/qv4object.cpp
src/qml/jsruntime/qv4object_p.h
src/qml/jsruntime/qv4objectiterator.cpp
src/qml/jsruntime/qv4objectproto.cpp
src/qml/jsruntime/qv4regexpobject.cpp
src/qml/jsruntime/qv4regexpobject_p.h
src/qml/jsruntime/qv4script.cpp
src/qml/jsruntime/qv4stringobject.cpp
src/qml/qml/qqmlcontextwrapper.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qqmlbuiltinfunctions_p.h
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcontext2d.cpp
tools/qmljs/main.cpp

index 987b228..9b465a0 100644 (file)
@@ -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)
 {
index 80c2a70..c693669 100644 (file)
@@ -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();
 };
index ed2122f..0bc97cd 100644 (file)
@@ -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);
index 50b7b8a..dec1573 100644 (file)
@@ -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);
index d5b3b8a..95677f2 100644 (file)
@@ -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"))
index 662ec64..51931da 100644 (file)
@@ -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"))
index b43b489..899723b 100644 (file)
@@ -51,7 +51,7 @@
 
 using namespace QV4;
 
-DEFINE_MANAGED_VTABLE(ExecutionContext);
+DEFINE_MANAGED_VTABLE_NO_DESTROY(ExecutionContext);
 
 CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
 {
index ceef884..aaa67e9 100644 (file)
@@ -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"))
index 9d6403e..086ca8e 100644 (file)
@@ -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"))
index b5300f8..1c6de05 100644 (file)
@@ -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);
 
index 5b832d0..76a69d7 100644 (file)
@@ -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<>
index eb0994c..feac21a 100644 (file)
@@ -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)
index ca82af1..556b2ea 100644 (file)
@@ -66,7 +66,7 @@ static int indent = 0;
 #endif
 
 
-DEFINE_OBJECT_VTABLE(JsonObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(JsonObject);
 
 class JsonParser
 {
index 1f4030a..3cfbb37 100644 (file)
@@ -56,7 +56,7 @@ const ManagedVTable Managed::static_vtbl =
     0,
     Managed::MyType,
     "Managed",
-    destroy,
+    0,
     0 /*markObjects*/,
     isEqualTo
 };
index 06d3e48..1718149 100644 (file)
@@ -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(); }
index 16d76e6..66fb06d 100644 (file)
@@ -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);
 
index aeb4c38..7c3b2b9 100644 (file)
 
 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)
 {
index c97e86f..16f81bc 100644 (file)
@@ -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"))
index c8d360d..c67ca6a 100644 (file)
@@ -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)
index 5e32bb6..666b6c9 100644 (file)
@@ -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 *);
index e5f693c..f9ad00e 100644 (file)
@@ -192,7 +192,7 @@ ReturnedValue ObjectIterator::nextPropertyNameAsString()
 }
 
 
-DEFINE_OBJECT_VTABLE(ForEachIteratorObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(ForEachIteratorObject);
 
 void ForEachIteratorObject::markObjects(Managed *that, ExecutionEngine *e)
 {
index 5c824bd..4d54a99 100644 (file)
@@ -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"))
index 956d1c5..a173dbc 100644 (file)
@@ -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"))
index 1b40874..0c22d50 100644 (file)
@@ -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);
 };
 
index 36f61a1..e3fc156 100644 (file)
@@ -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
 {
index f1e5170..5385a76 100644 (file)
@@ -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"))
index a5574b7..1480625 100644 (file)
@@ -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)
index d89dc92..1a8564d 100644 (file)
@@ -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()
 {
index 67e9e80..03e2830 100644 (file)
@@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
 
 using namespace QV4;
 
-DEFINE_OBJECT_VTABLE(QtObject);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QtObject);
 
 struct StaticQtMetaObject : public QObject
 {
index adc0c6c..f7fe2d2 100644 (file)
@@ -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
index f7ce1c8..c86f1c9 100644 (file)
@@ -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
 {
index a7d5f7d..3ba84b5 100644 (file)
@@ -529,13 +529,9 @@ public:
     static QV4::ReturnedValue method_set_textBaseline(QV4::CallContext *ctx);
 
 protected:
-    static void destroy(Managed *that)
-    {
-        static_cast<QQuickJSContext2D *>(that)->~QQuickJSContext2D();
-    }
 };
 
-DEFINE_OBJECT_VTABLE(QQuickJSContext2D);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QQuickJSContext2D);
 
 
 struct QQuickJSContext2DPrototype : public QV4::Object
@@ -641,7 +637,7 @@ public:
 
 };
 
-DEFINE_OBJECT_VTABLE(QQuickJSContext2DPrototype);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QQuickJSContext2DPrototype);
 
 
 class QQuickContext2DStyle : public QV4::Object
@@ -923,7 +919,7 @@ struct QQuickJSContext2DImageData : public QV4::Object
 
 DEFINE_REF(QQuickJSContext2DImageData, QV4::Object);
 
-DEFINE_OBJECT_VTABLE(QQuickJSContext2DImageData);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(QQuickJSContext2DImageData);
 
 static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
 {
index aaddfbf..26376fa 100644 (file)
@@ -90,7 +90,7 @@ struct Print: FunctionObject
     }
 };
 
-DEFINE_OBJECT_VTABLE(Print);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(Print);
 
 struct GC: public FunctionObject
 {
@@ -107,7 +107,7 @@ struct GC: public FunctionObject
     }
 };
 
-DEFINE_OBJECT_VTABLE(GC);
+DEFINE_OBJECT_VTABLE_NO_DESTROY(GC);
 
 } // builtins