Merge "Merge remote-tracking branch 'origin/5.8' into dev" into refs/staging/dev

This commit is contained in:
Liang Qi 2016-12-14 08:15:56 +00:00 committed by The Qt Project
commit ed32558d62
19 changed files with 1358 additions and 1254 deletions

View File

@ -1052,8 +1052,11 @@ ID3D12Resource *QSGD3D12EnginePrivate::createColorBuffer(D3D12_CPU_DESCRIPTOR_HA
rtDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
ID3D12Resource *resource = nullptr;
const D3D12_RESOURCE_STATES initialState = samples <= 1
? D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE
: D3D12_RESOURCE_STATE_RENDER_TARGET;
if (FAILED(device->CreateCommittedResource(&heapProp, D3D12_HEAP_FLAG_NONE, &rtDesc,
D3D12_RESOURCE_STATE_RENDER_TARGET, &clearValue, IID_PPV_ARGS(&resource)))) {
initialState, &clearValue, IID_PPV_ARGS(&resource)))) {
qWarning("Failed to create offscreen render target of size %dx%d", size.width(), size.height());
return nullptr;
}

View File

@ -397,7 +397,7 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory
return false;
}
const QString sourcePath = url.toLocalFile();
const QString sourcePath = QQmlFile::urlToLocalFileOrQrc(url);
QScopedPointer<CompilationUnitMapper> cacheFile(new CompilationUnitMapper());
CompiledData::Unit *mappedUnit = cacheFile->open(cacheFilePath(url), sourcePath, errorString);

View File

@ -147,7 +147,7 @@ public:
QQmlEngine *qmlEngine() const;
#else // !V4_BOOTSTRAP
QJSEngine *jsEngine() const { return v8Engine->publicEngine(); }
QQmlEngine *qmlEngine() const { return v8Engine->engine(); }
QQmlEngine *qmlEngine() const { return v8Engine ? v8Engine->engine() : nullptr; }
#endif // V4_BOOTSTRAP
QV8Engine *v8Engine;

View File

@ -1259,7 +1259,7 @@ ReturnedValue Runtime::method_unwindException(ExecutionEngine *engine)
*
* Instead the push/pop pair acts as a non local scope.
*/
void Runtime::method_pushWithScope(const Value &o, ExecutionEngine *engine)
void Runtime::method_pushWithScope(const Value &o, NoThrowEngine *engine)
{
engine->pushContext(engine->currentContext->newWithContext(o.toObject(engine)));
Q_ASSERT(engine->jsStackTop == engine->currentContext + 2);
@ -1272,7 +1272,7 @@ void Runtime::method_pushCatchScope(NoThrowEngine *engine, int exceptionVarNameI
Q_ASSERT(engine->jsStackTop == engine->currentContext + 2);
}
void Runtime::method_popScope(ExecutionEngine *engine)
void Runtime::method_popScope(NoThrowEngine *engine)
{
Q_ASSERT(engine->jsStackTop == engine->currentContext + 2);
engine->popContext();

View File

@ -63,11 +63,6 @@ template <typename T>
struct ExceptionCheck {
enum { NeedsCheck = 1 };
};
// push_catch and pop context methods shouldn't check for exceptions
template <>
struct ExceptionCheck<void (*)(QV4::ExecutionEngine *)> {
enum { NeedsCheck = 0 };
};
template <typename A>
struct ExceptionCheck<void (*)(A, QV4::NoThrowEngine)> {
enum { NeedsCheck = 0 };
@ -244,9 +239,9 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
// exceptions & scopes
RUNTIME_METHOD(void, throwException, (ExecutionEngine *engine, const Value &value));
RUNTIME_METHOD(ReturnedValue, unwindException, (ExecutionEngine *engine));
RUNTIME_METHOD(void, pushWithScope, (const Value &o, ExecutionEngine *engine));
RUNTIME_METHOD(void, pushWithScope, (const Value &o, NoThrowEngine *engine));
RUNTIME_METHOD(void, pushCatchScope, (NoThrowEngine *engine, int exceptionVarNameIndex));
RUNTIME_METHOD(void, popScope, (ExecutionEngine *engine));
RUNTIME_METHOD(void, popScope, (NoThrowEngine *engine));
// closures
RUNTIME_METHOD(ReturnedValue, closure, (ExecutionEngine *engine, int functionId));

View File

@ -662,13 +662,13 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(CallBuiltinPushCatchScope)
MOTH_BEGIN_INSTR(CallBuiltinPushScope)
engine->runtime.pushWithScope(VALUE(instr.arg), engine);
engine->runtime.pushWithScope(VALUE(instr.arg), static_cast<QV4::NoThrowEngine*>(engine));
context = engine->currentContext;
CHECK_EXCEPTION;
MOTH_END_INSTR(CallBuiltinPushScope)
MOTH_BEGIN_INSTR(CallBuiltinPopScope)
engine->runtime.popScope(engine);
engine->runtime.popScope(static_cast<QV4::NoThrowEngine*>(engine));
context = engine->currentContext;
MOTH_END_INSTR(CallBuiltinPopScope)

View File

@ -5,27 +5,33 @@
--
-- This file is part of the QtQml module of the Qt Toolkit.
--
-- $QT_BEGIN_LICENSE:LGPL21$
-- $QT_BEGIN_LICENSE:LGPL$
-- Commercial License Usage
-- Licensees holding valid commercial Qt licenses may use this file in
-- accordance with the commercial license agreement provided with the
-- Software or, alternatively, in accordance with the terms contained in
-- a written agreement between you and The Qt Company. For licensing terms
-- and conditions see http://www.qt.io/terms-conditions. For further
-- information use the contact form at http://www.qt.io/contact-us.
-- and conditions see https://www.qt.io/terms-conditions. For further
-- information use the contact form at https://www.qt.io/contact-us.
--
-- GNU Lesser General Public License Usage
-- Alternatively, this file may be used under the terms of the GNU Lesser
-- General Public License version 2.1 or version 3 as published by the Free
-- Software Foundation and appearing in the file LICENSE.LGPLv21 and
-- LICENSE.LGPLv3 included in the packaging of this file. Please review the
-- following information to ensure the GNU Lesser General Public License
-- requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-- http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-- General Public License version 3 as published by the Free Software
-- Foundation and appearing in the file LICENSE.LGPL3 included in the
-- packaging of this file. Please review the following information to
-- ensure the GNU Lesser General Public License version 3 requirements
-- will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
--
-- As a special exception, The Qt Company gives you certain additional
-- rights. These rights are described in The Qt Company LGPL Exception
-- version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-- GNU General Public License Usage
-- Alternatively, this file may be used under the terms of the GNU
-- General Public License version 2.0 or (at your option) the GNU General
-- Public license version 3 or any later version approved by the KDE Free
-- Qt Foundation. The licenses are as published by the Free Software
-- Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-- included in the packaging of this file. Please review the following
-- information to ensure the GNU General Public License requirements will
-- be met: https://www.gnu.org/licenses/gpl-2.0.html and
-- https://www.gnu.org/licenses/gpl-3.0.html.
--
-- $QT_END_LICENSE$
--
@ -136,6 +142,57 @@
**
****************************************************************************/
#include "qqmljsengine_p.h"
#include "qqmljslexer_p.h"
#include "qqmljsast_p.h"
#include "qqmljsmemorypool_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qcoreapplication.h>
#include <string.h>
./
/:/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
@ -273,7 +330,7 @@ public:
inline DiagnosticMessage diagnosticMessage() const
{
foreach (const DiagnosticMessage &d, diagnostic_messages) {
for (const DiagnosticMessage &d : diagnostic_messages) {
if (d.kind != DiagnosticMessage::Warning)
return d;
}
@ -969,6 +1026,23 @@ case $rule_number: {
} break;
./
UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_DEFAULT T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = new (pool) AST::UiPublicMember(stringRef(5), stringRef(7));
node->isDefaultMember = true;
node->defaultToken = loc(1);
node->typeModifier = stringRef(3);
node->propertyToken = loc(2);
node->typeModifierToken = loc(2);
node->typeToken = loc(4);
node->identifierToken = loc(7);
node->semicolonToken = loc(8);
sym(1).Node = node;
} break;
./
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON UiScriptStatement ;
/.
case $rule_number: {
@ -3003,7 +3077,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ;
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
//const QString msg = qApp->translate("QQmlParser", "Missing `;'");
//const QString msg = QCoreApplication::translate("QQmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];

File diff suppressed because it is too large Load Diff

View File

@ -167,15 +167,15 @@ public:
T_XOR = 79,
T_XOR_EQ = 80,
ACCEPT_STATE = 665,
RULE_COUNT = 358,
STATE_COUNT = 666,
ACCEPT_STATE = 672,
RULE_COUNT = 360,
STATE_COUNT = 673,
TERMINAL_COUNT = 106,
NON_TERMINAL_COUNT = 111,
GOTO_INDEX_OFFSET = 666,
GOTO_INFO_OFFSET = 3018,
GOTO_CHECK_OFFSET = 3018
GOTO_INDEX_OFFSET = 673,
GOTO_INFO_OFFSET = 3185,
GOTO_CHECK_OFFSET = 3185
};
static const char *const spell [];

File diff suppressed because it is too large Load Diff

View File

@ -246,9 +246,9 @@ protected:
#define J_SCRIPT_REGEXPLITERAL_RULE1 88
#define J_SCRIPT_REGEXPLITERAL_RULE1 90
#define J_SCRIPT_REGEXPLITERAL_RULE2 89
#define J_SCRIPT_REGEXPLITERAL_RULE2 91
QT_QML_END_NAMESPACE

View File

@ -443,7 +443,7 @@ The following functions are also on the Qt object.
\li \c "osx" - \macos
\li \c "unix" - Other Unix-based OS
\li \c "windows" - Windows
\li \c "winrt" - Windows Runtime
\li \c "winrt" - WinRT / UWP
\li \c "winphone" - Windows Phone
\endlist
\endtable

View File

@ -166,7 +166,7 @@ struct ConsoleObject : Object
};
struct GlobalExtensions {
struct Q_QML_PRIVATE_EXPORT GlobalExtensions {
static void init(Object *globalObject, QJSEngine::Extensions extensions);
#ifndef QT_NO_TRANSLATION

View File

@ -549,7 +549,6 @@ void tst_qmldiskcache::cacheResources()
{
CleanlyLoadingComponent component(&engine, QUrl("qrc:/test.qml"));
qDebug() << component.errorString();
QScopedPointer<QObject> obj(component.create());
QVERIFY(!obj.isNull());
QCOMPARE(obj->property("value").toInt(), 20);
@ -558,12 +557,36 @@ void tst_qmldiskcache::cacheResources()
const QStringList entries = QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files);
QCOMPARE(entries.count(), 1);
QDateTime cacheFileTimeStamp;
{
QFile cacheFile(qmlCacheDirectory + QLatin1Char('/') + entries.constFirst());
QVERIFY2(cacheFile.open(QIODevice::ReadOnly), qPrintable(cacheFile.errorString()));
QV4::CompiledData::Unit unit;
QVERIFY(cacheFile.read(reinterpret_cast<char *>(&unit), sizeof(unit)) == sizeof(unit));
QCOMPARE(qint64(unit.sourceTimeStamp), QFileInfo(QCoreApplication::applicationFilePath()).lastModified().toMSecsSinceEpoch());
cacheFileTimeStamp = QFileInfo(cacheFile.fileName()).lastModified();
QDateTime referenceTimeStamp = QFileInfo(":/test.qml").lastModified();
if (!referenceTimeStamp.isValid())
referenceTimeStamp = QFileInfo(QCoreApplication::applicationFilePath()).lastModified();
QCOMPARE(qint64(unit.sourceTimeStamp), referenceTimeStamp.toMSecsSinceEpoch());
}
waitForFileSystem();
{
CleanlyLoadingComponent component(&engine, QUrl("qrc:///test.qml"));
QScopedPointer<QObject> obj(component.create());
QVERIFY(!obj.isNull());
QCOMPARE(obj->property("value").toInt(), 20);
}
{
const QStringList entries = QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files);
QCOMPARE(entries.count(), 1);
QCOMPARE(QFileInfo(qmlCacheDirectory + QLatin1Char('/') + entries.constFirst()).lastModified().toMSecsSinceEpoch(), cacheFileTimeStamp.toMSecsSinceEpoch());
}
}

View File

@ -0,0 +1,5 @@
import QtQml 2.0
QtObject {
default property list<QtObject> myChildren;
}

View File

@ -0,0 +1,6 @@
import QtQml 2.0
QtObjectWithChildren {
QtObject {
}
}

View File

@ -254,6 +254,8 @@ private slots:
void arrayBuffer_data();
void arrayBuffer();
void defaultListProperty();
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@ -4233,6 +4235,13 @@ void tst_qqmllanguage::arrayBuffer()
QCOMPARE(object->property("ok").toBool(), true);
}
void tst_qqmllanguage::defaultListProperty()
{
QQmlComponent component(&engine, testFileUrl("defaultListProperty.qml"));
VERIFY_ERRORS(0);
QScopedPointer<QObject> o(component.create());
}
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"

View File

@ -521,7 +521,8 @@ int main(int argc, char *argv[])
std::cerr << "-importPath requires an argument\n";
argReceiver = &qmlImportPaths;
} else {
std::cerr << "Invalid argument: \"" << qPrintable(arg) << "\"\n";
std::cerr << qPrintable(appName) << ": Invalid argument: \""
<< qPrintable(arg) << "\"\n";
return 1;
}
@ -531,7 +532,8 @@ int main(int argc, char *argv[])
break;
++i;
if (!QFile::exists(arg)) {
std::cerr << "No such file or directory: \"" << qPrintable(arg) << "\"\n";
std::cerr << qPrintable(appName) << ": No such file or directory: \""
<< qPrintable(arg) << "\"\n";
return 1;
} else {
*argReceiver += arg;

View File

@ -42,6 +42,7 @@
#include "private/qv4context_p.h"
#include "private/qv4script_p.h"
#include "private/qv4string_p.h"
#include "private/qqmlbuiltinfunctions_p.h"
#ifdef V4_ENABLE_JIT
# include "private/qv4isel_masm_p.h"
@ -60,57 +61,6 @@ QT_REQUIRE_CONFIG(qml_interpreter);
#include <iostream>
namespace builtins {
using namespace QV4;
struct Print: FunctionObject
{
struct Data : Heap::FunctionObject {
void init(ExecutionContext *scope)
{
Heap::FunctionObject::init(scope, QStringLiteral("print"));
}
};
V4_OBJECT(FunctionObject)
static void call(const Managed *, Scope &scope, CallData *callData)
{
for (int i = 0; i < callData->argc; ++i) {
QString s = callData->args[i].toQStringNoThrow();
if (i)
std::cout << ' ';
std::cout << qPrintable(s);
}
std::cout << std::endl;
scope.result = Encode::undefined();
}
};
DEFINE_OBJECT_VTABLE(Print);
struct GC: public FunctionObject
{
struct Data : Heap::FunctionObject {
void init(ExecutionContext *scope)
{
Heap::FunctionObject::init(scope, QStringLiteral("gc"));
}
};
V4_OBJECT(FunctionObject)
static void call(const Managed *m, Scope &scope, CallData *)
{
static_cast<const GC *>(m)->engine()->memoryManager->runGC();
scope.result = Encode::undefined();
}
};
DEFINE_OBJECT_VTABLE(GC);
} // builtins
static void showException(QV4::ExecutionContext *ctx, const QV4::Value &exception, const QV4::StackTrace &trace)
{
QV4::Scope scope(ctx);
@ -200,10 +150,7 @@ int main(int argc, char *argv[])
QV4::Scope scope(&vm);
QV4::ScopedContext ctx(scope, vm.rootContext());
QV4::ScopedObject print(scope, vm.memoryManager->allocObject<builtins::Print>(vm.rootContext()));
vm.globalObject->put(QV4::ScopedString(scope, vm.newIdentifier(QStringLiteral("print"))).getPointer(), print);
QV4::ScopedObject gc(scope, vm.memoryManager->allocObject<builtins::GC>(ctx));
vm.globalObject->put(QV4::ScopedString(scope, vm.newIdentifier(QStringLiteral("gc"))).getPointer(), gc);
QV4::GlobalExtensions::init(vm.globalObject, QJSEngine::ConsoleExtension | QJSEngine::GarbageCollectionExtension);
for (const QString &fn : qAsConst(args)) {
QFile file(fn);