diff options
author | Lars Knoll <[email protected]> | 2013-08-29 14:31:32 +0200 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-09-02 17:27:36 +0200 |
commit | edee5c3dc0d922ec3b6a44d66193e9a57b8a979e (patch) | |
tree | 5e40caa777c01a7999d736ead63ae239d1eb5b98 /src/qml/jsruntime/qv4variantobject.cpp | |
parent | 3ad8b0f0e8193bb7b62ffee6b33588ef6b51459c (diff) |
Move prototype pointer into QV4::InternalClass
The prototype is actually the same for most objects. By
moving it into the internal class, we can save 8 bytes
per object, as well as allowing for some future
optimizations.
Also fix a bug in the implementation of the Error
prototype objects.
Change-Id: I4d4b641055f644a9b088f27be34bfdb0446279b7
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4variantobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4variantobject.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp index f18c5b582e..1989e3dcf5 100644 --- a/src/qml/jsruntime/qv4variantobject.cpp +++ b/src/qml/jsruntime/qv4variantobject.cpp @@ -51,13 +51,21 @@ using namespace QV4; DEFINE_MANAGED_VTABLE(VariantObject); +VariantObject::VariantObject(InternalClass *ic) + : Object(ic) + , ExecutionEngine::ScarceResourceData(QVariant()) + , m_vmePropertyReferenceCount(0) +{ + vtbl = &static_vtbl; +} + VariantObject::VariantObject(ExecutionEngine *engine, const QVariant &value) : Object(engine) , ExecutionEngine::ScarceResourceData(value) , m_vmePropertyReferenceCount(0) { vtbl = &static_vtbl; - prototype = engine->variantPrototype; + setPrototype(engine->variantPrototype); if (isScarce()) internalClass->engine->scarceResources.insert(this); } @@ -132,10 +140,9 @@ void VariantObject::removeVmePropertyReference() } -VariantPrototype::VariantPrototype(ExecutionEngine *engine) - : VariantObject(engine, QVariant()) +VariantPrototype::VariantPrototype(InternalClass *ic) + : VariantObject(ic) { - prototype = engine->objectPrototype; } void VariantPrototype::init(ExecutionEngine *engine) |