diff options
| author | Lars Knoll <lars.knoll@digia.com> | 2014-03-13 21:28:30 +0100 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-18 09:05:57 +0100 |
| commit | 09f3cfee8d5e34b5f7058586c52c3fc36d295d93 (patch) | |
| tree | 34e2f85fc7914780db09365dc0654d9201f829f4 /src/qml/jsruntime/qv4object.cpp | |
| parent | 6b425f3182e57cb7cda6b559f3ee9673137706d0 (diff) | |
Add some specialized lookups for two internal classes
Some methods are being called with two different types of objects,
alternating between them. This adds a specialized lookup for that
case. Speeds up the splay test by ~20%.
Also create a clean path to a fallback lookup instead of going back
to the generic lookup and then alternating.
Change-Id: I3082d70d27155ef5f2cf2b680d227c6dd389956d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4object.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index f5c1be767f..37dc0a8bfb 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -485,6 +485,8 @@ ReturnedValue Object::getLookup(Managed *m, Lookup *l) l->getter = Lookup::getter1; else if (l->level == 2) l->getter = Lookup::getter2; + else + l->getter = Lookup::getterFallback; return v; } else { if (l->level == 0) @@ -493,6 +495,8 @@ ReturnedValue Object::getLookup(Managed *m, Lookup *l) l->getter = Lookup::getterAccessor1; else if (l->level == 2) l->getter = Lookup::getterAccessor2; + else + l->getter = Lookup::getterFallback; return v; } } @@ -544,8 +548,11 @@ void Object::setLookup(Managed *m, Lookup *l, const ValueRef value) } o = o->prototype(); l->classList[2] = o->internalClass; - if (!o->prototype()) + if (!o->prototype()) { l->setter = Lookup::setterInsert2; + return; + } + l->setter = Lookup::setterGeneric; } void Object::advanceIterator(Managed *m, ObjectIterator *it, StringRef name, uint *index, Property *pd, PropertyAttributes *attrs) |
