aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2017-07-05 14:21:42 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2017-07-05 12:24:40 +0000
commit2c9b55b6968e724326eacd48913dfe7b4cc610c3 (patch)
treede3c86ffaaf9edbf40ce97e348c7a457fd21dc59
parentd3a1a9e4fea5f6b623ebd13f43957ebbe5bfabea (diff)
Fix QML disk caching
Add correct generator name (always moth for the interpreter). Also fix the test: where we generated a dummy function 0, we now don't do that anymore, so correct the function index, and the check for the code offset. Change-Id: I4c07b2b53483c513dfaf8993e1d0111bcc825179 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/compiler/qv4codegen.cpp1
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp16
2 files changed, 10 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index f200e55c82..ae929331a2 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -127,6 +127,7 @@ Codegen::Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict)
, _fileNameIsUrl(false)
, hasError(false)
{
+ jsUnitGenerator->codeGeneratorName = QStringLiteral("moth");
}
void Codegen::generateFromProgram(const QString &fileName,
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index 10a00a39e6..23097f7273 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -228,12 +228,13 @@ void tst_qmldiskcache::regenerateAfterChange()
const QV4::CompiledData::Object *obj = testUnit->objectAt(0);
QCOMPARE(quint32(obj->nBindings), quint32(1));
QCOMPARE(quint32(obj->bindingTable()->type), quint32(QV4::CompiledData::Binding::Type_Script));
- QCOMPARE(quint32(obj->bindingTable()->value.compiledScriptIndex), quint32(1));
+ QCOMPARE(quint32(obj->bindingTable()->value.compiledScriptIndex), quint32(0));
- QCOMPARE(quint32(testUnit->functionTableSize), quint32(2));
+ QCOMPARE(quint32(testUnit->functionTableSize), quint32(1));
- const QV4::CompiledData::Function *bindingFunction = testUnit->functionAt(1);
- QVERIFY(bindingFunction->codeOffset > testUnit->unitSize);
+ const QV4::CompiledData::Function *bindingFunction = testUnit->functionAt(0);
+ quint64 firstCodeOffset = (testUnit->unitSize + 15u) & ~15u;
+ QVERIFY(bindingFunction->codeOffset == firstCodeOffset);
}
{
@@ -254,10 +255,11 @@ void tst_qmldiskcache::regenerateAfterChange()
QCOMPARE(quint32(obj->bindingTable()->type), quint32(QV4::CompiledData::Binding::Type_Number));
QCOMPARE(obj->bindingTable()->valueAsNumber(), double(42));
- QCOMPARE(quint32(testUnit->functionTableSize), quint32(2));
+ QCOMPARE(quint32(testUnit->functionTableSize), quint32(1));
- const QV4::CompiledData::Function *bindingFunction = testUnit->functionAt(1);
- QVERIFY(bindingFunction->codeOffset > testUnit->unitSize);
+ const QV4::CompiledData::Function *bindingFunction = testUnit->functionAt(0);
+ quint64 firstCodeOffset = (testUnit->unitSize + 15u) & ~15u;
+ QVERIFY(bindingFunction->codeOffset == firstCodeOffset);
}
}