{
if (m_target && m_index >= 0) {
if (m_target->propertiesInitialized && !m_target->properties.isUndefined()) {
- QV4::ExecutionEngine *v4 = m_target->properties.engine();
+ QV4::ExecutionEngine *v4 = m_target->cache->engine;
if (v4) {
QV4::Scope scope(v4);
QV4::Scoped<QV4::MemberData> sp(scope, m_target->properties.value());
: object(obj),
ctxt(QQmlData::get(obj, true)->outerContext), cache(cache), metaData(meta),
hasAssignedMetaObjectData(false), aliasEndpoints(0),
- propertiesInitialized(false), interceptors(0), v8methods(0)
+ propertiesInitialized(false), interceptors(0), methods(0)
{
QObjectPrivate *op = QObjectPrivate::get(obj);
ensureQObjectWrapper();
if (qmlBindingContext && metaData->methodCount) {
- v8methods = new QV4::PersistentValue[metaData->methodCount];
+ methods = new QV4::PersistentValue[metaData->methodCount];
QV4::CompiledData::CompilationUnit *compilationUnit = compiledData->compilationUnit;
- QV4::Scope scope(QQmlEnginePrivate::get(ctxt->engine)->v4engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedObject o(scope);
for (int index = 0; index < metaData->methodCount; ++index) {
QQmlVMEMetaData::MethodData *data = metaData->methodData() + index;
QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[data->runtimeFunctionIndex];
o = QV4::FunctionObject::createScriptFunction(qmlBindingContext, runtimeFunction);
- v8methods[index].set(qmlBindingContext->engine(), o);
+ methods[index].set(qmlBindingContext->engine(), o);
}
}
}
{
if (parent.isT1()) parent.asT1()->objectDestroyed(object);
delete [] aliasEndpoints;
- delete [] v8methods;
+ delete [] methods;
qDeleteAll(varObjectGuards);
}
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newString(v);
+ *(md->data() + id) = cache->engine->newString(v);
}
void QQmlVMEMetaObject::writeProperty(int id, const QUrl& v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant::fromValue(v));
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant::fromValue(v));
}
void QQmlVMEMetaObject::writeProperty(int id, const QDate& v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant::fromValue(v));
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant::fromValue(v));
}
void QQmlVMEMetaObject::writeProperty(int id, const QDateTime& v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant::fromValue(v));
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant::fromValue(v));
}
void QQmlVMEMetaObject::writeProperty(int id, const QPointF& v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant::fromValue(v));
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant::fromValue(v));
}
void QQmlVMEMetaObject::writeProperty(int id, const QSizeF& v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant::fromValue(v));
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant::fromValue(v));
}
void QQmlVMEMetaObject::writeProperty(int id, const QRectF& v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant::fromValue(v));
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant::fromValue(v));
}
void QQmlVMEMetaObject::writeProperty(int id, QObject* v)
{
QV4::MemberData *md = propertiesAsMemberData();
if (md)
- *(md->data() + id) = QV4::QObjectWrapper::wrap(properties.engine(), v);
+ *(md->data() + id) = QV4::QObjectWrapper::wrap(cache->engine, v);
QQmlVMEVariantQObjectPtr *guard = getQObjectGuardForProperty(id);
if (v && !guard) {
if (!md)
return 0;
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
if (!sv->isInt32())
return 0;
if (!md)
return false;
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
if (!sv->isBoolean())
return false;
if (!md)
return 0.0;
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
if (!sv->isDouble())
return 0.0;
if (!md)
return QString();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
if (!sv->isString())
return QString();
if (!md)
return QUrl();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
if (!v || v->d()->data.type() != QVariant::Url)
if (!md)
return QDate();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
if (!v || v->d()->data.type() != QVariant::Date)
if (!md)
return QDateTime();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
if (!v || v->d()->data.type() != QVariant::DateTime)
if (!md)
return QSizeF();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
if (!v || v->d()->data.type() != QVariant::SizeF)
if (!md)
return QPointF();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
if (!v || v->d()->data.type() != QVariant::PointF)
if (!md)
return 0;
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::QObjectWrapper *wrapper = sv->as<QV4::QObjectWrapper>();
if (!wrapper)
if (!md)
return QRectF();
- QV4::Scope scope(properties.engine());
+ QV4::Scope scope(cache->engine);
QV4::ScopedValue sv(scope, *(md->data() + id));
const QV4::VariantObject *v = sv->as<QV4::VariantObject>();
if (!v || v->d()->data.type() != QVariant::RectF)
if (md) {
QV4::VariantObject *v = (md->data() + id)->as<QV4::VariantObject>();
if (!v) {
- *(md->data() + id) = properties.engine()->newVariantObject(QVariant());
+ *(md->data() + id) = cache->engine->newVariantObject(QVariant());
v = (md->data() + id)->as<QV4::VariantObject>();
}
QQml_valueTypeProvider()->initValueType(t, v->d()->data);
return QV4::Primitive::undefinedValue().asReturnedValue();
}
- if (!v8methods)
- v8methods = new QV4::PersistentValue[metaData->methodCount];
+ if (!methods)
+ methods = new QV4::PersistentValue[metaData->methodCount];
- return v8methods[index].value();
+ return methods[index].value();
}
QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id)
const QV4::VariantObject *v = (md->data() + id)->as<QV4::VariantObject>();
if (v)
return v->d()->data;
- return properties.engine()->toVariant(*(md->data() + id), -1);
+ return cache->engine->toVariant(*(md->data() + id), -1);
}
return QVariant();
}
// And, if the new value is a scarce resource, we need to ensure that it does not get
// automatically released by the engine until no other references to it exist.
- QV4::Scope scope(properties.engine());
- QV4::ScopedValue newv(scope, properties.engine()->fromVariant(value));
+ QV4::Scope scope(cache->engine);
+ QV4::ScopedValue newv(scope, cache->engine->fromVariant(value));
QV4::Scoped<QV4::VariantObject> v(scope, newv);
if (!!v)
v->addVmePropertyReference();
v->d()->data != value);
if (v)
v->removeVmePropertyReference();
- *(md->data() + id) = properties.engine()->newVariantObject(value);
+ *(md->data() + id) = cache->engine->newVariantObject(value);
v = static_cast<QV4::VariantObject *>(md->data() + id);
v->addVmePropertyReference();
}
int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
Q_ASSERT(index >= (methodOffset() + plainSignals) && index < (methodOffset() + plainSignals + metaData->methodCount));
- if (!v8methods)
- v8methods = new QV4::PersistentValue[metaData->methodCount];
+ if (!methods)
+ methods = new QV4::PersistentValue[metaData->methodCount];
int methodIndex = index - methodOffset() - plainSignals;
- v8methods[methodIndex].set(function.as<QV4::Object>()->engine(), function);
+ methods[methodIndex].set(function.as<QV4::Object>()->engine(), function);
}
QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index)
void QQmlVMEMetaObject::ensureQObjectWrapper()
{
- Q_ASSERT(ctxt && ctxt->engine);
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(ctxt->engine);
- QV4::ExecutionEngine *v4 = ep->v4engine();
+ Q_ASSERT(cache && cache->engine);
+ QV4::ExecutionEngine *v4 = cache->engine;
QV4::QObjectWrapper::wrap(v4, object);
}
void QQmlVMEMetaObject::mark(QV4::ExecutionEngine *e)
{
- QQmlEnginePrivate *ep = (ctxt == 0 || ctxt->engine == 0) ? 0 : QQmlEnginePrivate::get(ctxt->engine);
- QV4::ExecutionEngine *v4 = (ep == 0) ? 0 : ep->v4engine();
+ QV4::ExecutionEngine *v4 = cache ? cache->engine : 0;
if (v4 != e)
return;
void QQmlVMEMetaObject::allocateProperties()
{
- QQmlEngine *qml = qmlEngine(object);
- Q_ASSERT(qml);
- QV4::ExecutionEngine *v4 = QV8Engine::getV4(qml->handle());
+ Q_ASSERT(cache && cache->engine);
+ QV4::ExecutionEngine *v4 = cache->engine;
QV4::Heap::MemberData *data = QV4::MemberData::reallocate(v4, 0, metaData->propertyCount);
properties.set(v4, data);
for (uint i = 0; i < data->size; ++i)