diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-11-12 13:55:44 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-15 13:16:20 +0100 |
commit | cd6db04169dcd0f7b49f5875d3c63d94fa32e17a (patch) | |
tree | 6e06f7e65b0d80b7c662d714a656bc8b8ea4039f | |
parent | 1b97c612e6228bd9c89ad57a922eebf6d44c9bf9 (diff) |
Remove ExecutionContext from the array sorting code
Change-Id: I3c59fdb2413664f1c541264a89613a325ecefd2a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/jsruntime/qv4arraydata.cpp | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arraydata_p.h | 2 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arrayobject.cpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index a546f78b54..e4a8772cb6 100644 --- a/src/qml/jsruntime/qv4arraydata.cpp +++ b/src/qml/jsruntime/qv4arraydata.cpp @@ -647,13 +647,13 @@ Property *ArrayData::insert(Object *o, uint index, bool isAccessor) class ArrayElementLessThan { public: - inline ArrayElementLessThan(ExecutionContext *context, Object *thisObject, const ValueRef comparefn) - : m_context(context), thisObject(thisObject), m_comparefn(comparefn) {} + inline ArrayElementLessThan(ExecutionEngine *engine, Object *thisObject, const ValueRef comparefn) + : m_engine(engine), thisObject(thisObject), m_comparefn(comparefn) {} bool operator()(Value v1, Value v2) const; private: - ExecutionContext *m_context; + ExecutionEngine *m_engine; Object *thisObject; const ValueRef m_comparefn; }; @@ -661,7 +661,7 @@ private: bool ArrayElementLessThan::operator()(Value v1, Value v2) const { - Scope scope(m_context); + Scope scope(m_engine); if (v1.isUndefined() || v1.isEmpty()) return false; @@ -738,7 +738,7 @@ top: } -void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint len) +void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const ValueRef comparefn, uint len) { if (!len) return; @@ -747,7 +747,7 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR return; if (!(comparefn->isUndefined() || comparefn->asObject())) { - context->engine()->throwTypeError(); + engine->throwTypeError(); return; } @@ -826,7 +826,7 @@ void ArrayData::sort(ExecutionContext *context, Object *thisObject, const ValueR } - ArrayElementLessThan lessThan(context, thisObject, comparefn); + ArrayElementLessThan lessThan(engine, thisObject, comparefn); Value *begin = thisObject->arrayData()->d()->arrayData; sortHelper(begin, begin + len, *begin, lessThan); diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h index 581f31a607..df6c3de8cb 100644 --- a/src/qml/jsruntime/qv4arraydata_p.h +++ b/src/qml/jsruntime/qv4arraydata_p.h @@ -152,7 +152,7 @@ struct Q_QML_EXPORT ArrayData : public Managed static void ensureAttributes(Object *o); static void realloc(Object *o, Type newType, uint alloc, bool enforceAttributes); - static void sort(ExecutionContext *context, Object *thisObject, const ValueRef comparefn, uint dataLen); + static void sort(ExecutionEngine *engine, Object *thisObject, const ValueRef comparefn, uint dataLen); static uint append(Object *obj, ArrayObject *otherObj, uint n); static Property *insert(Object *o, uint index, bool isAccessor = false); }; diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index bc47cb7c89..f2e5e09c55 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -445,7 +445,7 @@ ReturnedValue ArrayPrototype::method_sort(CallContext *ctx) uint len = instance->getLength(); ScopedValue comparefn(scope, ctx->argument(0)); - ArrayData::sort(ctx, instance, comparefn, len); + ArrayData::sort(scope.engine, instance, comparefn, len); return ctx->d()->callData->thisObject.asReturnedValue(); } |