diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-11-21 14:26:08 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-04 09:45:48 +0100 |
commit | 0f32303e5cc9c539aa8698cab2b8cc2e946d885a (patch) | |
tree | a5ae53a26653ed8d673ad49084830fab64109bb4 /src/qml/jsruntime/qv4string.cpp | |
parent | fbcd0a22f643f0b0ec1404507d63bdf35cd9a195 (diff) |
Remove setVTable calls in performance critical areas
Remove all the calls to setVTable that were in performance
critical parts of the code. This now brings performance
back to the level we had with the vtable inlined in the
Managed objects.
Change-Id: I76317cc5c53b5b700d1d3883b954407142a4c424
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4string.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4string.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index 18ffde2eea..e5633eb06f 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -149,7 +149,7 @@ ReturnedValue String::get(Managed *m, const StringRef name, bool *hasProperty) return Primitive::fromInt32(that->_text->size).asReturnedValue(); } PropertyAttributes attrs; - Property *pd = v4->stringClass->prototype->__getPropertyDescriptor__(name, &attrs); + Property *pd = v4->stringObjectClass->prototype->__getPropertyDescriptor__(name, &attrs); if (!pd || attrs.isGeneric()) { if (hasProperty) *hasProperty = false; @@ -157,7 +157,7 @@ ReturnedValue String::get(Managed *m, const StringRef name, bool *hasProperty) } if (hasProperty) *hasProperty = true; - return v4->stringClass->prototype->getValue(that, pd, attrs); + return v4->stringObjectClass->prototype->getValue(that, pd, attrs); } ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty) @@ -172,7 +172,7 @@ ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty) return Encode(engine->newString(that->toQString().mid(index, 1))); } PropertyAttributes attrs; - Property *pd = engine->stringClass->prototype->__getPropertyDescriptor__(index, &attrs); + Property *pd = engine->stringObjectClass->prototype->__getPropertyDescriptor__(index, &attrs); if (!pd || attrs.isGeneric()) { if (hasProperty) *hasProperty = false; @@ -180,7 +180,7 @@ ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty) } if (hasProperty) *hasProperty = true; - return engine->stringClass->prototype->getValue(that, pd, attrs); + return engine->stringObjectClass->prototype->getValue(that, pd, attrs); } void String::put(Managed *m, const StringRef name, const ValueRef value) @@ -251,25 +251,22 @@ bool String::isEqualTo(Managed *t, Managed *o) String::String(ExecutionEngine *engine, const QString &text) - : Managed(engine ? engine->emptyClass : 0), _text(const_cast<QString &>(text).data_ptr()) + : Managed(engine->stringClass), _text(const_cast<QString &>(text).data_ptr()) , identifier(0), stringHash(UINT_MAX) , largestSubLength(0) { _text->ref.ref(); len = _text->size; - if (engine) - setVTable(&static_vtbl); type = Type_String; subtype = StringType_Unknown; } String::String(ExecutionEngine *engine, String *l, String *r) - : Managed(engine ? engine->emptyClass : 0) + : Managed(engine->stringClass) , left(l), right(r) , stringHash(UINT_MAX), largestSubLength(qMax(l->largestSubLength, r->largestSubLength)) , len(l->len + r->len) { - setVTable(&static_vtbl); type = Type_String; subtype = StringType_Unknown; |