diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-13 21:03:44 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-14 21:59:59 +0200 |
commit | 1be51cc3e7c9ca5256a52136d6fcc9c22c997625 (patch) | |
tree | e0c4f1feae828c4f04f0b8b63201627aa20cf43c /src/qml/jsruntime | |
parent | 668eca2b9343cf5d79dc1faa6c251595e2e84918 (diff) |
inline get_element calls
Inline calls to get_element if the base is an
object with a simple array structure, and the index
is an integer number.
Implemented for 64bit only for now, saves ~25% on crypto.js
Change-Id: I3e34a6409169d90d3937f62264707d52a6c2f9f7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4managed.cpp | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 28 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4sequenceobject.cpp | 2 |
4 files changed, 24 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp index 03608d2556..31bb8f2b94 100644 --- a/src/qml/jsruntime/qv4managed.cpp +++ b/src/qml/jsruntime/qv4managed.cpp @@ -84,6 +84,7 @@ void Managed::operator delete(void *ptr) Managed *m = static_cast<Managed *>(ptr); m->vtbl = 0; m->_data = 0; + m->markBit = 0; m->~Managed(); } diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index e77c724994..b4469c8048 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -159,7 +159,7 @@ private: protected: Managed(InternalClass *internal) : _data(0), vtbl(&static_vtbl), internalClass(internal) - { inUse = 1; extensible = 1; hasAccessorProperty = 0; } + { inUse = 1; extensible = 1; } public: void *operator new(size_t size, MemoryManager *mm); @@ -282,20 +282,24 @@ public: ReturnedValue asReturnedValue() { return Value::fromManaged(this).asReturnedValue(); } + enum { + SimpleArray = 1 + }; + union { uint _data; struct { - uint markBit : 1; - uint inUse : 1; - uint extensible : 1; // used by Object - uint isNonStrictArgumentsObject : 1; - uint needsActivation : 1; // used by FunctionObject - uint strictMode : 1; // used by FunctionObject - uint bindingKeyFlag : 1; - uint hasAccessorProperty : 1; - uint type : 8; - mutable uint subtype : 8; - uint unused : 8; + uchar markBit : 1; + uchar inUse : 1; + uchar extensible : 1; // used by Object + uchar isNonStrictArgumentsObject : 1; + uchar needsActivation : 1; // used by FunctionObject + uchar strictMode : 1; // used by FunctionObject + uchar bindingKeyFlag : 1; + uchar hasAccessorProperty : 1; + uchar type; + mutable uchar subtype; + uchar flags; }; }; diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 0ccd8e6f62..795362e691 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -76,6 +76,7 @@ Object::Object(ExecutionEngine *engine) { vtbl = &static_vtbl; type = Type_Object; + flags = SimpleArray; memset(memberData, 0, sizeof(Property)*memberDataAlloc); } @@ -86,6 +87,7 @@ Object::Object(InternalClass *internalClass) { vtbl = &static_vtbl; type = Type_Object; + flags = SimpleArray; if (internalClass->size >= memberDataAlloc) { memberDataAlloc = internalClass->size; @@ -1078,6 +1080,7 @@ void Object::copyArrayData(Object *other) arrayOffset = 0; if (other->sparseArray) { + flags &= ~SimpleArray; sparseArray = new SparseArray(*other->sparseArray); arrayFreeList = other->arrayFreeList; } @@ -1226,6 +1229,7 @@ void Object::arraySort(ExecutionContext *context, ObjectRef thisObject, const Va void Object::initSparse() { if (!sparseArray) { + flags &= ~SimpleArray; sparseArray = new SparseArray; for (int i = 0; i < arrayDataLen; ++i) { if (!((arrayAttributes && arrayAttributes[i].isGeneric()) || arrayData[i].value.isEmpty())) { @@ -1302,6 +1306,7 @@ void Object::ensureArrayAttributes() if (arrayAttributes) return; + flags &= ~SimpleArray; arrayAttributes = new PropertyAttributes[arrayAlloc]; for (uint i = 0; i < arrayDataLen; ++i) arrayAttributes[i] = Attr_Data; diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 05f51beecf..320646805b 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -175,6 +175,7 @@ public: { type = Type_QmlSequence; vtbl = &static_vtbl; + flags &= ~SimpleArray; QV4::Scope scope(engine); QV4::ScopedObject protectThis(scope, this); init(); @@ -188,6 +189,7 @@ public: { type = Type_QmlSequence; vtbl = &static_vtbl; + flags &= ~SimpleArray; QV4::Scope scope(engine); QV4::ScopedObject protectThis(scope, this); loadReference(); |