From ae6f850ab50bfe07625df4f810c7bf975c224877 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 7 Nov 2018 10:38:09 +0100 Subject: Generate lookups into the global object more aggressively Since change 9333ea8649838d7e0400b0e94c8cbd4fa5d216b0, we lookup properties in the QML context object before the global object to have proper scoping rules for QML. Unfortunately this lead to a performance regression when using global properties such as Math in imported script files, as the lookup would always go through the qml context first. This can be fixed, as we know that the global object is frozen in qml mode, and the standard names of properties in the global object are illegal to use in QML. So simply check for those names in the code generator and create lookups into the global object for those. Change-Id: I4b2089178c9e5f9440abdfd834cf7d92c3c0e2c3 Fixes: QTBUG-71591 Reviewed-by: Erik Verbruggen --- src/qml/jsruntime/qv4script.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 951675b468..3d8c037910 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -241,6 +241,7 @@ Script *Script::createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlCo QmlIR::Document::removeScriptPragmas(sourceCode); auto result = new QV4::Script(engine, qmlContext, sourceCode, originalUrl.toString()); + result->contextType = QV4::Compiler::ContextType::ScriptImportedByQML; result->parse(); return result; } -- cgit v1.2.3 From ec290770ff56791a62fde6f532e1b38e80f5b9bd Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Fri, 16 Nov 2018 14:43:48 +0100 Subject: Initialize Qt_AllocaWrapper allocation with zeroes YarrJIT generated ASM assumes the data to be zeroed. In the wrapper we allocate from heap where there can be random data. It needs to be initialized to zero. Task-number: QTBUG-71663 Change-Id: I67c04e7b6d4bf4b92124aedc4f7bcfdc1a43c833 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4alloca_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/jsruntime') diff --git a/src/qml/jsruntime/qv4alloca_p.h b/src/qml/jsruntime/qv4alloca_p.h index 1e9f83a90e..65c3e4d65a 100644 --- a/src/qml/jsruntime/qv4alloca_p.h +++ b/src/qml/jsruntime/qv4alloca_p.h @@ -89,7 +89,7 @@ public: Qt_AllocaWrapper() { m_data = 0; } ~Qt_AllocaWrapper() { free(m_data); } void *data() { return m_data; } - void allocate(int size) { m_data = malloc(size); } + void allocate(int size) { m_data = malloc(size); memset(m_data, 0, size); } private: void *m_data; }; -- cgit v1.2.3