diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-29 12:35:05 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2017-08-29 10:42:35 +0000 |
commit | 77e0602021c74b5ec2d8bd9affff5e91bf6f5ae3 (patch) | |
tree | 2054bc9a29279db1cdcdb57e414a9532b99cd818 /src/qml/compiler/qv4bytecodegenerator.cpp | |
parent | 99d5cdad6c8580d5ef31c291b721bf6230e2502f (diff) | |
download | qtdeclarative-77e0602021c74b5ec2d8bd9affff5e91bf6f5ae3.tar.gz |
Fix line number mapping to work with non increasing line numbers
The old map assumed that line numbers are always increasing, something
that isn't always true. So move to a format where we map blocks of
bytecode to a line number instead.
Change-Id: I1cd9dd1329d415122cd3d560294ef53007f879f8
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4bytecodegenerator.cpp')
-rw-r--r-- | src/qml/compiler/qv4bytecodegenerator.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4bytecodegenerator.cpp b/src/qml/compiler/qv4bytecodegenerator.cpp index 9feafb8bd4..dfdb71b253 100644 --- a/src/qml/compiler/qv4bytecodegenerator.cpp +++ b/src/qml/compiler/qv4bytecodegenerator.cpp @@ -40,6 +40,7 @@ #include <private/qv4bytecodegenerator_p.h> #include <private/qv4compilercontext_p.h> #include <private/qqmljsastfwd_p.h> +#include <private/qv4compileddata_p.h> QT_USE_NAMESPACE using namespace QV4; @@ -161,15 +162,16 @@ void BytecodeGenerator::finalize(Compiler::Context *context) // collect content and line numbers QByteArray code; - QVector<int> lineNumbers; - currentLine = startLine; + QVector<CompiledData::CodeOffsetToLine> lineNumbers; + currentLine = -1; + Q_UNUSED(startLine); for (const auto &i : qAsConst(instructions)) { if (i.line != currentLine) { - Q_ASSERT(i.line > currentLine); - while (currentLine < i.line) { - lineNumbers.append(code.size()); - ++currentLine; - } + currentLine = i.line; + CompiledData::CodeOffsetToLine entry; + entry.codeOffset = code.size(); + entry.line = currentLine; + lineNumbers.append(entry); } code.append(i.packed, i.size); } |