diff options
Diffstat (limited to 'src/qml/jsruntime/qv4function.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4function.cpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index e01febcfa3..6fdf61f2c3 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -86,80 +86,4 @@ Function::~Function() { } - -namespace QV4 { -template <int field, typename SearchType> -struct LineNumberMappingHelper -{ - const quint32 *table; - int lowerBound(int begin, int end, SearchType value) { - int middle; - int n = int(end - begin); - int half; - - while (n > 0) { - half = n >> 1; - middle = begin + half; - if (table[middle * 2 + field] < static_cast<quint32>(value)) { - begin = middle + 1; - n -= half + 1; - } else { - n = half; - } - } - return begin; - } - int upperBound(int begin, int end, SearchType value) { - int middle; - int n = int(end - begin); - int half; - - while (n > 0) { - half = n >> 1; - middle = begin + half; - if (value < table[middle * 2 + field]) { - n = half; - } else { - begin = middle + 1; - n -= half + 1; - } - } - return begin; - } -}; -} - -int Function::lineNumberForProgramCounter(qptrdiff offset) const -{ - // Access the first field, the program counter - LineNumberMappingHelper<0, qptrdiff> helper; - helper.table = compiledFunction->lineNumberMapping(); - const uint count = compiledFunction->nLineNumberMappingEntries; - - int pos = helper.lowerBound(0, count, offset); - if (pos != 0 && count > 0) - --pos; - if (static_cast<uint>(pos) == count) - return -1; - return helper.table[pos * 2 + 1]; -} - -QList<qptrdiff> Function::programCountersForAllLines() const -{ - // Only store 1 breakpoint per line... - QHash<quint32, qptrdiff> offsetsPerLine; - const quint32 *mapping = compiledFunction->lineNumberMapping(); - - // ... and make it the first instruction by walking backwards over the line mapping table - // and inserting all entries keyed on line. - for (quint32 i = compiledFunction->nLineNumberMappingEntries; i > 0; ) { - --i; // the loop is written this way, because starting at endIndex-1 and checking for i>=0 will never end: i>=0 is always true for unsigned. - quint32 offset = mapping[i * 2]; - quint32 line = mapping[i * 2 + 1]; - offsetsPerLine.insert(line, offset); - } - - return offsetsPerLine.values(); -} - QT_END_NAMESPACE |