aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4compiler.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-09-29 13:30:42 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-10-13 22:13:12 +0200
commitae49af00b59628623bc15e19974ee5af5f0121ba (patch)
tree91488d095e7a5b52bb1b8df05e56fb668039ea7b /src/qml/compiler/qv4compiler.cpp
parent9cfc19faf5d1ce2b9626914ab4528998b072385d (diff)
QML: Track the statement indices together with line numbers
We will need the statement indices when tracking value type references. New value type references shall only be written back in the same statement they were created in. Task-number: QTBUG-99766 Change-Id: I83f908df034e7da8ba46ccacaa29bd9d78020d20 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compiler.cpp')
-rw-r--r--src/qml/compiler/qv4compiler.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index bb5c7d109f..e1e26715cd 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -424,9 +424,11 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::Compiler::Conte
function->localsOffset = currentOffset;
currentOffset += function->nLocals * sizeof(quint32);
- function->nLineNumbers = irFunction->lineNumberMapping.size();
- Q_ASSERT(function->lineNumberOffset() == currentOffset);
- currentOffset += function->nLineNumbers * sizeof(CompiledData::CodeOffsetToLine);
+ function->nLineAndStatementNumbers
+ = irFunction->lineAndStatementNumberMapping.size();
+ Q_ASSERT(function->lineAndStatementNumberOffset() == currentOffset);
+ currentOffset += function->nLineAndStatementNumbers
+ * sizeof(CompiledData::CodeOffsetToLineAndStatement);
function->nRegisters = irFunction->registerCountInFunction;
@@ -453,8 +455,11 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::Compiler::Conte
for (int i = 0; i < irFunction->locals.size(); ++i)
locals[i] = getStringId(irFunction->locals.at(i));
- // write line numbers
- memcpy(f + function->lineNumberOffset(), irFunction->lineNumberMapping.constData(), irFunction->lineNumberMapping.size()*sizeof(CompiledData::CodeOffsetToLine));
+ // write line and statement numbers
+ memcpy(f + function->lineAndStatementNumberOffset(),
+ irFunction->lineAndStatementNumberMapping.constData(),
+ irFunction->lineAndStatementNumberMapping.size()
+ * sizeof(CompiledData::CodeOffsetToLineAndStatement));
quint32_le *labels = (quint32_le *)(f + function->labelInfosOffset());
for (unsigned u : irFunction->labelInfo) {
@@ -658,8 +663,9 @@ QV4::CompiledData::Unit QV4::Compiler::JSUnitGenerator::generateHeader(QV4::Comp
Context *f = module->functions.at(i);
blockAndFunctionOffsets[i] = nextOffset;
- quint32 size = QV4::CompiledData::Function::calculateSize(f->arguments.size(), f->locals.size(), f->lineNumberMapping.size(), f->nestedContexts.size(),
- int(f->labelInfo.size()), f->code.size());
+ quint32 size = QV4::CompiledData::Function::calculateSize(
+ f->arguments.size(), f->locals.size(), f->lineAndStatementNumberMapping.size(),
+ f->nestedContexts.size(), int(f->labelInfo.size()), f->code.size());
functionSize += size - f->code.size();
nextOffset += size;
}