Get rid of one PersistentValue usage

We don't need to store a PersistentValue in a place that is reachable through
regular object marking.

Change-Id: I2a8764970e6d37b707921c65e6066d33c558576c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Simon Hausmann 2014-11-19 15:07:30 +01:00 committed by Simon Hausmann
parent 5f3792cd32
commit e6db292366
2 changed files with 9 additions and 3 deletions

View File

@ -1765,8 +1765,8 @@ Heap::QObjectMethod::QObjectMethod(QV4::ExecutionContext *scope, QObject *object
: Heap::FunctionObject(scope)
, object(object)
, index(index)
, qmlGlobal(qmlGlobal)
{
this->qmlGlobal = qmlGlobal;
setVTable(QV4::QObjectMethod::staticVTable());
subtype = WrappedQtMethod;
}
@ -1875,7 +1875,7 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData)
if (method.isV4Function()) {
QV4::ScopedValue rv(scope, QV4::Primitive::undefinedValue());
QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal.value());
QV4::ScopedValue qmlGlobal(scope, d()->qmlGlobal);
QQmlV4Function func(callData, rv, qmlGlobal,
QmlContextWrapper::getContext(qmlGlobal),
v8Engine);
@ -1894,6 +1894,11 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData)
}
}
void QObjectMethod::markObjects(Heap::Base *that, ExecutionEngine *e)
{
static_cast<QObjectMethod::Data*>(that)->qmlGlobal.mark(e);
}
DEFINE_OBJECT_VTABLE(QObjectMethod);
Heap::QmlSignalHandler::QmlSignalHandler(QV4::ExecutionEngine *engine, QObject *object, int signalIndex)

View File

@ -78,7 +78,7 @@ struct QObjectMethod : FunctionObject {
QObjectMethod(QV4::ExecutionContext *scope, QObject *object, int index, const ValueRef qmlGlobal);
QPointer<QObject> object;
int index;
QV4::PersistentValue qmlGlobal;
Value qmlGlobal;
};
struct QmlSignalHandler : Object {
@ -151,6 +151,7 @@ struct Q_QML_EXPORT QObjectMethod : public QV4::FunctionObject
ReturnedValue callInternal(CallData *callData);
static void markObjects(Heap::Base *that, QV4::ExecutionEngine *e);
static void destroy(Managed *that)
{
static_cast<QObjectMethod *>(that)->d()->~Data();