Skip to content

Commit

Permalink
Merge PropertyCache::Data and ValueTypeData
Browse files Browse the repository at this point in the history
Change-Id: I22cbb159d009151dd77ecbcdad16f27ecb9d6dba
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
  • Loading branch information
Aaron Kennedy authored and Qt by Nokia committed Oct 16, 2011
1 parent 576e7ae commit 063c08a
Show file tree
Hide file tree
Showing 15 changed files with 282 additions and 252 deletions.
28 changes: 10 additions & 18 deletions src/declarative/qml/qdeclarativecompiler.cpp
Expand Up @@ -1870,7 +1870,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeScript::Property *p
store.property = genValueTypeData(prop, valueTypeProperty);
store.owner = 1;
} else {
store.property = genPropertyData(prop);
store.property = prop->core;
store.owner = 0;
}
QDeclarativeType *valueType = toQmlType(v->object);
Expand All @@ -1885,7 +1885,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeScript::Property *p
store.property = genValueTypeData(prop, valueTypeProperty);
store.owner = 1;
} else {
store.property = genPropertyData(prop);
store.property = prop->core;
store.owner = 0;
}
QDeclarativeType *valueType = toQmlType(v->object);
Expand Down Expand Up @@ -3226,7 +3226,7 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeScript::Value *bindi
if (ref.bindingContext.owner) {
store.property = genValueTypeData(prop, valueTypeProperty);
} else {
store.property = genPropertyData(prop);
store.property = prop->core;
}

output->addInstruction(store);
Expand All @@ -3248,7 +3248,7 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeScript::Value *bindi
if (ref.bindingContext.owner) {
store.assignBinding.property = genValueTypeData(prop, valueTypeProperty);
} else {
store.assignBinding.property = genPropertyData(prop);
store.assignBinding.property = prop->core;
}
output->addInstructionHelper(
!prop->isAlias ? QDeclarativeInstruction::StoreBinding
Expand All @@ -3271,22 +3271,14 @@ int QDeclarativeCompiler::genContextCache()
return output->contextCaches.count() - 1;
}

int QDeclarativeCompiler::genValueTypeData(QDeclarativeScript::Property *valueTypeProp,
QDeclarativeScript::Property *prop)
QDeclarativePropertyCache::Data
QDeclarativeCompiler::genValueTypeData(QDeclarativeScript::Property *valueTypeProp,
QDeclarativeScript::Property *prop)
{
typedef QDeclarativePropertyPrivate QDPP;
QByteArray data = QDPP::saveValueType(prop->parent->metaObject(), prop->index,
enginePrivate->valueTypes[prop->type]->metaObject(),
valueTypeProp->index, engine);

return output->indexForByteArray(data);
}

int QDeclarativeCompiler::genPropertyData(QDeclarativeScript::Property *prop)
{
typedef QDeclarativePropertyPrivate QDPP;
QByteArray data = QDPP::saveProperty(&prop->core);
return output->indexForByteArray(data);
return QDPP::saveValueType(prop->parent->metaObject(), prop->index,
enginePrivate->valueTypes[prop->type]->metaObject(),
valueTypeProp->index, engine);
}

bool QDeclarativeCompiler::completeComponentBuild()
Expand Down
4 changes: 2 additions & 2 deletions src/declarative/qml/qdeclarativecompiler_p.h
Expand Up @@ -373,8 +373,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeCompiler
QDeclarativeScript::Property *valueTypeProperty = 0);
int genContextCache();

int genValueTypeData(QDeclarativeScript::Property *prop, QDeclarativeScript::Property *valueTypeProp);
int genPropertyData(QDeclarativeScript::Property *prop);
QDeclarativePropertyCache::Data genValueTypeData(QDeclarativeScript::Property *prop,
QDeclarativeScript::Property *valueTypeProp);

int componentTypeRef();

Expand Down
12 changes: 6 additions & 6 deletions src/declarative/qml/qdeclarativeinstruction.cpp
Expand Up @@ -184,22 +184,22 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
qWarning().nospace() << idx << "\t\t" << "INIT_V8_BINDING\t" << instr->initV8Bindings.program << "\t" << instr->initV8Bindings.programIndex << "\t" << instr->initV8Bindings.line;
break;
case QDeclarativeInstruction::StoreBinding:
qWarning().nospace() << idx << "\t\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_BINDING\t" << instr->assignBinding.property.coreIndex << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
case QDeclarativeInstruction::StoreBindingOnAlias:
qWarning().nospace() << idx << "\t\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property.coreIndex << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
case QDeclarativeInstruction::StoreV4Binding:
qWarning().nospace() << idx << "\t\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_COMPILED_BINDING\t" << instr->assignV4Binding.property << "\t" << instr->assignV4Binding.value << "\t" << instr->assignV4Binding.context;
break;
case QDeclarativeInstruction::StoreV8Binding:
qWarning().nospace() << idx << "\t\t" << "STORE_V8_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_V8_BINDING\t" << instr->assignBinding.property.coreIndex << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
case QDeclarativeInstruction::StoreValueSource:
qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue;
qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property.coreIndex << "\t" << instr->assignValueSource.castValue;
break;
case QDeclarativeInstruction::StoreValueInterceptor:
qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue;
qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property.coreIndex << "\t" << instr->assignValueInterceptor.castValue;
break;
case QDeclarativeInstruction::BeginObject:
qWarning().nospace() << idx << "\t\t" << "BEGIN\t\t\t" << instr->begin.castValue;
Expand Down
19 changes: 15 additions & 4 deletions src/declarative/qml/qdeclarativeinstruction_p.h
Expand Up @@ -54,6 +54,7 @@
//

#include <QtCore/qglobal.h>
#include <private/qdeclarativepropertycache_p.h>

QT_BEGIN_NAMESPACE

Expand Down Expand Up @@ -106,8 +107,8 @@ QT_BEGIN_NAMESPACE
F(InitV8Bindings, initV8Bindings) \
F(StoreBinding, assignBinding) \
F(StoreBindingOnAlias, assignBinding) \
F(StoreV4Binding, assignBinding) \
F(StoreV8Binding, assignBinding) \
F(StoreV4Binding, assignV4Binding) \
F(StoreValueSource, assignValueSource) \
F(StoreValueInterceptor, assignValueInterceptor) \
F(StoreObjectQList, common) \
Expand Down Expand Up @@ -210,13 +211,13 @@ union QDeclarativeInstruction
};
struct instr_assignValueSource {
QML_INSTR_HEADER
int property;
QDeclarativePropertyCache::RawData property;
int owner;
int castValue;
};
struct instr_assignValueInterceptor {
QML_INSTR_HEADER
int property;
QDeclarativePropertyCache::RawData property;
int owner;
int castValue;
};
Expand All @@ -226,7 +227,7 @@ union QDeclarativeInstruction
ushort programIndex;
ushort line;
};
struct instr_assignBinding {
struct instr_assignV4Binding {
QML_INSTR_HEADER
unsigned int property;
int value;
Expand All @@ -235,6 +236,15 @@ union QDeclarativeInstruction
bool isRoot;
ushort line;
};
struct instr_assignBinding {
QML_INSTR_HEADER
QDeclarativePropertyCache::RawData property;
int value;
short context;
short owner;
bool isRoot;
ushort line;
};
struct instr_fetch {
QML_INSTR_HEADER
int property;
Expand Down Expand Up @@ -466,6 +476,7 @@ union QDeclarativeInstruction
instr_assignValueSource assignValueSource;
instr_assignValueInterceptor assignValueInterceptor;
instr_initV8Bindings initV8Bindings;
instr_assignV4Binding assignV4Binding;
instr_assignBinding assignBinding;
instr_fetch fetch;
instr_fetchValue fetchValue;
Expand Down

0 comments on commit 063c08a

Please sign in to comment.