aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-05-22 07:48:30 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-05-22 07:48:54 +0200
commit800025fb70ace453275011c1ae5ce906e0fa3344 (patch)
tree7f1ff56262b75beb3b0a1e94563c43fc59de742b /src/qml/compiler
parent666f20523cd7be16d88d3c03252ed2fd6e4be0c4 (diff)
parenteb0f98499485487f9f75b6388f00c58b50aeff50 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qv4compileddata_p.h11
-rw-r--r--src/qml/compiler/qv4compiler.cpp6
-rw-r--r--src/qml/compiler/qv4ssa.cpp32
3 files changed, 18 insertions, 31 deletions
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index 1fba6c0d3c..6ee23690a6 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -151,7 +151,7 @@ struct JSClass
struct String
{
quint32 flags; // isArrayIndex
- QArrayData str;
+ qint32 size;
// uint16 strdata[]
static int calculateSize(const QString &str) {
@@ -195,13 +195,12 @@ struct Unit
const uint *offsetTable = reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToStringTable);
const uint offset = offsetTable[idx];
const String *str = reinterpret_cast<const String*>(reinterpret_cast<const char *>(this) + offset);
- if (str->str.size == 0)
+ if (str->size == 0)
return QString();
- QStringDataPtr holder = { const_cast<QStringData *>(static_cast<const QStringData*>(&str->str)) };
- QString qstr(holder);
+ const QChar *characters = reinterpret_cast<const QChar *>(str + 1);
if (flags & StaticData)
- return qstr;
- return QString(qstr.constData(), qstr.length());
+ return QString::fromRawData(characters, str->size);
+ return QString(characters, str->size);
}
const uint *functionOffsetTable() const { return reinterpret_cast<const uint*>((reinterpret_cast<const char *>(this)) + offsetToFunctionTable); }
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 65ef5c4b5e..144ef8a79e 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -82,11 +82,7 @@ void QV4::Compiler::StringTableGenerator::serialize(uint *stringTable, char *dat
QV4::CompiledData::String *s = (QV4::CompiledData::String*)(stringData);
s->flags = 0; // ###
- s->str.ref.atomic.store(-1);
- s->str.size = qstr.length();
- s->str.alloc = 0;
- s->str.capacityReserved = false;
- s->str.offset = sizeof(QArrayData);
+ s->size = qstr.length();
memcpy(s + 1, qstr.constData(), (qstr.length() + 1)*sizeof(ushort));
stringData += QV4::CompiledData::String::calculateSize(qstr);
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index e5c66a8929..48c68533ba 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -154,18 +154,13 @@ public:
else
flagIt = set.blockFlags->size();
} else {
- if (set.blockNumbers) {
+ if (set.blockNumbers)
numberIt = set.blockNumbers->begin();
- } else {
- flagIt = 0;
- size_t eIt = set.blockFlags->size();
- while (flagIt != eIt) {
- if (set.blockFlags->operator[](flagIt))
- break;
- else
- ++flagIt;
- }
- }
+ else
+ flagIt = std::distance(set.blockFlags->begin(),
+ std::find(set.blockFlags->begin(),
+ set.blockFlags->end(),
+ true));
}
}
@@ -195,16 +190,13 @@ public:
const_iterator &operator++()
{
- if (set.blockNumbers) {
+ if (set.blockNumbers)
++numberIt;
- } else {
- size_t eIt = set.blockFlags->size();
- while (flagIt != eIt) {
- ++flagIt;
- if (flagIt == eIt || set.blockFlags->operator[](flagIt))
- break;
- }
- }
+ else
+ flagIt = std::distance(set.blockFlags->begin(),
+ std::find(set.blockFlags->begin() + flagIt + 1,
+ set.blockFlags->end(),
+ true));
return *this;
}