diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-09 15:10:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-12 21:52:09 +0200 |
commit | 78e84f42ddf6c5cd925cfd15d8019d7941f39815 (patch) | |
tree | abf62c1f4ad61cb789e9b32e3f9b87d3a3e1e3a6 /src/qml/jsruntime/qv4sparsearray.cpp | |
parent | a723c7ae756ba567c2f818bb77a83c24373d3438 (diff) |
Use QV4::ReturnedValue in the runtime API
This makes function calls from the JIT/Moth into the
runtime significantly nicer.
Change-Id: Ie7d7123984d65c0bee0525d3d28c643a76b394c4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4sparsearray.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4sparsearray.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp index f21855ebc9..4a3cf9ebce 100644 --- a/src/qml/jsruntime/qv4sparsearray.cpp +++ b/src/qml/jsruntime/qv4sparsearray.cpp @@ -61,13 +61,15 @@ bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) co if (p2.value.isUndefined()) return true; if (Object *o = m_comparefn.asObject()) { + ValueScope scope(o->engine()); + ScopedValue result(scope); 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, QV4::ValueRef::fromRawValue(&m_comparefn), callData); - return result.toNumber() <= 0; + result = __qmljs_call_value(m_context, QV4::ValueRef::fromRawValue(&m_comparefn), callData); + + return result->toNumber() <= 0; } return p1.value.toString(m_context)->toQString() < p2.value.toString(m_context)->toQString(); } |