From 039432362d9c0897f4fbe4334c1d9c99aaf98be8 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 21 Jul 2011 14:47:26 +0200 Subject: Speedup the V4 code generation. Skip discarded code and use QVarLengthArray instead of QByteArray to store the bytecode. Change-Id: I4c574e7a817595bc8942ed9a927e79339a2d7b40 Reviewed-on: http://codereview.qt.nokia.com/3760 Reviewed-by: Roberto Raggi Reviewed-by: Qt Sanity Bot --- src/declarative/qml/v4/qdeclarativev4instruction_p.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/declarative/qml/v4/qdeclarativev4instruction_p.h') diff --git a/src/declarative/qml/v4/qdeclarativev4instruction_p.h b/src/declarative/qml/v4/qdeclarativev4instruction_p.h index e3ac9027f7..6efe9332d1 100644 --- a/src/declarative/qml/v4/qdeclarativev4instruction_p.h +++ b/src/declarative/qml/v4/qdeclarativev4instruction_p.h @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_HEADER @@ -414,21 +415,27 @@ class Bytecode public: Bytecode(); - QByteArray code() const { return d; } const char *constData() const { return d.constData(); } int size() const { return d.size(); } int count() const { return d.count(); } void clear() { d.clear(); } bool isEmpty() const { return d.isEmpty(); } void append(const Instr &instr); - void append(const QVector &instrs); + + template + void append(_It it, _It last) + { + for (; it != last; ++it) + append(*it); + } + int remove(int index); const Instr &operator[](int offset) const; Instr &operator[](int offset); private: - QByteArray d; + QVarLengthArray d; #ifdef QML_THREADED_INTERPRETER void **decodeInstr; #endif -- cgit v1.2.3