aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/v8/qv8engine.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-12 21:55:51 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2015-01-16 21:12:49 +0100
commit8ffb79bbd214c239e414dc4e9cf4569b3219bdab (patch)
treec9cc7e596be2616f8c1211f4fb7623c9153cd7d6 /src/qml/qml/v8/qv8engine.cpp
parent9fe1588915b935298917a0c29593eeed70da682f (diff)
Refactor persistent values
Use a page wise allocation mechanism for persistent values. This significantly reduces memory consumption of persistent values and also improves their performance a lot. Change-Id: I8499d2ca5bdd871e029f643ae605a94544558bb5 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/v8/qv8engine.cpp')
-rw-r--r--src/qml/qml/v8/qv8engine.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index d0c8c08fce..ce5d3c8370 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -106,12 +106,15 @@ static void restoreJSValue(QDataStream &stream, void *data)
quint32 isNullOrUndefined;
stream >> isNullOrUndefined;
+
+ // ### Optimize for the common case where we have an valid persistent
+ d->persistent.clear();
+
if (isNullOrUndefined & 0x1) {
- d->value = QV4::Primitive::nullValue().asReturnedValue();
+ d->unboundData = QVariant(QMetaType::VoidStar, (void *)0);
} else if (isNullOrUndefined & 0x2) {
- d->value = QV4::Primitive::undefinedValue().asReturnedValue();
+ d->unboundData = QVariant();
} else {
- d->value = QV4::Primitive::emptyValue().asReturnedValue();
d->unboundData.load(stream);
}
}