diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qml/ecmascripttests/TestExpectations | 1 | ||||
m--------- | tests/auto/qml/ecmascripttests/test262 | 0 | ||||
-rw-r--r-- | tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp | 13 | ||||
-rw-r--r-- | tests/auto/qml/qml.pro | 3 | ||||
-rw-r--r-- | tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 28 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 44 | ||||
-rw-r--r-- | tests/manual/v4/fact.2.js | 2 |
8 files changed, 45 insertions, 49 deletions
diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index fd74135727..bef8af15f6 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -38,7 +38,6 @@ #include <private/qv4debugging_p.h> #include <private/qv8engine_p.h> #include <private/qv4objectiterator_p.h> -#include <private/qv4isel_moth_p.h> #include <private/qv4string_p.h> #include <private/qqmlbuiltinfunctions_p.h> #include <private/qqmldebugservice_p.h> @@ -343,7 +342,6 @@ void tst_qv4debugger::init() m_javaScriptThread = new QThread; m_engine = new TestEngine; m_v4 = m_engine->v4Engine(); - m_v4->iselFactory.reset(new QV4::Moth::ISelFactory); m_v4->setDebugger(new QV4Debugger(m_v4)); m_engine->moveToThread(m_javaScriptThread); m_javaScriptThread->start(); @@ -491,7 +489,6 @@ void tst_qv4debugger::conditionalBreakPointInQml() QQmlEngine engine; QV4::ExecutionEngine *v4 = QV8Engine::getV4(&engine); QV4Debugger *v4Debugger = new QV4Debugger(v4); - v4->iselFactory.reset(new QV4::Moth::ISelFactory); v4->setDebugger(v4Debugger); QScopedPointer<QThread> debugThread(new QThread); diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations index 27498de473..589f25d174 100644 --- a/tests/auto/qml/ecmascripttests/TestExpectations +++ b/tests/auto/qml/ecmascripttests/TestExpectations @@ -15,7 +15,6 @@ S15.1.2.3_A2_T10 15.5.4.20-3-5 15.5.4.20-3-6 -10.4.3-1-106 failing 11.2.3-3_3 failing S13_A15_T4 failing S15.4.4.3_A1_T1 failing diff --git a/tests/auto/qml/ecmascripttests/test262 b/tests/auto/qml/ecmascripttests/test262 -Subproject fe58b18c13d1ea5d42951e5b698efc3bfab6dc8 +Subproject d60c4ed97e69639bc5bc1db43a98828debf80c8 diff --git a/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp b/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp index 880e254543..4303aec2a7 100644 --- a/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp +++ b/tests/auto/qml/ecmascripttests/tst_ecmascripttests.cpp @@ -35,28 +35,17 @@ class tst_EcmaScriptTests : public QObject { Q_OBJECT private slots: - void runTests_data(); void runTests(); }; -void tst_EcmaScriptTests::runTests_data() -{ - QTest::addColumn<QString>("qmljsParameter"); - - QTest::newRow("jit") << QStringLiteral("--jit"); - QTest::newRow("interpreter") << QStringLiteral("--interpret"); -} - void tst_EcmaScriptTests::runTests() { #if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_64) - QFETCH(QString, qmljsParameter); - QProcess process; process.setProcessChannelMode(QProcess::ForwardedChannels); process.setWorkingDirectory(QLatin1String(SRCDIR)); process.setProgram("python"); - process.setArguments(QStringList() << "test262.py" << "--command=" + QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmljs " + qmljsParameter << "--parallel" << "--with-test-expectations"); + process.setArguments(QStringList() << "test262.py" << "--command=" + QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmljs" << "--parallel" << "--with-test-expectations"); qDebug() << "Going to run" << process.program() << process.arguments() << "in" << process.workingDirectory(); diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 9eb500f537..a1180e12df 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -34,7 +34,6 @@ PUBLICTESTS += \ PRIVATETESTS += \ qqmlcpputils \ qqmldirparser \ - v4misc \ qmlcachegen PRIVATETESTS += \ @@ -82,7 +81,7 @@ qtHaveModule(widgets) { SUBDIRS += $$PUBLICTESTS SUBDIRS += $$METATYPETESTS qtConfig(process) { - !contains(QT_CONFIG, no-qml-debug): SUBDIRS += debugger +# !contains(QT_CONFIG, no-qml-debug): SUBDIRS += debugger !boot2qt { SUBDIRS += qmllint qmlplugindump } diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index e75e51ed29..cdc9f29aab 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -30,10 +30,9 @@ #include <private/qv4compileddata_p.h> #include <private/qv4compiler_p.h> -#include <private/qv4jsir_p.h> -#include <private/qv4isel_p.h> #include <private/qv8engine_p.h> #include <private/qv4engine_p.h> +#include <private/qv4codegen_p.h> #include <QQmlComponent> #include <QQmlEngine> #include <QQmlFileSelector> @@ -174,9 +173,8 @@ struct TestCompiler bool verify() { - QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine); - QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit = v4->iselFactory->createUnitForLoading(); - return unit->loadFromDisk(QUrl::fromLocalFile(testFilePath), QFileInfo(testFilePath).lastModified(), v4->iselFactory.data(), &lastErrorString); + QQmlRefPointer<QV4::CompiledData::CompilationUnit> unit = QV4::Compiler::Codegen::createUnitForLoading(); + return unit->loadFromDisk(QUrl::fromLocalFile(testFilePath), QFileInfo(testFilePath).lastModified(), &lastErrorString); } void closeMapping() @@ -231,12 +229,14 @@ 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); + QCOMPARE(testUnit->stringAt(bindingFunction->nameIndex), QString("expression for blah")); // check if we have the correct function + QVERIFY(bindingFunction->codeSize > 0); + QVERIFY(bindingFunction->codeOffset < testUnit->unitSize); } { @@ -257,10 +257,12 @@ 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); + QCOMPARE(testUnit->stringAt(bindingFunction->nameIndex), QString("expression for blah")); // check if we have the correct function + QVERIFY(bindingFunction->codeSize > 0); + QVERIFY(bindingFunction->codeOffset < testUnit->unitSize); } } @@ -364,7 +366,7 @@ void tst_qmldiskcache::basicVersionChecks() }); QVERIFY(!testCompiler.verify()); - QCOMPARE(testCompiler.lastErrorString, QString::fromUtf8("Code generator mismatch. Found code generated by but expected %1").arg(QV8Engine::getV4(&engine)->iselFactory->codeGeneratorName)); + QCOMPARE(testCompiler.lastErrorString, QString::fromUtf8("Code generator mismatch. Found code generated by but expected %1").arg(QStringLiteral("moth"))); } } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 35f1534478..899f14b51d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -43,6 +43,7 @@ #include "../../shared/util.h" #include <private/qv4functionobject_p.h> #include <private/qv4scopedvalue_p.h> +#include <private/qv4jscall_p.h> #include <private/qv4alloca_p.h> #include <private/qv4runtime_p.h> #include <private/qv4object_p.h> @@ -342,6 +343,7 @@ private slots: void freeze_empty_object(); void singleBlockLoops(); void qtbug_60547(); + void delayLoadingArgs(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -2338,7 +2340,7 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::Value &o, const QLatin1String(source) + QLatin1String(" })"); QV4::Scope scope(QV8Engine::getV4(engine)); - QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), functionSource); + QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), QV4::Compiler::EvalCode, functionSource); program.inheritContext = true; QV4::ScopedFunctionObject function(scope, program.run()); @@ -2346,10 +2348,10 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::Value &o, const scope.engine->catchException(); return true; } - QV4::ScopedCallData d(scope, 1); - d->args[0] = o; - d->thisObject = engine->global(); - function->call(scope, d); + QV4::JSCall jsCall(scope, function, 1); + jsCall->args[0] = o; + jsCall->thisObject = engine->global(); + jsCall.call(); if (scope.engine->hasException) { scope.engine->catchException(); return true; @@ -2364,7 +2366,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::Value &o, QLatin1String(source) + QLatin1String(" })"); QV4::Scope scope(QV8Engine::getV4(engine)); - QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), functionSource); + QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), QV4::Compiler::EvalCode, functionSource); program.inheritContext = true; QV4::ScopedFunctionObject function(scope, program.run()); @@ -2375,15 +2377,16 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::Value &o, if (!function) return false; - QV4::ScopedCallData d(scope, 1); - d->args[0] = o; - d->thisObject = engine->global(); - function->call(scope, d); + QV4::ScopedValue value(scope); + QV4::JSCall jsCall(scope, function, 1); + jsCall->args[0] = o; + jsCall->thisObject = engine->global(); + value = jsCall.call(); if (scope.engine->hasException) { scope.engine->catchException(); return false; } - return QV4::Runtime::method_strictEqual(scope.result, result); + return QV4::Runtime::method_strictEqual(value, result); } static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::Value &o, @@ -2394,7 +2397,7 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::Value &o QV4::Scope scope(QV8Engine::getV4(engine)); - QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), functionSource); + QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), QV4::Compiler::EvalCode, functionSource); program.inheritContext = true; QV4::ScopedFunctionObject function(scope, program.run()); @@ -2404,15 +2407,15 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::Value &o } if (!function) return QV4::Encode::undefined(); - QV4::ScopedCallData d(scope, 1); - d->args[0] = o; - d->thisObject = engine->global(); - function->call(scope, d); + QV4::JSCall jsCall(scope, function, 1); + jsCall->args[0] = o; + jsCall->thisObject = engine->global(); + QV4::ScopedValue result(scope, jsCall.call()); if (scope.engine->hasException) { scope.engine->catchException(); return QV4::Encode::undefined(); } - return scope.result.asReturnedValue(); + return result->asReturnedValue(); } #define EVALUATE_ERROR(source) evaluate_error(engine, object, source) @@ -8365,6 +8368,13 @@ void tst_qqmlecmascript::qtbug_60547() QCOMPARE(object->property("counter"), QVariant(int(1))); } +void tst_qqmlecmascript::delayLoadingArgs() +{ + QJSEngine engine; + QJSValue ret = engine.evaluate("(function(x){return x + (x+=2)})(20)"); + QCOMPARE(ret.toInt(), 42); // esp. not 44. +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" diff --git a/tests/manual/v4/fact.2.js b/tests/manual/v4/fact.2.js index d8f750b5a1..1696e8b80d 100644 --- a/tests/manual/v4/fact.2.js +++ b/tests/manual/v4/fact.2.js @@ -3,6 +3,6 @@ function fact(n) { return n > 1 ? n * fact(n - 1) : 1 } -for (var i = 0; i < 1000000; i = i + 1) +for (var i = 0; i < 100000; i = i + 1) fact(12) |