aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v4
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-08-09 13:26:32 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-16 01:13:50 +0200
commit6aeff1b5429ca97af052a7a172369585382096e8 (patch)
tree68347d53f95cbcb6162a0a4f2e3c198a77f455b1 /src/qml/qml/v4
parent6096f72e8cf23522cf675d6142492c58401e68b0 (diff)
Reduce memory consumption of source coordinates
Reduce memory consumption by storing source location coordinates as 16-bit variables (in run-time structures). Also modify qmlmin to restrict line lengths so that the column bound is not normally exceeded. Change-Id: I08605626ffbdf081b6da2aea1116bdfe24998572 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src/qml/qml/v4')
-rw-r--r--src/qml/qml/v4/qv4bindings.cpp10
-rw-r--r--src/qml/qml/v4/qv4bindings_p.h6
-rw-r--r--src/qml/qml/v4/qv4compiler.cpp10
-rw-r--r--src/qml/qml/v4/qv4compiler_p_p.h12
-rw-r--r--src/qml/qml/v4/qv4instruction_p.h2
-rw-r--r--src/qml/qml/v4/qv4ir.cpp20
-rw-r--r--src/qml/qml/v4/qv4ir_p.h30
-rw-r--r--src/qml/qml/v4/qv4irbuilder.cpp4
8 files changed, 47 insertions, 47 deletions
diff --git a/src/qml/qml/v4/qv4bindings.cpp b/src/qml/qml/v4/qv4bindings.cpp
index 02f2bfc863..643a6197fb 100644
--- a/src/qml/qml/v4/qv4bindings.cpp
+++ b/src/qml/qml/v4/qv4bindings.cpp
@@ -299,7 +299,7 @@ QV4Bindings::~QV4Bindings()
}
QQmlAbstractBinding *QV4Bindings::configBinding(int index, int fallbackIndex, QObject *target, QObject *scope,
- int property, int propType, int line, int column)
+ int property, int propType, quint16 line, quint16 column)
{
Q_ASSERT(propType <= std::numeric_limits<quint16>::max());
@@ -556,7 +556,7 @@ QByteArray testResultToString(const QVariant &result, bool undefined)
}
}
-static void testBindingResult(const QString &binding, int line, int column,
+static void testBindingResult(const QString &binding, quint16 line, quint16 column,
QQmlContextData *context, QObject *scope,
const Register &result, int resultType)
{
@@ -658,7 +658,7 @@ static void testBindingResult(const QString &binding, int line, int column,
}
}
-static void testBindingException(const QString &binding, int line, int column,
+static void testBindingException(const QString &binding, quint16 line, quint16 column,
QQmlContextData *context, QObject *scope)
{
QQmlExpression expression(context->asQQmlContext(), scope, binding);
@@ -683,8 +683,8 @@ static void throwException(int id, QQmlDelayedError *error,
else
error->setErrorDescription(description);
if (id != 0xFF) {
- quint64 e = *((quint64 *)(program->data() + program->exceptionDataOffset) + id);
- error->setErrorLocation(context->url, (e >> 32) & 0xFFFFFFFF, e & 0xFFFFFFFF);
+ quint32 e = *((quint32 *)(program->data() + program->exceptionDataOffset) + id);
+ error->setErrorLocation(context->url, (e >> 16), (e & 0xFFFF));
} else {
error->setErrorLocation(context->url, -1, -1);
}
diff --git a/src/qml/qml/v4/qv4bindings_p.h b/src/qml/qml/v4/qv4bindings_p.h
index dd63f6d9f5..eae5703c50 100644
--- a/src/qml/qml/v4/qv4bindings_p.h
+++ b/src/qml/qml/v4/qv4bindings_p.h
@@ -73,7 +73,7 @@ public:
QQmlAbstractBinding *configBinding(int index, int fallbackIndex, QObject *target,
QObject *scope, int property, int propType,
- int line, int column);
+ quint16 line, quint16 column);
#ifdef QML_THREADED_INTERPRETER
static void **getDecodeInstrTable();
@@ -107,8 +107,8 @@ public:
quint16 propType;
QObject *scope;
- int line;
- int column;
+ quint16 line;
+ quint16 column;
QPointerValuePair<QObject, Retarget> target;
quint32 executedBlocks;
diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp
index b697204839..1506d09ce9 100644
--- a/src/qml/qml/v4/qv4compiler.cpp
+++ b/src/qml/qml/v4/qv4compiler.cpp
@@ -73,7 +73,7 @@ QV4CompilerPrivate::QV4CompilerPrivate()
//
// tracing
//
-void QV4CompilerPrivate::trace(int line, int column)
+void QV4CompilerPrivate::trace(quint16 line, quint16 column)
{
bytecode.clear();
@@ -1401,13 +1401,13 @@ quint32 QV4CompilerPrivate::subscriptionBlockMask(const QStringList &sub)
return *uiter;
}
-quint8 QV4CompilerPrivate::exceptionId(quint32 line, quint32 column)
+quint8 QV4CompilerPrivate::exceptionId(quint16 line, quint16 column)
{
quint8 rv = 0xFF;
if (exceptions.count() < 0xFF) {
rv = (quint8)exceptions.count();
- quint64 e = line;
- e <<= 32;
+ quint32 e = line;
+ e <<= 16;
e |= column;
exceptions.append(e);
}
@@ -1493,7 +1493,7 @@ QByteArray QV4CompilerPrivate::buildSignalTable() const
QByteArray QV4CompilerPrivate::buildExceptionData() const
{
QByteArray rv;
- rv.resize(committed.exceptions.count() * sizeof(quint64));
+ rv.resize(committed.exceptions.count() * sizeof(quint32));
::memcpy(rv.data(), committed.exceptions.constData(), rv.size());
return rv;
}
diff --git a/src/qml/qml/v4/qv4compiler_p_p.h b/src/qml/qml/v4/qv4compiler_p_p.h
index 12beaa0fbb..989e428350 100644
--- a/src/qml/qml/v4/qv4compiler_p_p.h
+++ b/src/qml/qml/v4/qv4compiler_p_p.h
@@ -136,9 +136,9 @@ public:
int subscriptionIndex(const QStringList &);
quint32 subscriptionBlockMask(const QStringList &);
- quint8 exceptionId(quint32 line, quint32 column);
+ quint8 exceptionId(quint16 line, quint16 column);
quint8 exceptionId(QQmlJS::AST::ExpressionNode *);
- QVector<quint64> exceptions;
+ QVector<quint32> exceptions;
QQmlAssociationList<int, quint32> usedSubscriptionIds;
int subscriptionOffset;
@@ -164,7 +164,7 @@ public:
//QQmlJS::Bytecode bytecode;
QByteArray bytecode;
QByteArray data;
- QVector<quint64> exceptions;
+ QVector<quint32> exceptions;
int subscriptionCount;
QList<QQmlAssociationList<QString, int> > subscriptions;
@@ -191,7 +191,7 @@ protected:
//
// tracing
//
- void trace(int line, int column);
+ void trace(quint16 line, quint16 column);
void trace(QVector<QQmlJS::IR::BasicBlock *> *blocks);
void traceExpression(QQmlJS::IR::Expr *e, quint8 r);
@@ -235,8 +235,8 @@ private:
bool usedSubscriptionIdsChanged;
quint32 currentBlockMask;
- int bindingLine;
- int bindingColumn;
+ quint16 bindingLine;
+ quint16 bindingColumn;
bool invalidatable;
};
diff --git a/src/qml/qml/v4/qv4instruction_p.h b/src/qml/qml/v4/qv4instruction_p.h
index 2e06bd0850..763cd2d67b 100644
--- a/src/qml/qml/v4/qv4instruction_p.h
+++ b/src/qml/qml/v4/qv4instruction_p.h
@@ -231,7 +231,7 @@ union Q_AUTOTEST_EXPORT V4Instr {
struct instr_id {
QML_V4_INSTR_HEADER
quint16 column;
- quint32 line;
+ quint16 line;
};
struct instr_init {
diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp
index ed25f28fa3..51f61716f0 100644
--- a/src/qml/qml/v4/qv4ir.cpp
+++ b/src/qml/qml/v4/qv4ir.cpp
@@ -210,7 +210,7 @@ QString String::escape(const QStringRef &s)
return r;
}
-void Name::init(Name *base, Type type, const QString *id, Symbol symbol, quint32 line, quint32 column)
+void Name::init(Name *base, Type type, const QString *id, Symbol symbol, quint16 line, quint16 column)
{
this->type = type;
this->base = base;
@@ -482,12 +482,12 @@ Expr *BasicBlock::STRING(const QStringRef &value)
return e;
}
-Name *BasicBlock::NAME(const QString &id, quint32 line, quint32 column)
+Name *BasicBlock::NAME(const QString &id, quint16 line, quint16 column)
{
return NAME(0, id, line, column);
}
-Name *BasicBlock::NAME(Name *base, const QString &id, quint32 line, quint32 column)
+Name *BasicBlock::NAME(Name *base, const QString &id, quint16 line, quint16 column)
{
Name *e = function->pool->New<Name>();
e->init(base, InvalidType,
@@ -497,7 +497,7 @@ Name *BasicBlock::NAME(Name *base, const QString &id, quint32 line, quint32 colu
}
Name *BasicBlock::SYMBOL(Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, Name::Storage storage,
- quint32 line, quint32 column)
+ quint16 line, quint16 column)
{
Name *name = SYMBOL(/*base = */ 0, type, id, meta, property, line, column);
name->storage = storage;
@@ -505,7 +505,7 @@ Name *BasicBlock::SYMBOL(Type type, const QString &id, const QQmlMetaObject &met
}
Name *BasicBlock::SYMBOL(Name *base, Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, Name::Storage storage,
- quint32 line, quint32 column)
+ quint16 line, quint16 column)
{
Name *name = function->pool->New<Name>();
name->init(base, type, function->newString(id),
@@ -517,7 +517,7 @@ Name *BasicBlock::SYMBOL(Name *base, Type type, const QString &id, const QQmlMet
}
Name *BasicBlock::SYMBOL(Name *base, Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property,
- quint32 line, quint32 column)
+ quint16 line, quint16 column)
{
Name *name = function->pool->New<Name>();
name->init(base, type, function->newString(id),
@@ -527,7 +527,7 @@ Name *BasicBlock::SYMBOL(Name *base, Type type, const QString &id, const QQmlMet
return name;
}
-Name *BasicBlock::ID_OBJECT(const QString &id, const QQmlScript::Object *object, quint32 line, quint32 column)
+Name *BasicBlock::ID_OBJECT(const QString &id, const QQmlScript::Object *object, quint16 line, quint16 column)
{
Name *name = function->pool->New<Name>();
name->init(/*base = */ 0, IR::ObjectType,
@@ -540,7 +540,7 @@ Name *BasicBlock::ID_OBJECT(const QString &id, const QQmlScript::Object *object,
}
Name *BasicBlock::ATTACH_TYPE(const QString &id, const QQmlType *attachType, Name::Storage storage,
- quint32 line, quint32 column)
+ quint16 line, quint16 column)
{
Name *name = function->pool->New<Name>();
name->init(/*base = */ 0, IR::AttachType,
@@ -552,7 +552,7 @@ Name *BasicBlock::ATTACH_TYPE(const QString &id, const QQmlType *attachType, Nam
}
Name *BasicBlock::MODULE_OBJECT(const QString &id, const QQmlMetaObject &meta, Name::Storage storage,
- quint32 line, quint32 column)
+ quint16 line, quint16 column)
{
Name *name = function->pool->New<Name>();
name->init(/*base = */ 0, IR::ObjectType,
@@ -668,7 +668,7 @@ Stmt *BasicBlock::CJUMP(Expr *cond, BasicBlock *iftrue, BasicBlock *iffalse)
return s;
}
-Stmt *BasicBlock::RET(Expr *expr, Type type, quint32 line, quint32 column)
+Stmt *BasicBlock::RET(Expr *expr, Type type, quint16 line, quint16 column)
{
if (isTerminated())
return 0;
diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h
index 9b36762356..f6e20a7187 100644
--- a/src/qml/qml/v4/qv4ir_p.h
+++ b/src/qml/qml/v4/qv4ir_p.h
@@ -283,10 +283,10 @@ struct Name: Expr {
QQmlPropertyData *property;
Storage storage;
BuiltinSymbol builtin;
- quint32 line;
- quint32 column;
+ quint16 line;
+ quint16 column;
- void init(Name *base, Type type, const QString *id, Symbol symbol, quint32 line, quint32 column);
+ void init(Name *base, Type type, const QString *id, Symbol symbol, quint16 line, quint16 column);
inline bool is(Symbol s) const { return s == symbol; }
inline bool isNot(Symbol s) const { return s != symbol; }
@@ -468,10 +468,10 @@ struct CJump: Stmt {
struct Ret: Stmt {
Expr *expr;
Type type;
- quint32 line;
- quint32 column;
+ quint16 line;
+ quint16 column;
- void init(Expr *expr, Type type, quint32 line, quint32 column)
+ void init(Expr *expr, Type type, quint16 line, quint16 column)
{
this->expr = expr;
this->type = type;
@@ -538,14 +538,14 @@ struct BasicBlock {
Expr *CONST(Type type, double value);
Expr *STRING(const QStringRef &value);
- Name *NAME(const QString &id, quint32 line, quint32 column);
- Name *NAME(Name *base, const QString &id, quint32 line, quint32 column);
- Name *SYMBOL(Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, Name::Storage storage, quint32 line, quint32 column);
- Name *SYMBOL(Name *base, Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, quint32 line, quint32 column);
- Name *SYMBOL(Name *base, Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, Name::Storage storage, quint32 line, quint32 column);
- Name *ID_OBJECT(const QString &id, const QQmlScript::Object *object, quint32 line, quint32 column);
- Name *ATTACH_TYPE(const QString &id, const QQmlType *attachType, Name::Storage storage, quint32 line, quint32 column);
- Name *MODULE_OBJECT(const QString &id, const QQmlMetaObject &meta, Name::Storage storage, quint32 line, quint32 column);
+ Name *NAME(const QString &id, quint16 line, quint16 column);
+ Name *NAME(Name *base, const QString &id, quint16 line, quint16 column);
+ Name *SYMBOL(Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, Name::Storage storage, quint16 line, quint16 column);
+ Name *SYMBOL(Name *base, Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, quint16 line, quint16 column);
+ Name *SYMBOL(Name *base, Type type, const QString &id, const QQmlMetaObject &meta, QQmlPropertyData *property, Name::Storage storage, quint16 line, quint16 column);
+ Name *ID_OBJECT(const QString &id, const QQmlScript::Object *object, quint16 line, quint16 column);
+ Name *ATTACH_TYPE(const QString &id, const QQmlType *attachType, Name::Storage storage, quint16 line, quint16 column);
+ Name *MODULE_OBJECT(const QString &id, const QQmlMetaObject &meta, Name::Storage storage, quint16 line, quint16 column);
Expr *UNOP(AluOp op, Expr *expr);
Expr *BINOP(AluOp op, Expr *left, Expr *right);
@@ -556,7 +556,7 @@ struct BasicBlock {
Stmt *JUMP(BasicBlock *target);
Stmt *CJUMP(Expr *cond, BasicBlock *iftrue, BasicBlock *iffalse);
- Stmt *RET(Expr *expr, Type type, quint32 line, quint32 column);
+ Stmt *RET(Expr *expr, Type type, quint16 line, quint16 column);
void dump(QTextStream &out);
};
diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp
index 93c552173f..37d71f1941 100644
--- a/src/qml/qml/v4/qv4irbuilder.cpp
+++ b/src/qml/qml/v4/qv4irbuilder.cpp
@@ -424,8 +424,8 @@ bool QV4IRBuilder::visit(AST::ThisExpression *)
bool QV4IRBuilder::visit(AST::IdentifierExpression *ast)
{
- const quint32 line = ast->identifierToken.startLine;
- const quint32 column = ast->identifierToken.startColumn;
+ const quint16 line = ast->identifierToken.startLine;
+ const quint16 column = ast->identifierToken.startColumn;
const QString name = ast->name.toString();