aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4ssa_p.h
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-01-17 11:45:37 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 12:20:00 +0100
commita0494a2092d7512a2b0d568a21058ed77b0cea11 (patch)
tree2ffe57e0fefc87a363ea7fc69e9e944766671340 /src/qml/compiler/qv4ssa_p.h
parent7030adff1869e850a7b983e88d7a773d5d594886 (diff)
V4: fix range splitting when split is between intervals.
Also added some "white-box" unit tests and sprinkled in a bit of documentation. The case that went wrong is covered by the test rangeSplitting_1: before the fix, the new interval would have two ranges: [66-64],[70-71]. The first range is invalid and should not be there at all. Change-Id: If0742f4e6a96d98ea5d696f95126886ba66f92bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4ssa_p.h')
-rw-r--r--src/qml/compiler/qv4ssa_p.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4ssa_p.h b/src/qml/compiler/qv4ssa_p.h
index f90fc5b05b..65d4f0834a 100644
--- a/src/qml/compiler/qv4ssa_p.h
+++ b/src/qml/compiler/qv4ssa_p.h
@@ -51,7 +51,7 @@ class QQmlEnginePrivate;
namespace QQmlJS {
namespace V4IR {
-class LifeTimeInterval {
+class Q_AUTOTEST_EXPORT LifeTimeInterval {
public:
struct Range {
int start;
@@ -121,6 +121,20 @@ public:
void dump(QTextStream &out) const;
static bool lessThan(const LifeTimeInterval &r1, const LifeTimeInterval &r2);
static bool lessThanForTemp(const LifeTimeInterval &r1, const LifeTimeInterval &r2);
+
+ void validate() const {
+#if !defined(QT_NO_DEBUG)
+ // Validate the new range
+ if (_end != Invalid) {
+ Q_ASSERT(!_ranges.isEmpty());
+ foreach (const Range &range, _ranges) {
+ Q_ASSERT(range.start >= 0);
+ Q_ASSERT(range.end >= 0);
+ Q_ASSERT(range.start <= range.end);
+ }
+ }
+#endif
+ }
};
class Optimizer