Merge lp:~timo-jyrinki/kubuntu-packaging/qtdeclarative_cherrypickpatches into lp:~kubuntu-packagers/kubuntu-packaging/qtdeclarative-opensource-src

Proposed by Timo Jyrinki
Status: Merged
Merged at revision: 138
Proposed branch: lp:~timo-jyrinki/kubuntu-packaging/qtdeclarative_cherrypickpatches
Merge into: lp:~kubuntu-packagers/kubuntu-packaging/qtdeclarative-opensource-src
Diff against target: 608 lines (+522/-34)
8 files modified
debian/changelog (+14/-0)
debian/patches/Don-t-crash-on-Runtime-getQmlImportedScripts.patch (+42/-0)
debian/patches/Don-t-use-ebx-in-the-x86-register-allocator.patch (+0/-33)
debian/patches/Fix-global-object-handling-in-worker-script-JS-files.patch (+265/-0)
debian/patches/V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch (+47/-0)
debian/patches/V4-fix-range-sorting.patch (+46/-0)
debian/patches/V4-regalloc-fix-interval-splitting-when-register-pre.patch (+103/-0)
debian/patches/series (+5/-1)
To merge this branch: bzr merge lp:~timo-jyrinki/kubuntu-packaging/qtdeclarative_cherrypickpatches
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Timo Jyrinki Approve
Review via email: mp+212351@code.launchpad.net

Commit message

* debian/patches/Don-t-crash-on-Runtime-getQmlImportedScripts.patch
  - Backport from upstream code submittal (LP: #1294181)
* debian/patches/Fix-global-object-handling-in-worker-script-JS-files.patch
  - Backport a fix from upstream (LP: #1294019)
* debian/patches/V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch
  debian/patches/V4-fix-range-sorting.patch
  debian/patches/V4-regalloc-fix-interval-splitting-when-register-pre.patch
  - Replace Don-t-use-ebx-in-the-x86-register-allocator.patch with a newer
    set of fixes from upstream (LP: #1271033)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-03-14 09:39:06 +0000
3+++ debian/changelog 2014-03-24 06:36:21 +0000
4@@ -1,3 +1,17 @@
5+qtdeclarative-opensource-src (5.2.1-3ubuntu11) trusty; urgency=medium
6+
7+ * debian/patches/Don-t-crash-on-Runtime-getQmlImportedScripts.patch
8+ - Backport from upstream code submittal (LP: #1294181)
9+ * debian/patches/Fix-global-object-handling-in-worker-script-JS-files.patch
10+ - Backport a fix from upstream (LP: #1294019)
11+ * debian/patches/V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch
12+ debian/patches/V4-fix-range-sorting.patch
13+ debian/patches/V4-regalloc-fix-interval-splitting-when-register-pre.patch
14+ - Replace Don-t-use-ebx-in-the-x86-register-allocator.patch with a newer
15+ set of fixes from upstream (LP: #1271033)
16+
17+ -- Timo Jyrinki <timo-jyrinki@ubuntu.com> Mon, 24 Mar 2014 06:27:18 +0000
18+
19 qtdeclarative-opensource-src (5.2.1-3ubuntu10) trusty; urgency=medium
20
21 * debian/patches/Fix-crash-when-appending-arrays-to-sub-models-in-lis.patch
22
23=== added file 'debian/patches/Don-t-crash-on-Runtime-getQmlImportedScripts.patch'
24--- debian/patches/Don-t-crash-on-Runtime-getQmlImportedScripts.patch 1970-01-01 00:00:00 +0000
25+++ debian/patches/Don-t-crash-on-Runtime-getQmlImportedScripts.patch 2014-03-24 06:36:21 +0000
26@@ -0,0 +1,42 @@
27+From b4f14b1942698dea537bb08222907db56575a906 Mon Sep 17 00:00:00 2001
28+From: Albert Astals Cid <albert.astals@canonical.com>
29+Date: Thu, 20 Mar 2014 16:28:15 +0100
30+Subject: [PATCH] Don't crash on Runtime::getQmlImportedScripts
31+
32+Task-number: QTBUG-37303
33+
34+Change-Id: I083ca0cc3223fe0dbf1c768ad43a0d4927579867
35+---
36+ src/qml/jsruntime/qv4runtime.cpp | 4 +++
37+ tests/auto/qml/qqmlecmascript/data/Types.js | 3 ++
38+ ...rtedScriptsAccessOnObjectWithInvalidContext.qml | 42 ++++++++++++++++++++++
39+ .../auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 11 ++++++
40+ 4 files changed, 60 insertions(+)
41+ create mode 100644 tests/auto/qml/qqmlecmascript/data/Types.js
42+ create mode 100644 tests/auto/qml/qqmlecmascript/data/importedScriptsAccessOnObjectWithInvalidContext.qml
43+
44+diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
45+index 2b63632..99b7d98 100644
46+--- a/src/qml/jsruntime/qv4runtime.cpp
47++++ b/src/qml/jsruntime/qv4runtime.cpp
48+@@ -1245,6 +1245,8 @@ ReturnedValue __qmljs_get_id_array(NoThrowContext *ctx)
49+ ReturnedValue __qmljs_get_context_object(NoThrowContext *ctx)
50+ {
51+ QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine);
52++ if (!context)
53++ return Encode::undefined();
54+ return QObjectWrapper::wrap(ctx->engine, context->contextObject);
55+ }
56+
57+@@ -1292,6 +1294,8 @@ void __qmljs_set_qobject_property(ExecutionContext *ctx, const ValueRef object,
58+ ReturnedValue __qmljs_get_imported_scripts(NoThrowContext *ctx)
59+ {
60+ QQmlContextData *context = QmlContextWrapper::callingContext(ctx->engine);
61++ if (!context)
62++ return Encode::undefined();
63+ return context->importedScripts.value();
64+ }
65+
66+--
67+1.9.0
68+
69
70=== removed file 'debian/patches/Don-t-use-ebx-in-the-x86-register-allocator.patch'
71--- debian/patches/Don-t-use-ebx-in-the-x86-register-allocator.patch 2014-01-24 09:11:04 +0000
72+++ debian/patches/Don-t-use-ebx-in-the-x86-register-allocator.patch 1970-01-01 00:00:00 +0000
73@@ -1,33 +0,0 @@
74-From 81478579982bc33c785866998f88c3aa0d362c03 Mon Sep 17 00:00:00 2001
75-From: Albert Astals Cid <albert.astals@canonical.com>
76-Date: Thu, 23 Jan 2014 13:15:08 +0100
77-Subject: [PATCH] Don't use ebx in the x86 register allocator
78-
79-ebx is mentioned as one of the registers you can't freely use
80-in the various assembly literature, so if we do we may end up upsetting
81-the compiler
82-
83-Task-number: QTBUG-36289
84-
85-Change-Id: I09000a02286dbc62fc3b7905c770b1cfa6de76a1
86----
87- src/qml/compiler/qv4isel_masm.cpp | 3 +--
88- 1 file changed, 1 insertion(+), 2 deletions(-)
89-
90-diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
91-index 35097ba..5750e05 100644
92---- a/src/qml/compiler/qv4isel_masm.cpp
93-+++ b/src/qml/compiler/qv4isel_masm.cpp
94-@@ -569,8 +569,7 @@ void InstructionSelection::run(int functionIndex)
95- if (opt.isInSSA() && withRegisterAllocator) {
96- #if CPU(X86) && OS(LINUX) // x86 with linux
97- static const QVector<int> intRegisters = QVector<int>()
98-- << JSC::X86Registers::edx
99-- << JSC::X86Registers::ebx;
100-+ << JSC::X86Registers::edx;
101- #else // x86_64 with linux or with macos
102- static const QVector<int> intRegisters = QVector<int>()
103- << JSC::X86Registers::edi
104---
105-1.8.5.3
106-
107
108=== added file 'debian/patches/Fix-global-object-handling-in-worker-script-JS-files.patch'
109--- debian/patches/Fix-global-object-handling-in-worker-script-JS-files.patch 1970-01-01 00:00:00 +0000
110+++ debian/patches/Fix-global-object-handling-in-worker-script-JS-files.patch 2014-03-24 06:36:21 +0000
111@@ -0,0 +1,265 @@
112+From 9999479b269f685373ceb20d42ff7e5955ba9f63 Mon Sep 17 00:00:00 2001
113+From: Michael Brasser <michael.brasser@jollamobile.com>
114+Date: Mon, 17 Feb 2014 09:35:20 -0600
115+Subject: [PATCH] Fix global object handling in worker script JS files.
116+
117+Task-number: QTBUG-36874
118+Task-number: QTBUG-36881
119+Change-Id: Iacf4807dd37862e792ad1ba4ce540a6d48f1e495
120+---
121+ src/qml/qml/qqmlcontextwrapper.cpp | 14 ++--
122+ .../qml/qquickworkerscript/data/script_function.js | 8 +++
123+ .../qml/qquickworkerscript/data/script_global.js | 5 ++
124+ .../qml/qquickworkerscript/data/script_global2.js | 6 ++
125+ .../auto/qml/qquickworkerscript/data/script_var.js | 6 ++
126+ .../qquickworkerscript/data/worker_function.qml | 5 ++
127+ .../qml/qquickworkerscript/data/worker_global.qml | 5 ++
128+ .../qml/qquickworkerscript/data/worker_global2.qml | 5 ++
129+ .../qml/qquickworkerscript/data/worker_var.qml | 5 ++
130+ .../qquickworkerscript/tst_qquickworkerscript.cpp | 83 +++++++++++++++++++++-
131+ 10 files changed, 134 insertions(+), 8 deletions(-)
132+ create mode 100644 tests/auto/qml/qquickworkerscript/data/script_function.js
133+ create mode 100644 tests/auto/qml/qquickworkerscript/data/script_global.js
134+ create mode 100644 tests/auto/qml/qquickworkerscript/data/script_global2.js
135+ create mode 100644 tests/auto/qml/qquickworkerscript/data/script_var.js
136+ create mode 100644 tests/auto/qml/qquickworkerscript/data/worker_function.qml
137+ create mode 100644 tests/auto/qml/qquickworkerscript/data/worker_global.qml
138+ create mode 100644 tests/auto/qml/qquickworkerscript/data/worker_global2.qml
139+ create mode 100644 tests/auto/qml/qquickworkerscript/data/worker_var.qml
140+
141+diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
142+index 1ca9c6a..d221e07 100644
143+--- a/src/qml/qml/qqmlcontextwrapper.cpp
144++++ b/src/qml/qml/qqmlcontextwrapper.cpp
145+@@ -288,6 +288,13 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
146+ return;
147+ }
148+
149++ PropertyAttributes attrs;
150++ Property *pd = wrapper->__getOwnProperty__(name, &attrs);
151++ if (pd) {
152++ wrapper->putValue(pd, attrs, value);
153++ return;
154++ }
155++
156+ if (wrapper->isNullWrapper) {
157+ if (wrapper && wrapper->readOnly) {
158+ QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
159+@@ -301,13 +308,6 @@ void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef val
160+ return;
161+ }
162+
163+- PropertyAttributes attrs;
164+- Property *pd = wrapper->__getOwnProperty__(name, &attrs);
165+- if (pd) {
166+- wrapper->putValue(pd, attrs, value);
167+- return;
168+- }
169+-
170+ // Its possible we could delay the calculation of the "actual" context (in the case
171+ // of sub contexts) until it is definately needed.
172+ QQmlContextData *context = wrapper->getContext();
173+diff --git a/tests/auto/qml/qquickworkerscript/data/script_function.js b/tests/auto/qml/qquickworkerscript/data/script_function.js
174+new file mode 100644
175+index 0000000..c0391dd
176+--- /dev/null
177++++ b/tests/auto/qml/qquickworkerscript/data/script_function.js
178+@@ -0,0 +1,8 @@
179++function func() {
180++ return "World"
181++}
182++
183++WorkerScript.onMessage = function(msg) {
184++ WorkerScript.sendMessage(msg + " " + func())
185++}
186++
187+diff --git a/tests/auto/qml/qquickworkerscript/data/script_global.js b/tests/auto/qml/qquickworkerscript/data/script_global.js
188+new file mode 100644
189+index 0000000..cce4f2c
190+--- /dev/null
191++++ b/tests/auto/qml/qquickworkerscript/data/script_global.js
192+@@ -0,0 +1,5 @@
193++WorkerScript.onMessage = function(msg) {
194++ world = "World"
195++ WorkerScript.sendMessage(msg + " " + world)
196++}
197++
198+diff --git a/tests/auto/qml/qquickworkerscript/data/script_global2.js b/tests/auto/qml/qquickworkerscript/data/script_global2.js
199+new file mode 100644
200+index 0000000..0867f7e
201+--- /dev/null
202++++ b/tests/auto/qml/qquickworkerscript/data/script_global2.js
203+@@ -0,0 +1,6 @@
204++world = "World"
205++
206++WorkerScript.onMessage = function(msg) {
207++ WorkerScript.sendMessage(msg + " " + world)
208++}
209++
210+diff --git a/tests/auto/qml/qquickworkerscript/data/script_var.js b/tests/auto/qml/qquickworkerscript/data/script_var.js
211+new file mode 100644
212+index 0000000..77107e8
213+--- /dev/null
214++++ b/tests/auto/qml/qquickworkerscript/data/script_var.js
215+@@ -0,0 +1,6 @@
216++var world = "World"
217++
218++WorkerScript.onMessage = function(msg) {
219++ WorkerScript.sendMessage(msg + " " + world)
220++}
221++
222+diff --git a/tests/auto/qml/qquickworkerscript/data/worker_function.qml b/tests/auto/qml/qquickworkerscript/data/worker_function.qml
223+new file mode 100644
224+index 0000000..f8d01dc
225+--- /dev/null
226++++ b/tests/auto/qml/qquickworkerscript/data/worker_function.qml
227+@@ -0,0 +1,5 @@
228++import QtQuick 2.0
229++
230++BaseWorker {
231++ source: "script_function.js"
232++}
233+diff --git a/tests/auto/qml/qquickworkerscript/data/worker_global.qml b/tests/auto/qml/qquickworkerscript/data/worker_global.qml
234+new file mode 100644
235+index 0000000..546afd2
236+--- /dev/null
237++++ b/tests/auto/qml/qquickworkerscript/data/worker_global.qml
238+@@ -0,0 +1,5 @@
239++import QtQuick 2.0
240++
241++BaseWorker {
242++ source: "script_global.js"
243++}
244+diff --git a/tests/auto/qml/qquickworkerscript/data/worker_global2.qml b/tests/auto/qml/qquickworkerscript/data/worker_global2.qml
245+new file mode 100644
246+index 0000000..42cad38
247+--- /dev/null
248++++ b/tests/auto/qml/qquickworkerscript/data/worker_global2.qml
249+@@ -0,0 +1,5 @@
250++import QtQuick 2.0
251++
252++BaseWorker {
253++ source: "script_global2.js"
254++}
255+diff --git a/tests/auto/qml/qquickworkerscript/data/worker_var.qml b/tests/auto/qml/qquickworkerscript/data/worker_var.qml
256+new file mode 100644
257+index 0000000..ea6a23c
258+--- /dev/null
259++++ b/tests/auto/qml/qquickworkerscript/data/worker_var.qml
260+@@ -0,0 +1,5 @@
261++import QtQuick 2.0
262++
263++BaseWorker {
264++ source: "script_var.js"
265++}
266+diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
267+index a799fc4..57dc988 100644
268+--- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
269++++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
270+@@ -68,6 +68,9 @@ private slots:
271+ void script_included();
272+ void scriptError_onLoad();
273+ void scriptError_onCall();
274++ void script_function();
275++ void script_var();
276++ void script_global();
277+ void stressDispose();
278+
279+ private:
280+@@ -235,7 +238,6 @@ void tst_QQuickWorkerScript::script_included()
281+ waitForEchoMessage(worker);
282+
283+ const QMetaObject *mo = worker->metaObject();
284+- QEXPECT_FAIL("", "It is not possible to write to the global object right now", Continue);
285+ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World");
286+
287+ qApp->processEvents();
288+@@ -283,6 +285,85 @@ void tst_QQuickWorkerScript::scriptError_onCall()
289+ delete worker;
290+ }
291+
292++void tst_QQuickWorkerScript::script_function()
293++{
294++ QQmlComponent component(&m_engine, testFileUrl("worker_function.qml"));
295++ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
296++ QVERIFY(worker != 0);
297++
298++ QString value("Hello");
299++
300++ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
301++ waitForEchoMessage(worker);
302++
303++ const QMetaObject *mo = worker->metaObject();
304++ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World");
305++
306++ qApp->processEvents();
307++ delete worker;
308++}
309++
310++void tst_QQuickWorkerScript::script_var()
311++{
312++ QQmlComponent component(&m_engine, testFileUrl("worker_var.qml"));
313++ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
314++ QVERIFY(worker != 0);
315++
316++ QString value("Hello");
317++
318++ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
319++ waitForEchoMessage(worker);
320++
321++ const QMetaObject *mo = worker->metaObject();
322++ QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World");
323++
324++ qApp->processEvents();
325++ delete worker;
326++}
327++
328++void tst_QQuickWorkerScript::script_global()
329++{
330++ {
331++ QQmlComponent component(&m_engine, testFileUrl("worker_global.qml"));
332++ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
333++ QVERIFY(worker != 0);
334++
335++ QString value("Hello");
336++
337++ QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
338++
339++ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
340++
341++ QTRY_COMPARE(qquickworkerscript_lastWarning,
342++ testFileUrl("script_global.js").toString() + QLatin1String(":2: Invalid write to global property \"world\""));
343++
344++ qInstallMessageHandler(previousMsgHandler);
345++
346++ qApp->processEvents();
347++ delete worker;
348++ }
349++
350++ {
351++ QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml"));
352++ QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
353++ QVERIFY(worker != 0);
354++
355++ QString value("Hello");
356++
357++ QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
358++
359++ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
360++
361++ QTRY_COMPARE(qquickworkerscript_lastWarning,
362++ testFileUrl("script_global.js").toString() + QLatin1String(":2: Invalid write to global property \"world\""));
363++
364++ qInstallMessageHandler(previousMsgHandler);
365++
366++ qApp->processEvents();
367++ delete worker;
368++ }
369++}
370++
371+ // Rapidly create and destroy worker scripts to test resources are being disposed
372+ // in the correct isolate
373+ void tst_QQuickWorkerScript::stressDispose()
374+--
375+1.9.0
376+
377
378=== added file 'debian/patches/V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch'
379--- debian/patches/V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch 1970-01-01 00:00:00 +0000
380+++ debian/patches/V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch 2014-03-24 06:36:21 +0000
381@@ -0,0 +1,47 @@
382+From e42e6a8d432270a5393f7451f63074af0811dddf Mon Sep 17 00:00:00 2001
383+From: Erik Verbruggen <erik.verbruggen@digia.com>
384+Date: Mon, 27 Jan 2014 13:00:20 +0100
385+Subject: [PATCH] V4 JIT: save/restore ebx (GOT ptr) on linux/x86.
386+
387+On linux/x86, ebx is used to store the global offset table. When using
388+this register for temporary values, we have to save it at the entry of
389+a generated function, and restore it before doing calls and at the end.
390+
391+Task-number: QTBUG-36289
392+Change-Id: I30194be3ce44f58b793ee52f6201906bcb68d46a
393+---
394+ src/qml/compiler/qv4isel_masm.cpp | 2 +-
395+ src/qml/compiler/qv4isel_masm_p.h | 4 ++++
396+ 2 files changed, 5 insertions(+), 1 deletion(-)
397+
398+diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
399+index 0cfb684..0fcd770 100644
400+--- a/src/qml/compiler/qv4isel_masm.cpp
401++++ b/src/qml/compiler/qv4isel_masm.cpp
402+@@ -122,7 +122,7 @@ static const Assembler::RegisterID calleeSavedRegisters[] = {
403+
404+ #if CPU(X86)
405+ static const Assembler::RegisterID calleeSavedRegisters[] = {
406+- // Not used: JSC::X86Registers::ebx,
407++ JSC::X86Registers::ebx, // temporary register
408+ JSC::X86Registers::esi, // ContextRegister
409+ JSC::X86Registers::edi // LocalsRegister
410+ };
411+diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h
412+index a146220..7dfe6a8 100644
413+--- a/src/qml/compiler/qv4isel_masm_p.h
414++++ b/src/qml/compiler/qv4isel_masm_p.h
415+@@ -981,6 +981,10 @@ public:
416+ prepareRelativeCall(function, this);
417+ loadArgumentOnStackOrRegister<0>(arg1);
418+
419++#if OS(LINUX) && CPU(X86) && (defined(__PIC__) || defined(__PIE__))
420++ load32(Address(StackFrameRegister, -sizeof(void*)), JSC::X86Registers::ebx); // restore the GOT ptr
421++#endif
422++
423+ callAbsolute(functionName, function);
424+
425+ if (stackSpaceNeeded)
426+--
427+1.9.0
428+
429
430=== added file 'debian/patches/V4-fix-range-sorting.patch'
431--- debian/patches/V4-fix-range-sorting.patch 1970-01-01 00:00:00 +0000
432+++ debian/patches/V4-fix-range-sorting.patch 2014-03-24 06:36:21 +0000
433@@ -0,0 +1,46 @@
434+From 719f7741ec344392a36280707916e4f98e906b9c Mon Sep 17 00:00:00 2001
435+From: Erik Verbruggen <erik.verbruggen@digia.com>
436+Date: Thu, 30 Jan 2014 13:15:52 +0100
437+Subject: [PATCH] V4: fix range sorting
438+
439+When a life-time interval is split from another interval, it has to come
440+before an interval that starts at the same position but is not split.
441+
442+This also means that a means that the all ranges in a split interval
443+are uses, which is important for allocation: all incoming parameters for
444+an operation need to be allocated before allocating a register for the
445+result as the result will only start its life "at the end" of the
446+operation.
447+
448+This patch fixes a problem register allocation is done in a function
449+where register pressure is high (e.g. on platforms that have few
450+registers to start with). Specifically, crypto.js on x86 triggered it.
451+
452+Change-Id: Iee3e5d82a887b8de573dfc23513844143d0c8073
453+---
454+ src/qml/compiler/qv4ssa.cpp | 9 ++++++---
455+ 1 file changed, 6 insertions(+), 3 deletions(-)
456+
457+diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
458+index 44c93df..594c38d 100644
459+--- a/src/qml/compiler/qv4ssa.cpp
460++++ b/src/qml/compiler/qv4ssa.cpp
461+@@ -3705,9 +3705,12 @@ void LifeTimeInterval::dump(QTextStream &out) const {
462+ }
463+
464+ bool LifeTimeInterval::lessThan(const LifeTimeInterval &r1, const LifeTimeInterval &r2) {
465+- if (r1._ranges.first().start == r2._ranges.first().start)
466+- return r1._ranges.last().end < r2._ranges.last().end;
467+- else
468++ if (r1._ranges.first().start == r2._ranges.first().start) {
469++ if (r1.isSplitFromInterval() == r2.isSplitFromInterval())
470++ return r1._ranges.last().end < r2._ranges.last().end;
471++ else
472++ return r1.isSplitFromInterval();
473++ } else
474+ return r1._ranges.first().start < r2._ranges.first().start;
475+ }
476+
477+--
478+1.9.0
479+
480
481=== added file 'debian/patches/V4-regalloc-fix-interval-splitting-when-register-pre.patch'
482--- debian/patches/V4-regalloc-fix-interval-splitting-when-register-pre.patch 1970-01-01 00:00:00 +0000
483+++ debian/patches/V4-regalloc-fix-interval-splitting-when-register-pre.patch 2014-03-24 06:36:21 +0000
484@@ -0,0 +1,103 @@
485+From add00b97c52981cf157b283d2a56417e8b1bd899 Mon Sep 17 00:00:00 2001
486+From: Erik Verbruggen <erik.verbruggen@digia.com>
487+Date: Thu, 30 Jan 2014 13:48:31 +0100
488+Subject: [PATCH] V4 regalloc: fix interval splitting when register pressure is
489+ high.
490+
491+When a register is needed for an interval, but none is available, one
492+of the used registers will be chosen and spilled to the stack (meaning
493+it will be split) before the current position. However, if a register
494+is used at the current position for an incoming parameter, its interval
495+has to be split after the current position. This patch adds/fixes the
496+latter case.
497+
498+This fixes crypto.js on x86. The specific problem there was that the
499+result of an operation needed a register, and chose the one from one
500+of the incoming parameters (which then should get spilled/split).
501+However, this interval was already split, and started exactly at that
502+the current position. So splitting before the current position did
503+nothing, resulting in it staying alive and using the same register as
504+the result. So any subsequent use of would have the invalid value.
505+
506+Task-number: QTBUG-36430
507+Change-Id: I228fc210b009aa0b16b08a374fc955fabfbb6d12
508+---
509+ src/qml/compiler/qv4regalloc.cpp | 34 +++++++++++++++++++++++++++-------
510+ 1 file changed, 27 insertions(+), 7 deletions(-)
511+
512+diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp
513+index a3255f2..ea2338a 100644
514+--- a/src/qml/compiler/qv4regalloc.cpp
515++++ b/src/qml/compiler/qv4regalloc.cpp
516+@@ -111,6 +111,13 @@ public:
517+ return false;
518+ }
519+
520++ bool isUsedAt(const Temp &t, int position) {
521++ foreach (const Use &use, uses(t))
522++ if (use.pos == position)
523++ return true;
524++ return false;
525++ }
526++
527+ int def(const Temp &t) const {
528+ Q_ASSERT(_defs[t].isValid());
529+ return _defs[t].defStmt;
530+@@ -743,17 +750,17 @@ private:
531+ os << "Intervals live at the start of L" << bb->index << ":" << endl;
532+ if (_liveAtStart[bb].isEmpty())
533+ os << "\t(none)" << endl;
534+- foreach (const LifeTimeInterval &i, _liveAtStart[bb]) {
535++ foreach (const LifeTimeInterval *i, _liveAtStart[bb]) {
536+ os << "\t";
537+- i.dump(os);
538++ i->dump(os);
539+ os << endl;
540+ }
541+ os << "Intervals live at the end of L" << bb->index << ":" << endl;
542+ if (_liveAtEnd[bb].isEmpty())
543+ os << "\t(none)" << endl;
544+- foreach (const LifeTimeInterval &i, _liveAtEnd[bb]) {
545++ foreach (const LifeTimeInterval *i, _liveAtEnd[bb]) {
546+ os << "\t";
547+- i.dump(os);
548++ i->dump(os);
549+ os << endl;
550+ }
551+ #endif
552+@@ -1066,6 +1073,8 @@ RegisterAllocator::RegisterAllocator(const QVector<int> &normalRegisters, const
553+ : _normalRegisters(normalRegisters)
554+ , _fpRegisters(fpRegisters)
555+ {
556++ Q_ASSERT(normalRegisters.size() >= 2);
557++ Q_ASSERT(fpRegisters.size() >= 2);
558+ }
559+
560+ RegisterAllocator::~RegisterAllocator()
561+@@ -1413,9 +1422,20 @@ void RegisterAllocator::allocateBlockedReg(LifeTimeInterval &current, const int
562+ #endif // DEBUG_REGALLOC
563+ current.setReg(reg);
564+ _lastAssignedRegister.insert(current.temp(), reg);
565+- Q_ASSERT(nextUseRangeForReg[reg]);
566+- Q_ASSERT(!nextUseRangeForReg[reg]->isFixedInterval());
567+- split(*nextUseRangeForReg[reg], position);
568++ LifeTimeInterval *nextUse = nextUseRangeForReg[reg];
569++ Q_ASSERT(nextUse);
570++ Q_ASSERT(!nextUse->isFixedInterval());
571++
572++ if (_info->isUsedAt(nextUse->temp(), position)) {
573++ Q_ASSERT(!_info->isUsedAt(current.temp(), position));
574++ // the register is used (as an incoming parameter) at the current position, so split
575++ // the interval immediately after the (use at the) current position
576++ split(*nextUse, position + 1);
577++ } else {
578++ // the register was used before the current position
579++ split(*nextUse, position);
580++ }
581++
582+ splitInactiveAtEndOfLifetimeHole(reg, needsFPReg, position);
583+
584+ // make sure that current does not intersect with the fixed interval for reg
585+--
586+1.9.0
587+
588
589=== modified file 'debian/patches/series'
590--- debian/patches/series 2014-03-14 09:37:59 +0000
591+++ debian/patches/series 2014-03-24 06:36:21 +0000
592@@ -5,7 +5,6 @@
593 fix_binary_location_for_tests.patch
594 disable_failing_tests.patch
595 Make-sure-the-test-window-has-focus.patch
596-Don-t-use-ebx-in-the-x86-register-allocator.patch
597 V4-Array.push-on-QStringList-should-invoke-putIndexe.patch
598 Guarantee-event-s-default-state-as-not-accepted.patch
599 Fix-crash-when-accessing-var-properties-in-objects-w.patch
600@@ -13,3 +12,8 @@
601 ppc64el.patch
602 clean_chain_of_incubated_objects.patch
603 Fix-crash-when-appending-arrays-to-sub-models-in-lis.patch
604+Don-t-crash-on-Runtime-getQmlImportedScripts.patch
605+Fix-global-object-handling-in-worker-script-JS-files.patch
606+V4-JIT-save-restore-ebx-GOT-ptr-on-linux-x86.patch
607+V4-fix-range-sorting.patch
608+V4-regalloc-fix-interval-splitting-when-register-pre.patch

Subscribers

People subscribed via source and target branches