diff options
author | Simon Hausmann <[email protected]> | 2014-07-26 09:14:44 +0200 |
---|---|---|
committer | Simon Hausmann <[email protected]> | 2014-07-26 13:21:16 +0200 |
commit | 75d8ebb3e6925f500ddeefe2ab491be2ae83264c (patch) | |
tree | 6874c91386434f4a1934a9555a3f1d5daf69434c /src/qml/compiler/qv4ssa.cpp | |
parent | fcb40ff6d71f4561401e6b2bd4d7fc706fff8eee (diff) | |
parent | ba8416b80f42c81387170620472194e7a76429b8 (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4engine.cpp
Change-Id: Ie3ef6202b6a3a8521971e1be10c40c6a2db6989c
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 673d4e5db0..8488d6eb2b 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -141,13 +141,31 @@ public: if (set.blockNumbers) numberIt = set.blockNumbers->begin(); else - flagIt = std::distance(set.blockFlags->begin(), - std::find(set.blockFlags->begin(), - set.blockFlags->end(), - true)); + findNextWithFlags(0); } } + void findNextWithFlags(size_t start) + { + flagIt = std::distance(set.blockFlags->begin(), + std::find(set.blockFlags->begin() + start, + set.blockFlags->end(), + true)); + + // The ++operator of std::vector<bool>::iterator in libc++ has a bug when using it on an + // iterator pointing to the last element. It will not be set to ::end(), but beyond + // that. (It will be set to the first multiple of the native word size that is bigger + // than size().) + // + // See http://llvm.org/bugs/show_bug.cgi?id=19663 + // + // As we use the size to for our end() iterator, take the minimum of the size and the + // distance for the flagIt: + flagIt = qMin(flagIt, set.blockFlags->size()); + + Q_ASSERT(flagIt <= set.blockFlags->size()); + } + public: BasicBlock *operator*() const { @@ -175,17 +193,10 @@ public: const_iterator &operator++() { - if (set.blockNumbers) { - if (numberIt != set.blockNumbers->end()) - ++numberIt; - } else if (flagIt < set.blockFlags->size()) { - flagIt = std::distance(set.blockFlags->begin(), - std::find(set.blockFlags->begin() + flagIt + 1, - set.blockFlags->end(), - true)); - if (flagIt > set.blockFlags->size()) - flagIt = set.blockFlags->size(); - } + if (set.blockNumbers) + ++numberIt; + else + findNextWithFlags(flagIt + 1); return *this; } |