diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-05 14:49:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-11 13:01:54 +0200 |
commit | a23158a41291055aa0f546869e4c9f8efb19c2dc (patch) | |
tree | 747b5daced2a361724953ff7d45d6c4e87870a6f /src/qml/jsruntime/qv4sparsearray.cpp | |
parent | 6e8e5d16e16d6ee683a5c06a24f8f202ed5239ff (diff) |
Generate CallData structures directly in the instruction selection
Like this we can hand the CallData through the runtime methods
without any need to modify them. This simplifies the code in there,
and should also speed them up to some degree.
Change-Id: Ibd92ff4a8f279a5c4a054c5678646f658cfed5ca
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4sparsearray.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4sparsearray.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp index 835a0d004f..5b720d2fef 100644 --- a/src/qml/jsruntime/qv4sparsearray.cpp +++ b/src/qml/jsruntime/qv4sparsearray.cpp @@ -43,6 +43,7 @@ #include "qv4runtime_p.h" #include "qv4object_p.h" #include "qv4functionobject_p.h" +#include "qv4scopedvalue_p.h" #include <stdlib.h> #ifdef QT_QMAP_DEBUG @@ -54,20 +55,21 @@ using namespace QV4; bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) const { - Value v1 = p1.value; - Value v2 = p2.value; - if (v1.isUndefined()) + if (p1.value.isUndefined()) return false; - if (v2.isUndefined()) + if (p2.value.isUndefined()) return true; - if (!m_comparefn.isUndefined()) { - Value args[] = { v1, v2 }; + if (Object *o = m_comparefn.asObject()) { + ScopedCallData callData(o->engine(), 2); + callData->thisObject = Value::undefinedValue(); + callData->args[0] = p1.value; + callData->args[1] = p2.value; Value result = Value::undefinedValue(); - __qmljs_call_value(m_context, &result, /*thisObject*/0, m_comparefn, args, 2); + __qmljs_call_value(m_context, &result, m_comparefn, callData.ptr); return result.toNumber() <= 0; } - return v1.toString(m_context)->toQString() < v2.toString(m_context)->toQString(); + return p1.value.toString(m_context)->toQString() < p2.value.toString(m_context)->toQString(); } |