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>
This commit is contained in:
Lars Knoll 2014-04-03 13:00:49 +02:00 committed by Simon Hausmann
parent 08a3c0edeb
commit 4427576fe5
33 changed files with 90 additions and 104 deletions

View File

@ -44,7 +44,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(ArgumentsObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(ArgumentsObject);
ArgumentsObject::ArgumentsObject(CallContext *context) ArgumentsObject::ArgumentsObject(CallContext *context)
: Object(context->strictMode ? context->engine->strictArgumentsObjectClass : context->engine->argumentsObjectClass) : Object(context->strictMode ? context->engine->strictArgumentsObjectClass : context->engine->argumentsObjectClass)
@ -79,11 +79,6 @@ ArgumentsObject::ArgumentsObject(CallContext *context)
Q_ASSERT(internalClass->vtable == staticVTable()); Q_ASSERT(internalClass->vtable == staticVTable());
} }
void ArgumentsObject::destroy(Managed *that)
{
static_cast<ArgumentsObject *>(that)->~ArgumentsObject();
}
void ArgumentsObject::fullyCreate() void ArgumentsObject::fullyCreate()
{ {
if (fullyCreated) if (fullyCreated)
@ -202,7 +197,7 @@ PropertyAttributes ArgumentsObject::queryIndexed(const Managed *m, uint index)
return Attr_Accessor; return Attr_Accessor;
} }
DEFINE_OBJECT_VTABLE(ArgumentsGetterFunction); DEFINE_OBJECT_VTABLE_NO_DESTROY(ArgumentsGetterFunction);
ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData) ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
{ {
@ -217,7 +212,7 @@ ReturnedValue ArgumentsGetterFunction::call(Managed *getter, CallData *callData)
return o->context->argument(g->index); return o->context->argument(g->index);
} }
DEFINE_OBJECT_VTABLE(ArgumentsSetterFunction); DEFINE_OBJECT_VTABLE_NO_DESTROY(ArgumentsSetterFunction);
ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData) ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData)
{ {

View File

@ -82,7 +82,6 @@ struct ArgumentsObject: Object {
bool fullyCreated; bool fullyCreated;
Members mappedArguments; Members mappedArguments;
ArgumentsObject(CallContext *context); ArgumentsObject(CallContext *context);
~ArgumentsObject() {}
static bool isNonStrictArgumentsObject(Managed *m) { static bool isNonStrictArgumentsObject(Managed *m) {
return m->internalClass->vtable->type == Type_ArgumentsObject && return m->internalClass->vtable->type == Type_ArgumentsObject &&
@ -100,7 +99,6 @@ struct ArgumentsObject: Object {
static bool deleteIndexedProperty(Managed *m, uint index); static bool deleteIndexedProperty(Managed *m, uint index);
static PropertyAttributes queryIndexed(const Managed *m, uint index); static PropertyAttributes queryIndexed(const Managed *m, uint index);
static void markObjects(Managed *that, ExecutionEngine *e); static void markObjects(Managed *that, ExecutionEngine *e);
static void destroy(Managed *);
void fullyCreate(); void fullyCreate();
}; };

View File

@ -47,7 +47,7 @@ using namespace QV4;
const ArrayVTable SimpleArrayData::static_vtbl = const ArrayVTable SimpleArrayData::static_vtbl =
{ {
DEFINE_MANAGED_VTABLE_INT(SimpleArrayData), DEFINE_MANAGED_VTABLE_NO_DESTROY_INT(SimpleArrayData),
SimpleArrayData::Simple, SimpleArrayData::Simple,
SimpleArrayData::reallocate, SimpleArrayData::reallocate,
SimpleArrayData::get, SimpleArrayData::get,
@ -207,10 +207,6 @@ void ArrayData::ensureAttributes(Object *o)
} }
void SimpleArrayData::destroy(Managed *)
{
}
void SimpleArrayData::markObjects(Managed *d, ExecutionEngine *e) void SimpleArrayData::markObjects(Managed *d, ExecutionEngine *e)
{ {
SimpleArrayData *dd = static_cast<SimpleArrayData *>(d); SimpleArrayData *dd = static_cast<SimpleArrayData *>(d);

View File

@ -149,7 +149,6 @@ struct Q_QML_EXPORT SimpleArrayData : public ArrayData
static void getHeadRoom(Object *o); static void getHeadRoom(Object *o);
static ArrayData *reallocate(Object *o, uint n, bool enforceAttributes); static ArrayData *reallocate(Object *o, uint n, bool enforceAttributes);
static void destroy(Managed *d);
static void markObjects(Managed *d, ExecutionEngine *e); static void markObjects(Managed *d, ExecutionEngine *e);
static ReturnedValue get(const ArrayData *d, uint index); static ReturnedValue get(const ArrayData *d, uint index);

View File

@ -46,7 +46,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(ArrayCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(ArrayCtor);
ArrayCtor::ArrayCtor(ExecutionContext *scope) ArrayCtor::ArrayCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Array")) : FunctionObject(scope, QStringLiteral("Array"))

View File

@ -43,8 +43,8 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(BooleanCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(BooleanCtor);
DEFINE_OBJECT_VTABLE(BooleanObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(BooleanObject);
BooleanCtor::BooleanCtor(ExecutionContext *scope) BooleanCtor::BooleanCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Boolean")) : FunctionObject(scope, QStringLiteral("Boolean"))

View File

@ -51,7 +51,7 @@
using namespace QV4; using namespace QV4;
DEFINE_MANAGED_VTABLE(ExecutionContext); DEFINE_MANAGED_VTABLE_NO_DESTROY(ExecutionContext);
CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData) CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{ {

View File

@ -641,7 +641,7 @@ static double getLocalTZA()
#endif #endif
} }
DEFINE_OBJECT_VTABLE(DateObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(DateObject);
DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date) DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date)
: Object(engine->dateClass) : Object(engine->dateClass)
@ -655,7 +655,7 @@ QDateTime DateObject::toQDateTime() const
return ToDateTime(value.asDouble(), Qt::LocalTime); return ToDateTime(value.asDouble(), Qt::LocalTime);
} }
DEFINE_OBJECT_VTABLE(DateCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(DateCtor);
DateCtor::DateCtor(ExecutionContext *scope) DateCtor::DateCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Date")) : FunctionObject(scope, QStringLiteral("Date"))

View File

@ -249,13 +249,13 @@ URIErrorObject::URIErrorObject(ExecutionEngine *engine, const ValueRef message)
{ {
} }
DEFINE_OBJECT_VTABLE(ErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(ErrorCtor);
DEFINE_OBJECT_VTABLE(EvalErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(EvalErrorCtor);
DEFINE_OBJECT_VTABLE(RangeErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(RangeErrorCtor);
DEFINE_OBJECT_VTABLE(ReferenceErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(ReferenceErrorCtor);
DEFINE_OBJECT_VTABLE(SyntaxErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(SyntaxErrorCtor);
DEFINE_OBJECT_VTABLE(TypeErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(TypeErrorCtor);
DEFINE_OBJECT_VTABLE(URIErrorCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(URIErrorCtor);
ErrorCtor::ErrorCtor(ExecutionContext *scope) ErrorCtor::ErrorCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Error")) : FunctionObject(scope, QStringLiteral("Error"))

View File

@ -72,7 +72,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(FunctionObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(FunctionObject);
FunctionObject::FunctionObject(ExecutionContext *scope, const StringRef name, bool createProto) FunctionObject::FunctionObject(ExecutionContext *scope, const StringRef name, bool createProto)
: Object(scope->engine->functionClass) : Object(scope->engine->functionClass)
@ -183,7 +183,7 @@ FunctionObject *FunctionObject::createScriptFunction(ExecutionContext *scope, Fu
return new (scope->engine->memoryManager) SimpleScriptFunction(scope, function, createProto); return new (scope->engine->memoryManager) SimpleScriptFunction(scope, function, createProto);
} }
DEFINE_OBJECT_VTABLE(FunctionCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(FunctionCtor);
FunctionCtor::FunctionCtor(ExecutionContext *scope) FunctionCtor::FunctionCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Function")) : 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(); 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) ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
: SimpleScriptFunction(scope, function, true) : SimpleScriptFunction(scope, function, true)
@ -421,7 +421,7 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData)
return result.asReturnedValue(); return result.asReturnedValue();
} }
DEFINE_OBJECT_VTABLE(SimpleScriptFunction); DEFINE_OBJECT_VTABLE_NO_DESTROY(SimpleScriptFunction);
SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function, bool createProto) SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function, bool createProto)
: FunctionObject(scope, function->name(), 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 *)) BuiltinFunction::BuiltinFunction(ExecutionContext *scope, const StringRef name, ReturnedValue (*code)(CallContext *))
: FunctionObject(scope, name) : FunctionObject(scope, name)
@ -597,7 +597,7 @@ ReturnedValue IndexedBuiltinFunction::call(Managed *that, CallData *callData)
return f->code(&ctx, f->index); return f->code(&ctx, f->index);
} }
DEFINE_OBJECT_VTABLE(IndexedBuiltinFunction); DEFINE_OBJECT_VTABLE_NO_DESTROY(IndexedBuiltinFunction);
DEFINE_OBJECT_VTABLE(BoundFunction); DEFINE_OBJECT_VTABLE(BoundFunction);

View File

@ -143,8 +143,6 @@ protected:
FunctionObject(InternalClass *ic); FunctionObject(InternalClass *ic);
static void markObjects(Managed *that, ExecutionEngine *e); static void markObjects(Managed *that, ExecutionEngine *e);
static void destroy(Managed *that)
{ static_cast<FunctionObject*>(that)->~FunctionObject(); }
}; };
template<> template<>

View File

@ -344,7 +344,7 @@ static QString decode(const QString &input, DecodeMode decodeMode, bool *ok)
return QString(); return QString();
} }
DEFINE_OBJECT_VTABLE(EvalFunction); DEFINE_OBJECT_VTABLE_NO_DESTROY(EvalFunction);
EvalFunction::EvalFunction(ExecutionContext *scope) EvalFunction::EvalFunction(ExecutionContext *scope)
: FunctionObject(scope, scope->engine->id_eval) : FunctionObject(scope, scope->engine->id_eval)

View File

@ -66,7 +66,7 @@ static int indent = 0;
#endif #endif
DEFINE_OBJECT_VTABLE(JsonObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(JsonObject);
class JsonParser class JsonParser
{ {

View File

@ -56,7 +56,7 @@ const ManagedVTable Managed::static_vtbl =
0, 0,
Managed::MyType, Managed::MyType,
"Managed", "Managed",
destroy, 0,
0 /*markObjects*/, 0 /*markObjects*/,
isEqualTo isEqualTo
}; };

View File

@ -141,9 +141,26 @@ struct ObjectVTable
isEqualTo \ 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) \ #define DEFINE_MANAGED_VTABLE(classname) \
const QV4::ManagedVTable classname::static_vtbl = DEFINE_MANAGED_VTABLE_INT(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) \ #define DEFINE_OBJECT_VTABLE(classname) \
@ -166,6 +183,26 @@ const QV4::ObjectVTable classname::static_vtbl = \
advanceIterator \ 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) \ #define DEFINE_MANAGED_VTABLE_WITH_NAME(classname, name) \
const QV4::ObjectVTable classname::static_vtbl = \ const QV4::ObjectVTable classname::static_vtbl = \
{ \ { \
@ -299,7 +336,6 @@ public:
bool isEqualTo(Managed *other) bool isEqualTo(Managed *other)
{ return internalClass->vtable->isEqualTo(this, other); } { return internalClass->vtable->isEqualTo(this, other); }
static void destroy(Managed *that) { that->_data = 0; }
static bool isEqualTo(Managed *m, Managed *other); static bool isEqualTo(Managed *m, Managed *other);
ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); } ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); }

View File

@ -51,7 +51,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(MathObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(MathObject);
static const double qt_PI = 2.0 * ::asin(1.0); static const double qt_PI = 2.0 * ::asin(1.0);

View File

@ -44,23 +44,7 @@
using namespace QV4; using namespace QV4;
const ManagedVTable MemberData::static_vtbl = DEFINE_MANAGED_VTABLE_NO_DESTROY(MemberData);
{
MemberData::IsExecutionContext,
MemberData::IsString,
MemberData::IsObject,
MemberData::IsFunctionObject,
MemberData::IsErrorObject,
MemberData::IsArrayData,
0,
MemberData::MyType,
"MemberData",
destroy,
markObjects,
isEqualTo
};
void MemberData::markObjects(Managed *that, ExecutionEngine *e) void MemberData::markObjects(Managed *that, ExecutionEngine *e)
{ {

View File

@ -48,8 +48,8 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(NumberCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(NumberCtor);
DEFINE_OBJECT_VTABLE(NumberObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(NumberObject);
NumberCtor::NumberCtor(ExecutionContext *scope) NumberCtor::NumberCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Number")) : FunctionObject(scope, QStringLiteral("Number"))

View File

@ -68,7 +68,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(Object); DEFINE_OBJECT_VTABLE_NO_DESTROY(Object);
Object::Object(ExecutionEngine *engine) Object::Object(ExecutionEngine *engine)
: Managed(engine->objectClass) : Managed(engine->objectClass)
@ -88,11 +88,6 @@ Object::Object(InternalClass *ic)
} }
} }
Object::~Object()
{
_data = 0;
}
bool Object::setPrototype(Object *proto) bool Object::setPrototype(Object *proto)
{ {
Object *pp = proto; Object *pp = proto;
@ -105,11 +100,6 @@ bool Object::setPrototype(Object *proto)
return true; return true;
} }
void Object::destroy(Managed *that)
{
static_cast<Object *>(that)->~Object();
}
void Object::put(ExecutionContext *ctx, const QString &name, const ValueRef value) void Object::put(ExecutionContext *ctx, const QString &name, const ValueRef value)
{ {
Scope scope(ctx); 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) ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list)
: Object(engine->arrayClass) : Object(engine->arrayClass)

View File

@ -116,7 +116,6 @@ struct Q_QML_EXPORT Object: Managed {
Object(ExecutionEngine *engine); Object(ExecutionEngine *engine);
Object(InternalClass *internalClass); Object(InternalClass *internalClass);
~Object();
const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(internalClass->vtable); } const ObjectVTable *vtable() const { return reinterpret_cast<const ObjectVTable *>(internalClass->vtable); }
Object *prototype() const { return internalClass->prototype; } Object *prototype() const { return internalClass->prototype; }
@ -270,7 +269,6 @@ public:
inline ReturnedValue call(CallData *d) inline ReturnedValue call(CallData *d)
{ return vtable()->call(this, d); } { return vtable()->call(this, d); }
protected: protected:
static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e); static void markObjects(Managed *that, ExecutionEngine *e);
static ReturnedValue construct(Managed *m, CallData *); static ReturnedValue construct(Managed *m, CallData *);
static ReturnedValue call(Managed *m, CallData *); static ReturnedValue call(Managed *m, CallData *);

View 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) void ForEachIteratorObject::markObjects(Managed *that, ExecutionEngine *e)
{ {

View File

@ -72,7 +72,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(ObjectCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(ObjectCtor);
ObjectCtor::ObjectCtor(ExecutionContext *scope) ObjectCtor::ObjectCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Object")) : FunctionObject(scope, QStringLiteral("Object"))

View File

@ -69,7 +69,7 @@ Q_CORE_EXPORT QString qt_regexp_toCanonical(const QString &, QRegExp::PatternSyn
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(RegExpObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(RegExpObject);
RegExpObject::RegExpObject(InternalClass *ic) RegExpObject::RegExpObject(InternalClass *ic)
: Object(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) void RegExpObject::markObjects(Managed *that, ExecutionEngine *e)
{ {
RegExpObject *re = static_cast<RegExpObject*>(that); RegExpObject *re = static_cast<RegExpObject*>(that);
@ -231,7 +226,7 @@ uint RegExpObject::flags() const
return f; return f;
} }
DEFINE_OBJECT_VTABLE(RegExpCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(RegExpCtor);
RegExpCtor::RegExpCtor(ExecutionContext *scope) RegExpCtor::RegExpCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("RegExp")) : FunctionObject(scope, QStringLiteral("RegExp"))

View File

@ -86,7 +86,6 @@ struct RegExpObject: Object {
RegExpObject(ExecutionEngine *engine, RegExpRef value, bool global); RegExpObject(ExecutionEngine *engine, RegExpRef value, bool global);
RegExpObject(ExecutionEngine *engine, const QRegExp &re); RegExpObject(ExecutionEngine *engine, const QRegExp &re);
~RegExpObject() {}
void init(ExecutionEngine *engine); void init(ExecutionEngine *engine);
@ -97,7 +96,6 @@ struct RegExpObject: Object {
protected: protected:
RegExpObject(InternalClass *ic); RegExpObject(InternalClass *ic);
static void destroy(Managed *that);
static void markObjects(Managed *that, ExecutionEngine *e); static void markObjects(Managed *that, ExecutionEngine *e);
}; };

View File

@ -164,7 +164,7 @@ Returned<FunctionObject> *QmlBindingWrapper::createQmlCallableForFunction(QQmlCo
return function->asReturned<FunctionObject>(); return function->asReturned<FunctionObject>();
} }
DEFINE_OBJECT_VTABLE(QmlBindingWrapper); DEFINE_OBJECT_VTABLE_NO_DESTROY(QmlBindingWrapper);
struct CompilationUnitHolder : public QV4::Object struct CompilationUnitHolder : public QV4::Object
{ {

View File

@ -75,7 +75,7 @@
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(StringObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(StringObject);
StringObject::StringObject(InternalClass *ic) StringObject::StringObject(InternalClass *ic)
: Object(ic) : Object(ic)
@ -171,7 +171,7 @@ void StringObject::markObjects(Managed *that, ExecutionEngine *e)
Object::markObjects(that, e); Object::markObjects(that, e);
} }
DEFINE_OBJECT_VTABLE(StringCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(StringCtor);
StringCtor::StringCtor(ExecutionContext *scope) StringCtor::StringCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("String")) : FunctionObject(scope, QStringLiteral("String"))

View File

@ -437,7 +437,7 @@ ReturnedValue QmlContextWrapper::qmlSingletonWrapper(QV8Engine *v8, const String
return QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine()); return QJSValuePrivate::get(siinfo->scriptApi(e))->getValue(engine());
} }
DEFINE_OBJECT_VTABLE(QQmlIdObjectsArray); DEFINE_OBJECT_VTABLE_NO_DESTROY(QQmlIdObjectsArray);
QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper) QQmlIdObjectsArray::QQmlIdObjectsArray(ExecutionEngine *engine, QmlContextWrapper *contextWrapper)
: Object(engine) : Object(engine)

View File

@ -302,7 +302,7 @@ public:
}; };
DEFINE_OBJECT_VTABLE(NodePrototype); DEFINE_OBJECT_VTABLE_NO_DESTROY(NodePrototype);
class Node : public Object class Node : public Object
{ {
@ -1696,7 +1696,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject
Object *proto; Object *proto;
}; };
DEFINE_OBJECT_VTABLE(QQmlXMLHttpRequestCtor); DEFINE_OBJECT_VTABLE_NO_DESTROY(QQmlXMLHttpRequestCtor);
void QQmlXMLHttpRequestCtor::setupProto() void QQmlXMLHttpRequestCtor::setupProto()
{ {

View File

@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
using namespace QV4; using namespace QV4;
DEFINE_OBJECT_VTABLE(QtObject); DEFINE_OBJECT_VTABLE_NO_DESTROY(QtObject);
struct StaticQtMetaObject : public QObject struct StaticQtMetaObject : public QObject
{ {

View File

@ -155,6 +155,9 @@ struct QQmlBindingFunction : public QV4::FunctionObject
static ReturnedValue call(Managed *that, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData);
static void markObjects(Managed *that, ExecutionEngine *e); static void markObjects(Managed *that, ExecutionEngine *e);
static void destroy(Managed *that) {
static_cast<QQmlBindingFunction *>(that)->~QQmlBindingFunction();
}
QV4::FunctionObject *originalFunction; QV4::FunctionObject *originalFunction;
// Set when the binding is created later // Set when the binding is created later

View 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; QQmlChangeSet::Change change;
}; };
DEFINE_OBJECT_VTABLE(QQmlDelegateModelGroupChange); DEFINE_OBJECT_VTABLE_NO_DESTROY(QQmlDelegateModelGroupChange);
class QQmlDelegateModelGroupChangeArray : public QV4::Object class QQmlDelegateModelGroupChangeArray : public QV4::Object
{ {

View File

@ -529,13 +529,9 @@ public:
static QV4::ReturnedValue method_set_textBaseline(QV4::CallContext *ctx); static QV4::ReturnedValue method_set_textBaseline(QV4::CallContext *ctx);
protected: 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 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 class QQuickContext2DStyle : public QV4::Object
@ -923,7 +919,7 @@ struct QQuickJSContext2DImageData : public QV4::Object
DEFINE_REF(QQuickJSContext2DImageData, 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) static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
{ {

View File

@ -90,7 +90,7 @@ struct Print: FunctionObject
} }
}; };
DEFINE_OBJECT_VTABLE(Print); DEFINE_OBJECT_VTABLE_NO_DESTROY(Print);
struct GC: public FunctionObject struct GC: public FunctionObject
{ {
@ -107,7 +107,7 @@ struct GC: public FunctionObject
} }
}; };
DEFINE_OBJECT_VTABLE(GC); DEFINE_OBJECT_VTABLE_NO_DESTROY(GC);
} // builtins } // builtins